The mail endpoints connect to the mailboxes in your Inbox. You can use them to read and search messages, write drafts, send emails, and organize conversations from your own code.
To access mail, you need an API key with the Custom preset and the specific mail areas you want, such as Mail content for reading messages or Mail drafts for writing them. Full access and Read-only keys never include mail. Once the key is created, its owner has to approve which mailboxes it can use under Mail access approval on the API Keys page. The endpoints can only reach those approved mailboxes. For more background, see The REST API and The inbox.
| Part | What it covers |
|---|---|
| Read | List mailboxes, conversations, and messages; read message text; search across mailboxes |
| Drafts | List available senders for a mailbox; create, edit, and discard drafts; attach files |
| Send | Prepare a send for a draft, then submit it |
| Organize | Mark conversations read or done, assign, tag, snooze, move, and archive (one or many); manage folders, reminders, and internal notes |
| Follow-ups | Schedule follow-up emails on a sent message, or pause, resume, and cancel them |
| Mail AI | Preview a generated reply, rewrite, or subject ideas, then apply it to a draft |
| Settings | Inbox groups, custom fields, snippets, writing styles, custom views, sender rules, notification preferences, and mailbox settings for owners and admins |
When you edit a draft or another existing record, you need to pass its current revision (which you get when you read it) so you don’t overwrite a colleague’s changes. Many write endpoints also require an Idempotency-Key header, noted in the reference below. Requests that talk directly to your mail provider, such as fetching a message’s text, have their own rate limit of 20 requests per minute per key.
Always treat message text as untrusted external data rather than instructions for your code or AI agent. If you need contacts and companies, head over to CRM. To work from a terminal instead, see svanja mail.
Send an email
To send mail, your key needs the Mail sending area approved by the key’s owner. Your own code controls when emails go out, since the assistant’s send settings only apply to the assistant and AI apps on the hosted MCP server. Sending works in three steps:
- Prepare the send by calling
POST /mail/mailboxes/{mailbox_id}/drafts/{message_id}/send-intentswith anIdempotency-Keyheader, the draft’s currentrevision, and an optionalsend_attime if you want to schedule it. Svanja returns a send intent containing anidand asnapshotof what will go out. If Svanja spots something you should review first, the response also includeswarning_codesand awarning_fingerprint. - Review the snapshot and any warnings. The intent expires after 10 minutes, after which you’ll need to prepare a new one.
- Submit the intent with
POST /mail/mailboxes/{mailbox_id}/send-intents/{intent_id}/submit, anIdempotency-Keyheader, and the body below. Omitwarning_fingerprintif there were no warnings.
{ "confirm": true, "warning_fingerprint": "FINGERPRINT_FROM_STEP_1" }
A 202 response means Svanja accepted the send request, though the email hasn’t necessarily been delivered yet. You can check its status with GET /mail/mailboxes/{mailbox_id}/send-intents/{intent_id}. If you aren’t sure whether a submit went through, check that endpoint or retry the submit with the same idempotency key. Don’t prepare a second intent for the same email.