API reference
Manage tags, lists and contacts, read every campaign's numbers, push contacts and events in from your app, and send transactional email. Built for your own code and for AI assistants (MCP): name a tag or a list by its name and a contact by its email. Email goes through the same verified domains and sending provider as your campaigns.
Authentication
Create a key under API keys and send it as a bearer token. A key belongs to one workspace and is shown once, when it is created.
Authorization: Bearer sa_live_xxxxxxxxxxxxxxxxxxxxxxxxBase URL: https://sendapt.com
Sign in with OAuth (assistants and MCP)
An AI assistant such as Claude, ChatGPT or Cursor can connect by signing you in instead of a pasted key. Add the Sendapt MCP server (https://mcp.sendapt.com/mcp) to the assistant; it sends you to a Sendapt page that shows the app, the workspace and what it asks to do. Delete and send permissions are never ticked for you, and an assistant can never send one-off email (emails:send). The app then calls this API with an access token (sa_oat_…) in place of a key, with the same scopes and limits. Only a workspace owner or admin can connect an app, and the connection stops if they lose that role. See and disconnect connected apps under API keys. Every tool and how to connect each assistant: MCP reference.
Building your own client: OAuth 2.1 with PKCE (S256), public clients, dynamic registration. Discovery: https://sendapt.com/.well-known/oauth-authorization-server. Scopes are the API scopes below (no emails:send or events:write). Redirect addresses must be on a supported assistant or on localhost.
API key types
Each key says what it may do. Pick a ready-made type when you create it, or any mix of scopes. Scopes come in four kinds: read data out, write data in (create, change, add to a list, events), delete data for good, and send email. Give each system only what it needs: an AI assistant gets an Assistant key (it can never delete or send), a sign-up sync gets a Data sync key, a dashboard gets a Read only key. A call the key is not allowed to make is refused with a 403 and the scope it needs. Keys created before key types existed keep the four scopes the API had then: send email, write contacts, write events and read campaigns.
Full access
Everything, deleting and sending included. Only for your own backend.
tags:readlists:readcontacts:readcampaigns:readtemplates:readautopilot:readtags:writelists:writecontacts:writecampaigns:writeautopilot:writeevents:writetags:deletelists:deletecontacts:deletecampaigns:sendemails:send
Assistant (MCP)
An AI assistant reads everything, manages tags, lists and contacts and drafts campaigns. Cannot delete or send.
tags:readlists:readcontacts:readcampaigns:readtemplates:readautopilot:readtags:writelists:writecontacts:writecampaigns:writeautopilot:write
Data sync
Your app sends contacts and events in, and checks the connection. Cannot delete or send.
contacts:writeevents:writecampaigns:read
Read only
For a dashboard or report. Cannot change, delete or send anything.
tags:readlists:readcontacts:readcampaigns:readtemplates:readautopilot:read
Sending only
Transactional email from your app. Cannot see or touch contacts.
emails:send
| Direction | Scope | Allows |
|---|---|---|
| Read data | tags:read | List tags with how many contacts carry each. |
| Read data | lists:read | List lists and see one with its member counts. |
| Read data | contacts:read | List and search contacts, and look one up by email. |
| Read data | campaigns:read | List campaigns and read one campaign's full report. |
| Read data | templates:read | List saved email templates and read one, to start a campaign from it. |
| Read data | autopilot:read | List Autopilot series with their triggers, stop rules and numbers, and read one series email by email. Counts only. |
| Write data | tags:write | Create, rename and recolour tags. |
| Write data | lists:write | Create and rename lists, add and remove their contacts. |
| Write data | contacts:write | Add or update contacts, their tags and lists, one or many at once. |
| Write data | campaigns:write | Create and edit draft campaigns, pause one that is sending, cancel a schedule. Sends nothing. |
| Write data | autopilot:write | Pause an Autopilot series. Sends nothing. |
| Write data | events:write | Tell Sendapt what a user did, to start Autopilot series. |
| Delete data | tags:delete | Delete a tag: it comes off every contact and out of every audience. |
| Delete data | lists:delete | Delete a list. Its contacts are kept. |
| Delete data | contacts:delete | Delete a contact and their history for good. |
| Send email | campaigns:send | Send a test, send or schedule a campaign, resume one, put people into an Autopilot series or switch one on. Real email goes out. |
| Send email | emails:send | Send email, such as a receipt or a password reset, to one address or a list. |
All endpoints
Where a path has :name or :email, the record's id works too. URL-encode names with spaces or : (plan%3Afree). Lists take ?page and ?limit (up to 100) and answer total, page and limit. Bodies are strict: a field the endpoint does not know is a 400 naming it. Successes use real HTTP codes (200, 201 created, 202 accepted) and answers are never cached.
| Endpoint | Scope | What it does |
|---|---|---|
| GET/api/v1/me | any key | Who is calling: the workspace, and the key or connected app with its type and scopes. Call first. |
| GET/api/v1/tags | tags:read | Every tag with how many contacts (all, and subscribed) carry it. |
| POST/api/v1/tags | tags:write | Create a tag. One that exists comes back with created: false.Takes: name: letters, numbers, spaces, - _ : · color?: brand | info | ok | warn | bad | neutral |
| PATCH/api/v1/tags/:name | tags:write | Rename or recolour a tag. A rename is applied everywhere; renaming to an existing name merges the two.Takes: name? · color? A rename changes every contact, audience, form and series that uses the tag. |
| DELETE/api/v1/tags/:name | tags:delete | Delete a tag: it comes off every contact and audience; a series it started is paused. Cannot be undone. Ask the person first. |
| GET/api/v1/lists | lists:read | Lists with member counts, newest first.Takes: page?, limit? (up to 100) |
| GET/api/v1/lists/:name | lists:read | One list with its member counts. Members: GET /api/v1/contacts?list=<name>. |
| POST/api/v1/lists | lists:write | Create a list. A name in use is a 409 with that list's id.Takes: name · description? |
| PATCH/api/v1/lists/:name | lists:write | Rename a list or change its description.Takes: name? · description? |
| POST/api/v1/lists/:name/contacts | lists:write | Add contacts to a list or take them off, by email. Unknown emails come back in not_found.Takes: add?: [emails] · remove?: [emails] Adding someone starts the Autopilot series that wait for the list, and those send email. |
| DELETE/api/v1/lists/:name | lists:delete | Delete a list. Its contacts are kept. Cannot be undone. Ask the person first. |
| GET/api/v1/contacts | contacts:read | Contacts, newest first, with tags and lists.Takes: page?, limit? (up to 100) · search?: part of an email or name · status?: SUBSCRIBED | PROSPECT | UNSUBSCRIBED | BOUNCED | COMPLAINED · tag? or tags?=a,b · list?: name or id |
| GET/api/v1/contacts/:email | contacts:read | One contact: status, tags, lists, consent, last open and click, and the series they are in. |
| POST/api/v1/contacts | contacts:write | Add a contact or update the one with that email: names, tags, tag groups, lists, consent, unsubscribe.Takes: email · first_name?, last_name? · tags?, remove_tags?, replace_tags? · lists?: names · subscribed?: false unsubscribes · consent? Adding a tag or a list starts the series that wait for it. Never re-subscribes anyone. |
| POST/api/v1/contacts/batch | contacts:write | The same for many contacts at once; each item is checked on its own.Takes: contacts: [ same fields as above ] |
| DELETE/api/v1/contacts/:email | contacts:delete | Delete a contact and their history for good. Cannot be undone. To stop emailing someone, send subscribed: false instead. |
| POST/api/v1/events | events:write | Tell Sendapt a user did something; starts the series waiting for that event.Takes: email · event: account_connected, trial_ending, ... · first_name?, last_name? (new contacts) Starts series, which send email. |
| GET/api/v1/campaigns | campaigns:read | Campaigns with their totals, newest first.Takes: page?, limit? (up to 100, default 50) · status?: DRAFT | SCHEDULED | SENDING | SENT | PAUSED | FAILED |
| GET/api/v1/campaigns/:id | campaigns:read | One campaign's full report: totals, delivered, opens and clicks over time, top links, countries, devices, mailbox services, latest activity. |
| POST/api/v1/campaigns | campaigns:write | Create a DRAFT campaign: name, subject, content or a template, sender, audience by list names or tags. Sends nothing. The answer has audience.count.Takes: name · template?: id, slug or name · subject?, preview_text?, html? · from_name?, from_email?, reply_to? · lists?: [names], tags?: [tags], all_contacts? · track_opens?, track_clicks? |
| PATCH/api/v1/campaigns/:id | campaigns:write | Change a draft: any of the fields above. A scheduled or sent campaign is a 409.Takes: same fields as create, all optional (no template) |
| GET/api/v1/campaigns/:id/recipients | contacts:read | Who a campaign went to and what each did, paged.Takes: filter?: all | opened | clicked | failed | bounced | pending · page?, limit? |
| POST/api/v1/campaigns/:id/test | campaigns:send | Send one "[Test]" copy to a member of the workspace's team.Takes: to: a team member's email · header Idempotency-Key? Sends a real email to the team member. |
| POST/api/v1/campaigns/:id/send | campaigns:send | Send a draft now, or schedule it. expected_audience must equal the audience count now, or nothing is sent (409 Audience_Changed).Takes: expected_audience: audience.count · scheduled_at?: ISO time with offset · header Idempotency-Key? Sends real email to everyone in the audience. Tell the person how many people and get a clear yes first. |
| POST/api/v1/campaigns/:id/status | campaigns:write | Pause a campaign that is sending, resume one (also needs campaigns:send), or cancel a schedule.Takes: action: pause | resume | unschedule Resume sends email again. |
| GET/api/v1/templates | templates:read | Saved email templates, newest change first, without their HTML.Takes: page?, limit? |
| GET/api/v1/templates/:ref | templates:read | One template with its HTML, by id, slug or name. |
| GET/api/v1/autopilot | autopilot:read | Every Autopilot series: status, trigger and stop rules as data, people in each state, email totals (opens and clicks among tracked emails).Takes: days? (email totals for the last N days; "entered recently" window, default 7) · status?: active | paused | draft |
| GET/api/v1/autopilot/:id | autopilot:read | One series, email by email: wait, subject, sent, failed, bounced, complained, opened, clicked, unsubscribes after it, people waiting for it.Takes: days? (email numbers for the last N days) |
| POST/api/v1/autopilot/:id/contacts | campaigns:send | Put subscribed contacts into a running series by email; its stop rules apply and nobody is added twice.Takes: add: [emails] They start getting the series' emails. |
| POST/api/v1/autopilot/:id/status | autopilot:write | Pause a series, or switch it on (also needs campaigns:send; 409 Not_Ready lists what is missing).Takes: status: active | paused Switching on sends the series' emails. |
| POST/api/v1/emails | emails:send | Send an email through the workspace's sending provider: to one address, or to a list (each address gets its own email). An Idempotency-Key header makes a retry safe.Takes: from (verified domain), from_name? · to: one address or [addresses] · subject, html, text? · reply_to? · header Idempotency-Key? (a retry with the same key sends nothing) Sends real email. Not for AI assistants (phase 2). |
# Tags, lists and contacts by name and email
curl https://sendapt.com/api/v1/tags -H "Authorization: Bearer $SENDAPT_API_KEY"
curl -X POST https://sendapt.com/api/v1/lists -H "Authorization: Bearer $SENDAPT_API_KEY" \
-H "Content-Type: application/json" -d '{ "name": "Beta testers" }'
curl -X POST "https://sendapt.com/api/v1/lists/Beta%20testers/contacts" -H "Authorization: Bearer $SENDAPT_API_KEY" \
-H "Content-Type: application/json" -d '{ "add": ["jane@example.com"] }'
curl "https://sendapt.com/api/v1/contacts?list=Beta%20testers&limit=20" -H "Authorization: Bearer $SENDAPT_API_KEY"
# One campaign's full report
curl https://sendapt.com/api/v1/campaigns/7d3c… -H "Authorization: Bearer $SENDAPT_API_KEY"/api/v1/emails
emails:sendSend an email, for example a receipt or a password reset. The from address must be on a verified domain. to is one address or a list of up to 50: each address gets its own email, so recipients never see each other. Addresses that hard-bounced or reported spam are skipped; when that is the only address, the call is refused with a 422.
Retries. Send an Idempotency-Key header (a UUID works well). A retry with the same key within 24 hours gets the first answer, with the header Idempotent-Replayed: true, and sends nothing. The same key with a different body is a 422; while the first call is still running, a 409. A call that failed (nothing sent) can be retried with the same key.
| Field | Type | Description |
|---|---|---|
| fromrequired | string | Sender address on a verified domain. |
| from_name | string | Display name shown next to the address. |
| torequired | string or string[] | One address, or a list: each address gets its own email. |
| subjectrequired | string | Up to 200 characters. |
| htmlrequired | string | HTML body. |
| text | string | Plain-text body. Generated from the HTML when omitted. |
| reply_to | string | Address replies go to. |
curl -X POST https://sendapt.com/api/v1/emails \
-H "Authorization: Bearer $SENDAPT_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 5f0c7f9e-0d1b-4c55-9a3e-8f1e2b7d4a10" \
-d '{
"from": "billing@yourdomain.com",
"from_name": "Your Company",
"to": "customer@example.com",
"subject": "Your receipt",
"html": "<p>Thanks for your order.</p>"
}'{
"statusCode": 200,
"success": true,
"message": "Email sent.",
"data": {
"id": "9b2f…",
"message_id": "0100018f…",
"provider": "ses",
"results": [{ "to": "customer@example.com", "status": "sent", "id": "9b2f…", "message_id": "0100018f…" }]
}
}/api/v1/contacts
contacts:writeAdd a contact, or update the one with the same email. Call it from your app when someone signs up and whenever their plan changes, sending their whole current state: the last call wins. Tag changes start the Autopilot series that watch for them and apply their stop rules. An API call can unsubscribe someone but never re-subscribes anyone. Lists are matched by name and created when they do not exist.
| Field | Type | Description |
|---|---|---|
| emailrequired | string | The contact's address. Used to find an existing contact. |
| first_name | string | Used by the {{first_name}} merge tag. |
| last_name | string | Used by the {{last_name}} merge tag. |
| tags | string[] | Tags to add to any the contact already has. Letters, numbers, spaces, -, _ and : (for groups such as plan:free). A contact holds up to 20. |
| remove_tags | string[] | Tags to take off the contact. |
| replace_tags | object or object[] | { "prefix": "plan:", "with": ["plan:paid"] } replaces every tag that starts with the prefix. Tags outside the group are kept. An empty "with" clears the group. Send an array of these to replace several groups in one call, for example plan:, status: and event:. |
| subscribed | boolean | false unsubscribes the contact. true is accepted and ignored: someone who unsubscribed, bounced or complained stays that way. |
| consent | string | How the person agreed to marketing email, for example signup_checkbox. Shown on the contact. |
| lists | string[] | List names to add the contact to. |
curl -X POST https://sendapt.com/api/v1/contacts \
-H "Authorization: Bearer $SENDAPT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"email": "jane@example.com",
"first_name": "Jane",
"replace_tags": { "prefix": "plan:", "with": ["plan:free"] },
"tags": ["customer"],
"subscribed": true,
"consent": "signup_checkbox",
"lists": ["Newsletter"]
}'/api/v1/contacts/batch
contacts:writeMany contacts in one call, for a first import of your existing users: { "contacts": [ … ] }, each item with the same fields as above, up to 200 per call. Each item is checked on its own: a bad one is reported in results and the rest still go in. New contacts are checked against your plan for the whole batch first, so a batch never stops half way.
curl -X POST https://sendapt.com/api/v1/contacts/batch \
-H "Authorization: Bearer $SENDAPT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contacts": [
{ "email": "jane@example.com", "replace_tags": { "prefix": "plan:", "with": ["plan:free"] } },
{ "email": "sam@example.com", "replace_tags": { "prefix": "plan:", "with": ["plan:paid"] } }
]
}'{
"success": true,
"message": "Batch done: 2 created, 0 updated, 0 with errors.",
"data": {
"created": 2, "updated": 0, "errors": 0,
"results": [
{ "index": 0, "email": "jane@example.com", "status": "created" },
{ "index": 1, "email": "sam@example.com", "status": "created" }
]
}
}/api/v1/events
events:writeTell Sendapt that a user did something, such as connecting an account or publishing their first post. Every switched-on Autopilot series that starts with Your app sends an event and that event name starts for them (once, unless the series allows people back in). Someone who unsubscribed is never enrolled. An email Sendapt does not know yet becomes a new contact. Events start series and nothing else: they are not stored. What a user is (plan, status) belongs in tags sent with /api/v1/contacts, and a series' stop rules work on those tags.
| Field | Type | Description |
|---|---|---|
| emailrequired | string | The user the event is about. Created as a contact if Sendapt does not know them yet. |
| eventrequired | string | What happened, for example account_connected. Lower case letters, numbers, _ . and -, up to 60 characters. Must match the series trigger exactly. |
| first_name | string | Only used when the contact is new. |
| last_name | string | Only used when the contact is new. |
curl -X POST https://sendapt.com/api/v1/events \
-H "Authorization: Bearer $SENDAPT_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "email": "jane@example.com", "event": "account_connected" }'{
"statusCode": 202,
"success": true,
"message": "Event received. 1 series started.",
"data": {
"event": "account_connected",
"contact_id": "4c1e…",
"contact_created": false,
"series_watching": 1,
"series_started": 1
}
}/api/v1/campaigns
campaigns:readThe workspace's campaigns, newest first, with their send, open, click, bounce, complaint and unsubscribe counts: 50 a page by default (?page, ?limit up to 100, ?status=SENT). One campaign's full report, the same numbers as its report screen: GET /api/v1/campaigns/:id.
curl https://sendapt.com/api/v1/campaigns \
-H "Authorization: Bearer $SENDAPT_API_KEY"Errors and limits
Errors use standard HTTP status codes and a JSON body with a readable message.
| Status | Meaning |
|---|---|
| 400 | A field is missing or invalid. The body lists the fields. |
| 401 | The API key is missing, wrong, expired or revoked. |
| 402 | The workspace's plan does not include the API, or a plan limit was reached. |
| 403 | The key is not allowed to make this call (its type has no such scope). The body names the scope it needs. |
| 404 | No such tag, list, contact or campaign in this workspace. The body names what was looked for. |
| 409 | A list with that name exists already (the body has its id), or the workspace has no sending provider connected yet. |
| 422 | The recipient is suppressed after a bounce or a spam complaint. |
| 429 | Rate limit reached, or too many calls with a wrong key from one address. Wait and retry. |
| 502 | The sending provider refused the message. The body says why. |
Rate limits per workspace: 600 emails a minute, 600 writes and deletes a minute (contacts, tags, lists), 20 batches a minute, 600 events a minute and 300 reads a minute. Your sending provider applies its own send rate on top. The API is included in paid plans.