Logs

Every API request, email event and webhook attempt of an environment, in one place.

Each environment has a log. It records:

Lines have a level: error for 5xx responses, bounces, complaints and failures, warning for 4xx responses, delays, suppressions and webhook attempts that will be retried, info for everything else. Lines about the same email share its resource_id, so a send request, the email's events and the webhook attempts they caused read as one timeline.

Open Logs in an environment of the dashboard to search, filter, follow new lines live and export them as CSV or NDJSON. Or read them through the API:

const { ,  } = await ..({
  : new (.() - 24 * 60 * 60 * 1000),
  : ["warning", "error"],
  : "api",
});
for (const  of ?. ?? []) {
  .(., ., ., .);
}

Pages are newest first: pass the last line's id as after while has_more is true. A query covers an hour unless you pass from/to, and at most 31 days. Reading logs is not itself logged.

Searching

The dashboard's search box takes key:value filters and free text. Repeating a key matches any of its values; -key:value excludes.

What is kept

Request and response bodies are stored redacted: secrets (such as a webhook endpoint's signing secret), attachment contents and the Authorization header are never kept, long strings are cut to 2,048 characters and bodies to 16 KB. Requests that fail authentication can't be attributed to an environment and are not logged.

Logs are kept for 30 days. To keep them longer, or to search them next to your own logs, stream them to your logging stack with a log drain.

Last updated