List log lines
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.
bearerAuthAuthorizationBearer <token>A secret API key from the dashboard: coss_live_… for production environments, coss_test_… for sandbox environments.
from?stringStart of the range (inclusive). Defaults to an hour before to.
date-timeto?stringEnd of the range (exclusive). Defaults to now. At most 31 days.
date-timesource?stringOnly these sources, comma-separated: api,email,webhook.
level?stringOnly these levels, comma-separated: warning,error.
type?stringOnly these types, e.g. email.bounced,email.complained.
status?stringOnly these status codes or classes, e.g. 4xx,503.
method?stringOnly these HTTP methods, e.g. POST.
route?stringOnly these routes, e.g. /v1/emails/:id.
api_key_id?stringOnly requests made with these API keys.
request_id?stringOnly this request's lines.
length <= 64resource_id?stringOnly lines about this resource, e.g. an email_… id.
length <= 64q?stringFree text, matched against the message, path, ids and recipient.
length <= 256limit?integer1-100, default 50.
1 <= value <= 100after?stringCursor: the id of the last line of the previous page.
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"A page of log lines.
application/json- response
- response
- …
object*"list""list"data*array<>has_more*booleanimport { 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}