Retrieve a log line
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
object*"log""log"id*stringoccurred_at*stringdate-timesource*LogSourceapi: a request to the API. email: an email event. webhook: a delivery attempt.
"api""email""webhook"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, 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*string|nullmethod*string|nullpath*string|nullroute*|The matched route, e.g. /v1/emails/:id.
status_code*|The API response status, or the webhook endpoint's response status.
duration_ms*integer|nullclient_ip*string|nulluser_agent*string|nullerror_code*string|nullresource_type*|What the line is about: email, domain, webhook_endpoint…
resource_id*string|nullrecipient*string|nullattributes*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" } } }}Update a log drain PATCH
Changes the URL, description, sources or `enabled` flag. Omitted fields keep their current value, and the signing secret stays the same. Disabling a drain drops the lines still waiting for it, and nothing is kept for it while it is disabled; enabling it again (also after COSS disabled it for failing) sends lines logged from then on.
List log lines GET
The API key's environment log, newest first: every API request made with one of its keys (`source: api`), every email event (`email`) and every webhook delivery attempt (`webhook`). Filter by time range (an hour by default, at most 31 days), source, level, type, status, method, route, key, request, resource or free text. Pass the last `id` as `after` to get the next page while `has_more` is true. Reading logs is not itself logged.