COSS
Logs

List log lines

GET
/v1/logs

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.

Authorization

bearerAuth
headerAuthorizationBearer <token>

A secret API key from the dashboard: coss_live_… for production environments, coss_test_… for sandbox environments.

Query Parameters

from?string

Start of the range (inclusive). Defaults to an hour before to.

Formatdate-time
to?string

End of the range (exclusive). Defaults to now. At most 31 days.

Formatdate-time
source?string

Only these sources, comma-separated: api,email,webhook.

level?string

Only these levels, comma-separated: warning,error.

type?string

Only these types, e.g. email.bounced,email.complained.

status?string

Only these status codes or classes, e.g. 4xx,503.

method?string

Only these HTTP methods, e.g. POST.

route?string

Only these routes, e.g. /v1/emails/:id.

api_key_id?string

Only requests made with these API keys.

request_id?string

Only this request's lines.

Lengthlength <= 64
resource_id?string

Only lines about this resource, e.g. an email_… id.

Lengthlength <= 64
q?string

Free text, matched against the message, path, ids and recipient.

Lengthlength <= 256
limit?integer

1-100, default 50.

Range1 <= value <= 100
after?string

Cursor: the id of the last line of the previous page.

Header Parameters

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.

Value in"2026-10-10"

Response Body

A page of log lines.

application/json
  1. response
object*"list"
Value in"list"
data*array<>
has_more*boolean
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.list();
{  "object": "list",  "data": [    {      "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"          }        }      }    }  ],  "has_more": false}