Developers
Sendswift API reference
The Sendswift API lets your own systems send email to a list, follow a send as it goes out, and manage contacts, suppressions, lists, segments and templates. Authenticate with an API key in the X-Api-Key header. The full machine readable specification is an OpenAPI 3.1 document.
Getting started
- Sign in to Sendswift as an account owner and open Settings, API keys.
- Create a key with only the scopes your integration needs. Copy it straight away: it is shown once and never again.
- Send it in the
X-Api-Keyheader on every request tohttps://app.sendswift.com.au/v1.
curl https://app.sendswift.com.au/v1/me \
-H "X-Api-Key: mk_live_yourbusiness_..."Requests and responses are JSON, except file uploads (multipart form data, in a field named file) and CSV downloads. Times are ISO 8601. Most field names are camelCase. The exceptions are GET /me, POST /quick-send/test and POST /campaigns/{id}/test, which use snake_case (such as tenant_id and sent_to), and GET /settings/usage, whose fields are capitalised (such as MonthlySends).
Most list endpoints take page (from 1) and pageSize (up to 200) and return { items, total, page, pageSize }. GET /users and GET /templates/{id}/versions return a plain array and ignore page and pageSize.
Keys can be given an expiry when they are created, and can be revoked at any time from the same screen. A revoked key stops working on the next request.
Scopes
Each key carries the scopes chosen when it was created. Calling an endpoint without its scope returns 403 with insufficient_scope. Every endpoint below lists the scope it needs.
| Choice in Settings | Scopes granted | What it allows |
|---|---|---|
| Read | contacts:read, lists:read, templates:read, campaigns:read, reports:read, users:read | View campaigns, contacts, lists, segments, templates, reports, plan usage, and the team member list with names, emails and roles |
| Send | campaigns:send | Quick sends, test sends, creating, editing, deleting and sending full campaigns (to a saved list or segment with Read too), and pausing, resuming or cancelling campaigns |
| Manage audiences | contacts:write, lists:write | Import, edit and delete contacts, suppress and unsuppress addresses, and create, edit and delete lists, list members and segments |
| Manage templates | templates:write | Create, edit and delete templates |
| Admin | Every scope above, plus users:write | Everything a key can do. Inviting or changing users, keys, billing and sending settings still need a signed in owner |
Inviting or changing users, creating or revoking keys, billing and sending domain settings are never available to a key, whatever its scopes. They need an owner signed in to Sendswift.
IP allow list
Each key can be limited to a list of IP addresses and CIDR ranges, for example 203.0.113.10 or 203.0.113.0/24, up to 50 entries. Set it when you create the key, or change it later with Edit in Settings, API keys. An empty list means the key works from any address.
A request from an address that is not on the list is refused with 401, exactly like an invalid key, so a leaked key cannot be used from anywhere else. If a key suddenly returns 401, check the address your server sends from.
Errors
Errors are JSON with an error message and, on most errors, a stable code:
{ "error": "This API key does not have the campaigns:send scope.", "code": "insufficient_scope" }| Status and code | Meaning |
|---|---|
| 400 bad_request, bad_id | The body is not valid JSON, has a field the endpoint does not take, or an id is not a UUID. |
| 401 | No key, or the key is unknown, revoked, expired, or used from an address outside its IP allow list, or the account is suspended or being closed. |
| 403 insufficient_scope | The key is valid but does not have the scope this endpoint needs. |
| 404 not_found | No such resource in your account, or no such endpoint. |
| 409 conflict | The resource is in a state that does not allow this, for example resuming a campaign that is not paused. |
| 422 validation_failed | A value is not acceptable. The error message says which, in words you can show a person. |
| 422 plan_required, sending_domain_required, sending_identity_unverified, sending_paused | A send was refused because the account cannot send yet: no paid plan, no sending domain set up, the sending domain is not verified yet, or sending is paused on the account. GET /sending/readiness gives the same answer without trying a send. |
| 429 rate_limited | The key made more requests this minute than the plan allows. Wait the number of seconds in the Retry-After header, then try again. |
| 429 quota_exceeded, test_send_limit | A plan limit was reached, such as monthly sends or contacts (quota_exceeded), or the daily test send limit (test_send_limit). |
Rate limits
Each key can make as many requests a minute as your plan allows. A key can use its whole minute in a burst, then the allowance refills steadily. A request over the limit is refused with 429, rate_limited and a Retry-After header giving the number of seconds to wait. People using Sendswift in the browser do not count towards a key's limit.
Plan limits are separate from the rate limit. A send that would go over your monthly sends, or an import that would go over your contact limit, is refused with 429 and quota_exceeded, and waiting a few seconds will not help.
Example: send to a list
Quick send takes a CSV of recipients and sends one personalised email to each, with an unsubscribe link. It needs a key with the Send scope.
1. Upload the recipients
The CSV needs an email column, and may have first and last name columns. Unsubscribed, bounced and invalid addresses are removed and counted.
curl https://app.sendswift.com.au/v1/quick-send/recipients/upload \
-H "X-Api-Key: $SENDSWIFT_KEY" \
-F [email protected]
{ "uploadId": "8f0c...", "count": 412, "skippedInvalid": 3, "skippedSuppressed": 7, ... }2. Send
Merge fields such as {{first_name}} are filled per recipient. Attachments are optional: stage each one with POST /quick-send/attachments and pass the ids.
curl https://app.sendswift.com.au/v1/quick-send \
-H "X-Api-Key: $SENDSWIFT_KEY" \
-H "Content-Type: application/json" \
-d '{"uploadId":"8f0c...","subject":"Your order is ready","bodyHtml":"<p>Hi {{first_name}},</p><p>...</p>"}'
{ "campaignId": "c41e..." }3. Follow it
curl https://app.sendswift.com.au/v1/campaigns/c41e.../progress -H "X-Api-Key: $SENDSWIFT_KEY"A send is refused with 422 when the account cannot send yet, for example before a plan is chosen or while the sending domain is unverified. GET /sending/readiness says why.
Endpoints
Every path is relative to https://app.sendswift.com.au/v1. Request and response fields for each one are in the OpenAPI document, which you can load into any OpenAPI viewer or client generator.
Account
GET/me
any key
Check a key
Returns who the request is authenticated as. Handy for checking that a key works.
GET/settings/workspace
users:read
Get workspace settings
The account name and who receives post send reports.
GET/users
users:read
List users
The people on the account. Inviting and changing users needs a signed in owner and is not available to keys.
Campaigns
GET/campaigns
campaigns:read
List campaigns
Newest first.
POST/campaigns
campaigns:send
Create a draft campaign
A full campaign: a saved list or segment as the audience, and either your own HTML or a saved template version. Nothing is sent until you call send. An audience needs lists:read as well, and a template version templates:read.
GET/campaigns/{id}
campaigns:read
Get a campaign
PATCH/campaigns/{id}
campaigns:send
Edit a draft campaign
Drafts only. A full replace of the editable fields. An audience needs lists:read as well, and a template version templates:read.
DELETE/campaigns/{id}
campaigns:send
Delete a draft campaign
Drafts only.
GET/campaigns/audience-preview
campaigns:read + lists:read
Size a list or segment
How many people a campaign to this list or segment would reach, and how many of them are suppressed.
GET/campaigns/{id}/progress
campaigns:read
Get send progress
Live counts, cheap enough to poll every few seconds while a campaign is sending.
GET/campaigns/{id}/recipients
campaigns:read
List recipients
GET/campaigns/{id}/report.csv
campaigns:read
Download the report
One row per recipient: email,name,status,sent_at,error. In flight recipients read as pending.
POST/campaigns/{id}/pause
campaigns:send
Pause a campaign
Stops a queued or sending campaign from being picked up. Recipients already sent stay sent.
POST/campaigns/{id}/resume
campaigns:send
Resume a campaign
Resumes a paused campaign. Refused with 422 when the account cannot send right now (see GET /sending/readiness).
POST/campaigns/{id}/cancel
campaigns:send
Cancel a campaign
Stops a campaign for good. Recipients not yet reached are never sent to.
POST/campaigns/{id}/test
campaigns:send
Send a test of a draft
Sends the draft to up to 5 addresses, with merge fields filled from sample values. Test sends are limited per account per day.
POST/campaigns/{id}/send
campaigns:send
Send a draft campaign
Queues the draft to its list or segment. Suppressed addresses are skipped. Refused with 422 when the account cannot send yet (no plan, no verified sending domain, sending paused) or nobody in the audience can be emailed (code: no_recipients), and with 429 (code: quota_exceeded) when the send would go over a plan limit.
Quick send
POST/preview
campaigns:read
Preview an email
Renders the subject and HTML one recipient would get, with merge fields filled from the values you pass. Nothing is sent or stored.
POST/quick-send
campaigns:send
Send to everyone
Final step. Creates a campaign for the uploaded recipients and queues it. Every recipient gets their own email with an unsubscribe link. Poll GET /campaigns/{id}/progress to follow it.
POST/quick-send/attachments
campaigns:send
Stage an attachment
Optional step 2. Upload one file per call. The size limit is your plan's attachment limit (25 MB when the plan has none).
POST/quick-send/editor-images
campaigns:send
Upload an inline image
Stores an image and returns a public URL to use in bodyHtml. Images up to 6 MB.
POST/quick-send/test
campaigns:send
Send a test
Sends the draft to at most 5 addresses. Suppressed addresses are refused. Unless your account is invoiced by Sendswift, test addresses must belong to users of your account, and an account can send 20 tests a day.
POST/quick-send/recipients/upload
campaigns:send
Upload recipients
Step 1. Upload a CSV with an email column and optional first and last name columns. Invalid and suppressed addresses are removed. Nothing is sent and no contacts are created yet.
DELETE/quick-send/attachments/{id}
campaigns:send
Remove a staged attachment
Audiences
GET/contacts
contacts:read
List contacts
GET/contacts/export.csv
contacts:read
Export contacts as CSV
Every contact matching the filters, one row each, with a column per custom field. Values that a spreadsheet would run as a formula are prefixed with an apostrophe.
GET/contacts/{id}
contacts:read
Get a contact
With custom fields, list memberships, suppression and recent sends.
PATCH/contacts/{id}
contacts:write
Edit a contact
DELETE/contacts/{id}
contacts:write
Delete a contact
Removes the contact and its list memberships. An address that had unsubscribed, bounced or complained stays suppressed.
POST/contacts/{id}/unsubscribe
contacts:write
Unsubscribe a contact
Records an unsubscribe on the person's behalf. It cannot be lifted.
GET/suppressions
contacts:read
List suppressed addresses
POST/suppressions
contacts:write
Suppress an address
A suppressed address is never sent to again, by any campaign or test.
POST/suppressions/bulk
contacts:write
Suppress many addresses
Up to 50,000 addresses at once, for example when moving from another platform.
DELETE/suppressions/{id}
contacts:write
Remove a suppression
Only an address suppressed by hand (reason manual) can be removed. Unsubscribes, bounces and complaints answer 409.
GET/lists
lists:read
List lists
Saved lists only. Segments have their own endpoints.
POST/lists
lists:write
Create a list
GET/lists/{id}
lists:read
Get a list
PATCH/lists/{id}
lists:write
Rename a list
DELETE/lists/{id}
lists:write
Delete a list
The contacts stay in your audience. Refused with 409 while a draft or running campaign uses the list.
GET/lists/{id}/members
lists:read + contacts:read
List a list's members
POST/lists/{id}/members
lists:write
Add contacts to a list
DELETE/lists/{id}/members
lists:write
Remove contacts from a list
They stay in your audience.
DELETE/lists/{id}/members/{contactId}
lists:write
Remove one contact from a list
They stay in your audience.
GET/segments
lists:read
List segments
POST/segments
lists:write
Create a segment
POST/segments/preview
lists:write
Count a segment
Counts the contacts the conditions match without saving anything.
GET/segments/{id}
lists:read
Get a segment
PATCH/segments/{id}
lists:write
Update a segment
Replaces the conditions when groups is sent; leave groups out to only rename it. An empty groups list, or a group with no conditions, is refused rather than saved as every contact.
DELETE/segments/{id}
lists:write
Delete a segment
The contacts are not affected.
Imports
GET/imports
contacts:read
List imports
POST/imports/upload
contacts:write
Upload a CSV to import
Step 1 of 3. Stages the file (up to 20 MB) and returns its headers and a few sample rows. Nothing is imported yet.
GET/imports/{id}
contacts:read
Get an import
GET/imports/{id}/errors.csv
contacts:read
Download import errors
POST/imports/{id}/mapping
contacts:write
Map and validate columns
Step 2 of 3. Says which column holds the email address and names, and checks every row.
POST/imports/{id}/commit
contacts:write
Run the import
Step 3 of 3. Adds or updates the contacts, optionally adding them all to an existing or new list. Refused with 422 when it would take the account over its plan's contact limit.
Required scope: contacts:write, plus lists:write when listId or newListName is sent.
Templates
GET/templates
templates:read
List templates
POST/templates
templates:write
Create a template
GET/templates/merge-fields
templates:read
List merge fields
The placeholders you can use in a subject or body, with sample values.
POST/templates/editor-images
templates:write
Upload an inline image
Same as the Quick send image upload: returns a public URL for use in template HTML. Images up to 6 MB.
GET/templates/{id}
templates:read
Get a template
The body is on the version: see GET /templates/{id}/versions/{version}.
PATCH/templates/{id}
templates:write
Save a new version
Every save creates a new version; earlier versions are kept.
DELETE/templates/{id}
templates:write
Archive a template
Refused with 409 while a draft campaign uses it.
GET/templates/editor-images/{id}
templates:read
Download an uploaded image
GET/templates/{id}/versions
templates:read
List versions
GET/templates/{id}/versions/{version}
templates:read
Get one version
Reports
GET/dashboard/summary
reports:read
Account summary
Sends this month against quota, contact count, and daily sends for the last 30 days.
GET/sending/readiness
reports:read
Can this account send?
Whether a send would be accepted right now, and if not, why (sending paused, plan, sending domain).
GET/settings/usage
reports:read
Plan usage
How much of the plan's monthly sends, hourly sends and contacts the account has used. A limit of 0 means no limit.
GET/billing
reports:read
Plan and billing summary
The account's plan, billing status, sends this month against the allowance, and the plans on offer. Changing the plan needs a signed in owner and is not available to keys.
Bring your list home.
Sign up free, set everything up, pay when you're ready to send. Cancel anytime. Or let us move you across for free.