Retrieve a log line
One line of the API key's environment log.
bearerAuthAuthorizationBearer <token>A secret API key from the dashboard: coss_live_… for production environments, coss_test_… for sandbox environments.
id*stringThe log line's id.
Coss-Version?"2026-10-10"The API version (a date) to use for this request. Defaults to your organization's version, pinned to the latest one when it first used the API and upgraded from the dashboard. The SDK always sends the version it was built for.
"2026-10-10"The log line.
application/json- response
- response
- …
object*"log""log"id*stringoccurred_at*stringWhen it happened.
date-timesource*LogSourceapi: a request to the API. email: an email event. webhook: a delivery attempt. risk: a risk assessment or its feedback. smtp: a message submitted to the SMTP relay. sms: an SMS event.
"api""email""webhook""risk""smtp""sms""sign""verify""forms""scheduling"level*LogLevelerror: 5xx responses, bounces, complaints, failures. warning: 4xx responses, delays, suppressions, failed webhook attempts that will be retried. info: everything else.
"info""warning""error"type*stringapi.request, webhook.attempt, webhook.forward (an event coss listen forwarded), or an email event type such as email.delivered.
message*stringA one-line summary.
request_id*|The X-Request-Id of the API request this line belongs to.
api_key_id*|The API key that made the request. null: not an API request.
method*|The HTTP method. null: not an HTTP line.
path*|The request's path. null: not an API request.
route*|The matched route, e.g. /v1/emails/:id.
status_code*|The API response status, or the webhook endpoint's response status.
duration_ms*|How long it took, in milliseconds. null: not timed.
client_ip*|The caller's address. null: not an API request.
user_agent*|The caller's User-Agent. null: not sent.
error_code*|The error's code. null: no error.
resource_type*|What the line is about: email, domain, webhook_endpoint…
resource_id*|The id of what it's about. null: nothing in particular.
recipient*|The recipient an email event is about. null: none.
attributes*Details: redacted request and response bodies for API requests (secrets, attachment contents and long strings are never stored), event data for emails and webhooks.
import { Coss } from "coss";const coss = new Coss({ apiKey: process.env.COSS_API_KEY, baseUrl: "https://api.coss.com",});const { data, error } = await coss.logs.get("log_01k7c8m4q2f3e9v6t5r1n0p8yz");{ "object": "log", "id": "log_01k7c8m4q2f3e9v6t5r1n0p8yz", "occurred_at": "2026-01-15T09:30:00.000Z", "source": "api", "level": "info", "type": "api.request", "message": "POST /v1/emails 202", "request_id": "req_01k7c8m4q2f3e9v6t5r1n0p8yz", "api_key_id": "key_01k7c8m4q2f3e9v6t5r1n0p8yz", "method": "POST", "path": "/v1/emails", "route": "/v1/emails", "status_code": 202, "duration_ms": 48, "client_ip": "203.0.113.7", "user_agent": "coss-node/0.1.0", "error_code": null, "resource_type": "email", "resource_id": "email_01k7c8m4q2f3e9v6t5r1n0p8yz", "recipient": null, "attributes": { "request": { "body": { "from": "hello@example.com", "to": [ "user@example.com" ], "subject": "Hi" } }, "response": { "body": { "object": "email", "id": "email_01k7c8m4q2f3e9v6t5r1n0p8yz" } } }}