API request logs
See the requests your code made to a project, with their status, timing, API key, IP address and user agent, and match one to its x-request-id.
The request logs answer "what did my code send, and what did the API say?". Every request
an API key makes to a project is logged after its answer, refused ones too: a
401 restricted_api_key from a sending-only key calling another endpoint, or a 422 from a
bad payload, leaves a trace you can read. Open them on the project's Logs page in the
dashboard.
A log holds what the request was, never what it carried: no request or response body, no
query string and no header other than User-Agent. Logging never slows a request or makes
it fail, so under heavy load some requests go unlogged (gaps).
What a log shows
| Field | What it is |
|---|---|
| Time | When the request came in |
| Method and path | POST /emails; the path is cut after 512 bytes |
| Route | The endpoint it matched, with placeholders: /emails/{id} |
| Status | The status of the answer, and the error name of a refused one |
| Duration | Time until the API started its answer |
| Sizes | The size of the request body and of the answer's body, when known |
| Made with | The API key (its id and name), or the team member in the dashboard |
| IP address and user agent | Where the request came from; the user agent is cut after 256 bytes |
| Resource | What a POST, PATCH or DELETE made or changed, such as the email's id |
| Request id | The id of the log, the same as the answer's x-request-id header |
A client that hung up before the answer is logged with 499 client_closed_request.
A path can hold data your code put in it, such as an address in
DELETE /suppressions/{email}. It is kept like the rest of the log.
Find a request
The page lists requests newest first. Filter by who made them (API keys, which is the
default, the dashboard, or both), by status class (4xx), by method, by the start of the
path, by API key, and by date (UTC). Open a request to see all of its log.
Every answer to a request with a valid key carries x-request-id, errors included. Log it
with your own logs: it is the id of the request's log, and it names the request when you
write to support (errors).
What is not logged
- Requests without a valid key of the project: no key, a revoked or unknown key. Those never reach a project.
- Requests to routes that do not exist, and
GET /openapi.json. - Downloads through signed links: sent attachments and email log exports.
- Reading the request logs themselves.
Gaps in the logs
Each API server logs up to 200 requests a second of an organization, with bursts of up to 400, counting refused requests apart from the rest, and skips the requests past that. Requests also go unlogged when a server has more waiting to be logged than it can hold, or when writing a batch of logs fails or takes too long. Use the logs to debug, not to count or bill requests.
The dashboard's own requests to a project are logged too, with the member who made them. They are left out of the list until you choose Dashboard or Both.
Who can read them
Request logs hold IP addresses and user agents, so only the owner, admin, developer
and support roles can read them (team roles). They are in the
dashboard only: an API key cannot read them.
How long logs are kept
Request logs are kept for 30 days on every plan. They are deleted a whole day at a time, once all of that day is older, so the oldest logs stay up to about 31 days.
Metrics
Read how much of your mail was accepted, delivered, bounced and drew complaints per day or hour, per domain and stream, how each mailbox provider treats it, and your bounce and complaint rates against the limits.
Export the email log
Download a date range of a project's email log as CSV or JSON Lines, one row per recipient, to keep it longer or study it in your own tools.