Mail API
This article and the rest of the API documentation in this section are written for a technical audience — integrators and developers connecting external systems to Tickiti. Familiarity with HTTP, REST, JSON and bearer-token authentication is assumed.
The Mail API sends email and exposes the Mail admin screens — mailboxes, ignored subjects, excluded emails and the sent-mail audit. Every endpoint runs as the token’s owner and is gated by the mail ability plus the owner’s admin role.
Gmail OAuth connection and raw .eml download are browser flows, available from the Mail screens.
Abilities and conventions
mail:read— read endpoints.mail:write— send, create / update / delete endpoints. Write implies read.
All endpoints are POST and JSON. Mailbox reads never include secrets (POP/SMTP passwords, OAuth refresh token) — only a gmail_connected flag. See the API overview for the shared request and authentication conventions, and Custom domain setup for the related sending-domain configuration.
Endpoints
| Method & path | Ability | Purpose |
|---|---|---|
| POST /api/v1/mail/send | mail:write | Send an email (subject + content, or a template + data); Idempotency-Key header required |
| POST /api/v1/mail/mailboxes | mail:read | List mailboxes (+ selectable queues) |
| POST /api/v1/mail/mailboxes/create | mail:write | Create a mailbox |
| POST /api/v1/mail/mailboxes/update | mail:write | Update a mailbox by mailbox_id |
| POST /api/v1/mail/mailboxes/set-password | mail:write | Set a POP/SMTP/client secret (field, value) |
| POST /api/v1/mail/mailboxes/delete | mail:write | Delete a mailbox by mailbox_id |
| POST /api/v1/mail/subjects | mail:read | List ignored subjects |
| POST /api/v1/mail/subjects/create | mail:write | Add an ignored subject (subject) |
| POST /api/v1/mail/subjects/delete | mail:write | Delete an ignored subject by id |
| POST /api/v1/mail/excluded-emails | mail:read | List excluded emails |
| POST /api/v1/mail/excluded-emails/create | mail:write | Add an excluded email (email) |
| POST /api/v1/mail/excluded-emails/delete | mail:write | Delete an excluded email by id |
| POST /api/v1/mail/sent-mail | mail:read | Recent sent mail (range_days 1–30, limit 1–300) |
| POST /api/v1/mail/sent-mail/search | mail:read | Search sent mail by subject or recipient (q, limit 1–500) |
| POST /api/v1/mail/sent-mail/show | mail:read | Fetch one sent message by id |
Sending email
POST /api/v1/mail/send sends one email from one of your mailboxes. It is not tied to a ticket — use the Reply to ticket API to write to a customer on a ticket.
The request needs an Idempotency-Key header: resending the same request with the same key returns the stored result and sends nothing more, and the same key with a different body is refused with 409. See Idempotency.
Body fields:
to_address— required. The recipient.- Then exactly one payload shape:
subject+content(HTML), ortemplate_identifier+data— anemail-type template rendered with the token values indata. With a template, asubjectyou send replaces the template’s subject. cc— optional array of additional recipients; each must be a valid email address.mailbox— optional. The name of the mailbox to send from. Omit it to send from the default mailbox.validate_address— optional, defaultfalse. Whentrue, a malformedto_addressis refused with422straight away; otherwise the message is accepted and queued on its shape alone.
A template’s inline images are embedded in the message, so they display in the recipient’s mail client. To check a template’s output without sending it, use templates/render.
curl -X POST https://support.sole-trader.example/api/v1/mail/send \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Idempotency-Key: 3f9c1a52-6e0b-4d7a-8b21-9c4e5f6a7b8c" \
-H "Content-Type: application/json" \
-d '{
"to_address": "[email protected]",
"template_identifier": "order_dispatched",
"data": { "name": "Marcus", "order_number": "TB-10442" }
}'Successful response:
{
"ok": true,
"data": {
"mailbox": "[email protected]",
"used_template": true
}
}A request with neither payload shape, an unknown mailbox or an unknown template is refused with 422 and an errors object naming the field.
Sent mail
sent-maillists mail sent in the lastrange_daysdays (1–30, default 1), newest first.limit(1–300) caps the number of rows; up to 300 are returned. Each item carriesid,sent_at,to_address,subjectandcan_download.sent-mail/searchtakesq(also accepted assearch), which matches the subject and the to_address, andlimit(1–500, default 200).qis required: a call without it is refused with422. An emptyitemslist means nothing matched.sent-mail/showtakes anidand returns the message’s from, to, cc, bcc and reply-to addresses, subject andhtml, with inline images embedded so the HTML displays on its own.