Mail API reference

Mail API · Outbound-Messages

get/v1/workspaces/{workspace_id}/messages/exportAuth

Stream the filtered message log as CSV. Same filters as GET /messages. Body columns are intentionally omitted; bodies remain gated by `mail.message.body.read`. Rate-limited 1 concurrent + 5/hour per workspace.

Columns: id, created_at, sent_at, delivered_at, deferred_at, deferral_count, from_address, to_address, subject, template_name, status, spf_result, dkim_result, dmarc_result, bounce_code, bounce_detail, api_key_id, source, domain. The filters are resolved by the same code as `GET /messages`, so the same query string exports exactly the rows the list pages through. A rejected filter (400) does not count against the hourly cap.

Path parameters

workspace_id*string · uuid

Id of the workspace.

Query parameters

qstring

Free-text search, case-insensitive. Matches a substring of the recipient, the from address or the subject, or exactly a message id (uuid) or a Message-ID (the provider message id, with or without its `<…@…>` domain).

statusarray

Only messages in any of these statuses. Repeat the parameter (`status=bounced&status=complained`), use the bracket form (`status[]=bounced&status[]=complained`) or comma-separate the values (`status=bounced,complained`); a single value is the original single-status filter.

domain_idstring · uuid

Only messages sent from this domain (`domain.id`).

api_key_idstring · uuid

Only messages sent with this Platform API Key. Recorded from 2026-10-12; older messages have no key.

sourceenum (4)

How the message was sent: `api_key` (a Platform API Key), `dashboard` (a signed-in person, in the console or through MCP), `platform` (in-cluster product mail), `test_send` (a template test send). Recorded from 2026-10-12; older messages all read `platform`.

templatestring

Filter by template name.

created_afterstring · date-time

Only messages created at or after this instant. With `created_before`, the window may span at most 30 days (the log retention).

created_beforestring · date-time

Only messages created before this instant. Without `created_after`, the window is the 30 days before it.

recipientstring

Legacy: filter by exact recipient address. Prefer `q`.

subject_containsstring

Legacy: substring filter on subject (case-insensitive, max 200 chars). Prefer `q`.

Response · 200

text/csv stream with one header row + one row per message. Content-Disposition: attachment.

Example

Request

GET https://api.mail.productcraft.co/v1/workspaces/{workspace_id}/messages/export
Authorization: Bearer YOUR_TOKEN