CSV Exports
Two paths for exporting log data: (1) synchronous email-log CSV stream via signed token; (2) async API-request-log CSV emailed as an attachment because the table is too large to stream live.
Posthawk has two export pipelines depending on data size:
Email logs (synchronous stream)
For email_logs (sent + received emails), the export is a streamed CSV download. You first request a signed token, then redirect the browser to the worker's CSV endpoint with that token. The browser receives the CSV as a file download.
This is what the dashboard's "Export CSV" button on the Logs page does.
Token TTL is 5 minutes and consumed on first use. Date range is capped at 31 days.
API request logs (async, emailed)
The request_logs table records every authenticated HTTP request to the worker. It can hold tens of millions of rows for a busy workspace, so synchronous streaming would time out. Instead, the export is queued as a BullMQ job — the worker compiles the CSV and emails it to you as an attachment when ready (typically within a minute).
This is what the dashboard's "Export CSV" button on the Logs API tab does.
/export/tokenRequest a signed token for an email-log CSV export. Token is valid for 5 minutes and consumed on first use.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your JWT.
Body
typestringrequired"sent" | "received" | "both"
dateFromstringrequiredISO 8601 datetime (max 31 days back)
dateTostringrequiredISO 8601 datetime
statusesstring[]optionalFilter by email_logs.status: queued, processing, sent, delivered, bounced, complained, failed
apiKeyIdstringoptionalFilter sent emails to a specific API key (sent type only)
domainIdstringoptionalFilter received emails to a specific domain (received type only)
curl -X POST https://api.posthawk.dev/export/token \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your_jwt_token" \
-d '{
"type": "sent",
"dateFrom": "2026-04-01T00:00:00Z",
"dateTo": "2026-04-30T23:59:59Z",
"statuses": [
"delivered",
"bounced"
],
"apiKeyId": "api-key-uuid",
"domainId": "domain-uuid"
}'{ "token": "signed.jwt.string", "expiresIn": 300 }/export/csv?token=...Download the CSV. Browser-redirected from the dashboard with the token from the previous step. Streams the CSV with Content-Disposition: attachment.
Authorizations
No authentication required — this is a public endpoint.
Query Parameters
tokenstringrequiredSigned token from POST /export/token (5min TTL, consumed on first use)
curl "https://api.posthawk.dev/export/csv?token=..."/export/request-logsQueue an async request-logs export. The worker compiles the CSV and emails it to you as an attachment when ready. Date range capped at 31 days.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your JWT.
Body
dateFromstringrequiredISO 8601 datetime
dateTostringrequiredISO 8601 datetime (max 31 days from dateFrom)
methodstringoptionalHTTP method filter (GET, POST, PATCH, PUT, DELETE)
statusRangestringoptional"2xx" | "4xx" | "5xx"
curl -X POST https://api.posthawk.dev/export/request-logs \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your_jwt_token" \
-d '{
"dateFrom": "2026-04-01T00:00:00Z",
"dateTo": "2026-04-30T23:59:59Z",
"method": "POST",
"statusRange": "2xx"
}'{
"success": true,
"message": "Export queued. You will receive an email with the CSV attached when ready."
}