Base path: https://api.scrubimail.com/scrubimail/api/v1/send/. Authenticate with X-API-Key. Set up a domain first: Sending setup.
Ids are UUIDs. List endpoints (domains, templates, campaigns, suppressions, history) return {count, next, previous, results}, 20 items per page; pass page and page_size (maximum 100).
1 sending credit = 1 email. Sending credits are separate from validation credits.
Messages are accepted with 202 and delivered asynchronously. The message status updates to delivered or bounced.
Send
Send one email
POST/send/
Scope: send1 sending credit
Sends a single email from a verified domain. The call returns 202 once the message is handed to the sending service; delivery happens asynchronously, so track it with the status endpoint.
from_email must be on the domain you reference in sending_domain_id. A From address on a different domain is rejected with 400. The message is DKIM-signed with that domain, so a From address elsewhere could not align under DMARC anyway.
If you leave out text_content, a plain-text part is generated from the HTML, because mailbox providers score HTML-only mail lower. The credit is taken when the call is accepted and given back if the message is refused or cannot be handed off.
Marketing mail needs one-click unsubscribe. Set list_unsubscribe to true, or put {{unsubscribe_url}} in the content, and the message gets the List-Unsubscribe headers and a visible link. Leave it off for transactional mail such as receipts and password resets.
Body
Send one email: Body
Name
Type
Required
Description
sending_domain_id
UUID
Yes
Id of one of your sending domains. The domain must be verified.
from_email
string
Yes
Sender address. Its domain must match the sending domain, or the request is rejected with 400.
from_name
string
Yes
Sender display name, up to 255 characters.
to_email
string
Yes
Recipient address. One recipient per call; use bulk for many.
subject
string
Yes
Up to 998 characters. May contain {{tags}}.
html_content
string
Yes
HTML body. May contain {{tags}}; values are HTML-escaped here.
text_content
string
No
Plain-text body. Generated from the HTML when omitted.
to_name
string
No
Recipient display name. Feeds {{name}}, {{first_name}} and {{last_name}}.
reply_to
string
No
Reply-To address.
tags
string[]
No
Free-form labels stored in metadata.tags.
variables
object
No
Values for custom {{tags}}. At most 50 keys, 1,000 characters per value; keys are letters, digits and underscores.
A field is missing or invalid. error.details lists each one.
400
-
Hand-built messages, body {"error": "..."}: Sending domain is not verified., Recipient is on the suppression list., or the domain of from_email does not match the sending domain.
402
-
No sending credits left. Body is {"error": "Insufficient credits. Please purchase more credits."}, not the standard envelope.
404
-
{"error": "Sending domain not found"}: the id is not one of your domains.
502
-
{"error": "Sending service unavailable"}: the sending service could not be reached. The credit is returned; retry with backoff.
401
authentication_required
No API key was sent. The response carries a WWW-Authenticate header.
401
invalid_credentials
The key is unknown, inactive, expired, or the request IP is not on the key's allow-list. The response carries a WWW-Authenticate header.
403
permission_denied
The key has scopes set and send is not one of them.
Send to many recipients
POST/send/bulk/
Scope: send:bulk1 sending credit per recipient
Creates a campaign from one message and a list of recipients and sends it in the background. Every recipient gets their own personalised copy with one-click unsubscribe added.
Bulk sends need a verified domain and a DMARC record on it (Gmail and Yahoo require one from bulk senders). Without DMARC the call fails with a 400 that tells you the record to publish. Single sends do not require DMARC.
Duplicate addresses and suppressed addresses are skipped. The whole list is charged up front, 1 credit per sendable recipient, and credits for recipients that could not be handed off are returned when the run finishes. If every recipient is suppressed the call fails with No sendable recipients after suppression filtering.
Body
Send to many recipients: Body
Name
Type
Required
Description
campaign_name
string
Yes
Label for the campaign, up to 255 characters.
sending_domain_id
UUID
Yes
A verified domain with a DMARC record.
from_email
string
Yes
Sender address on that domain. A From address on any other domain is rejected with 400.
from_name
string
Yes
Sender display name.
subject
string
Yes
Up to 998 characters. May contain {{tags}}.
html_content
string
Yes
HTML body.
recipients
object[]
Yes
At least one {email, name?, variables?}. variables holds that recipient's custom tag values.
text_content
string
No
Plain-text body. Generated when omitted.
reply_to
string
No
Reply-To address.
attachments
object[]
No
Sent with every message. Same limits as a single send.
A field is missing or invalid. error.details lists each one.
400
-
{"error": "..."}: domain not verified, no DMARC record, no sendable recipients, or the domain of from_email does not match the sending domain.
402
-
No sending credits left. Body is {"error": "Insufficient credits. Please purchase more credits."}, not the standard envelope.
404
-
{"error": "Sending domain not found"}.
401
authentication_required
No API key was sent. The response carries a WWW-Authenticate header.
401
invalid_credentials
The key is unknown, inactive, expired, or the request IP is not on the key's allow-list. The response carries a WWW-Authenticate header.
403
permission_denied
The key has scopes set and send:bulk is not one of them.
Personalisation tags
Subjects, HTML bodies and text bodies of every send, bulk send, campaign and template are rendered per recipient. Write {{name}} where a value should go, and {{name|fallback}} to use a default when the value is missing or empty.
Personalisation syntax
You write
Result
{{first_name}}
The value, or nothing when there is none.
{{first_name|there}}
The value, or there when there is none.
{{ company }}
Spaces inside the braces are ignored.
{{unsubscribe_url}}
The recipient's one-click unsubscribe link. Using it turns on unsubscribe for a single send.
Built-in tags need no setup: email, name, first_name (the first word of name) and last_name (the rest).
Custom tags such as {{company}} or {{order_id}} take their values from variables: on a single send, or per recipient in a bulk send or campaign. Names are letters, digits and underscores and start with a letter or underscore; at most 50 variables per recipient and 1,000 characters per value. variables overrides a built-in of the same name.
Escaping. Values inserted into html_content are HTML-escaped, so recipient data can never inject markup. Subjects and text bodies get the raw value.
Anything that is not a valid tag, for example {{ 1st }}, is left exactly as written.
SMTP is different. Messages sent over the SMTP relay are sent as written. Fill in values in your own code first.
Attachments
attachments is accepted on POST /send/, POST /send/bulk/ and on templates (a campaign sends the template's files with every message). Each item is {filename, content, content_type, content_id?} where content is the file base64-encoded.
Attachment limits
Limit
Value
Files per email
10
Total size per email
10 MB of file data before base64 (a base64 body is about a third larger)
Blocked file types
Executables and scripts: exe, js, bat, cmd, com, msi, scr, vbs, ps1, jar, apk, dll, iso and similar. Zip the file or share a link instead.
Empty files
Rejected.
Oversized request
413 with error.codepayload_too_large when the whole request body is too large.
Give a file a content_id to make it an inline image, referenced from the HTML as <img src="cid:YOUR_ID">. Each inline image needs a different content_id (letters, digits and . _ @ -). Over SMTP, attach files with your mail library as usual; the message limit there is 20 MB.
Track messages
Get a message
GET/send/status/{message_id}/
Scope: history
Delivery state of one message. The status moves queued, sending, then delivered, bounced or failed.
Path
Get a message: Path
Name
Type
Required
Description
message_id
string
Yes
The message_id returned when the message was accepted.
Request
GET /send/status/d4e5f6a7-2b3c-4d5e-9f01-a2b3c4d5e6f7/
curl -X GET "https://api.scrubimail.com/scrubimail/api/v1/send/status/d4e5f6a7-2b3c-4d5e-9f01-a2b3c4d5e6f7/" \
-H "X-API-Key: $SCRUBIMAIL_API_KEY"
const res = await fetch("https://api.scrubimail.com/scrubimail/api/v1/send/status/d4e5f6a7-2b3c-4d5e-9f01-a2b3c4d5e6f7/", {
method: "GET",
headers: {
"X-API-Key": process.env.SCRUBIMAIL_API_KEY,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);
import os
import requests
res = requests.get(
"https://api.scrubimail.com/scrubimail/api/v1/send/status/d4e5f6a7-2b3c-4d5e-9f01-a2b3c4d5e6f7/",
headers={"X-API-Key": os.environ["SCRUBIMAIL_API_KEY"]},
timeout=30,
)
data = res.json()
res.raise_for_status()
No API key was sent. The response carries a WWW-Authenticate header.
401
invalid_credentials
The key is unknown, inactive, expired, or the request IP is not on the key's allow-list. The response carries a WWW-Authenticate header.
403
permission_denied
The key has scopes set and history is not one of them.
Sending domains
Adding and verifying domains is covered step by step in Sending setup. The remaining operations, all with scope domains:
Domain endpoints
Request
What it does
POST /send/domains/
Add a domain. Returns 201.
GET /send/domains/
List your domains with their verification state.
GET /send/domains/{id}/
One domain, including dkim_public_key and verification_details.
POST /send/domains/{id}/verify/
Run the DNS checks.
DELETE /send/domains/{id}/
Remove a domain. Returns 204.
Templates
A template stores a subject and body with {{tags}}. Use it in a campaign or fetch it to reuse the content in your own sends. Scope templates.
Create a template
POST/send/templates/
Scope: templates
Saves a reusable subject and body. variables in the response is read-only: it lists the custom {{tags}} the template uses (the built-ins are not listed), so you know what to supply at send time.
Body
Create a template: Body
Name
Type
Required
Description
name
string
Yes
Template name, up to 255 characters.
subject
string
Yes
Up to 998 characters.
html_content
string
Yes
HTML body.
text_content
string
No
Plain-text body.
attachments
object[]
No
Sent with every campaign message that uses the template.
Request
POST /send/templates/
curl -X POST "https://api.scrubimail.com/scrubimail/api/v1/send/templates/" \
-H "X-API-Key: $SCRUBIMAIL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Welcome email",
"subject": "Welcome to {{company|our platform}}, {{first_name|there}}!",
"html_content": "<h1>Welcome, {{first_name|there}}!</h1><p>Your account at {{company}} is ready.</p>"
}'
const res = await fetch("https://api.scrubimail.com/scrubimail/api/v1/send/templates/", {
method: "POST",
headers: {
"X-API-Key": process.env.SCRUBIMAIL_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
"name": "Welcome email",
"subject": "Welcome to {{company|our platform}}, {{first_name|there}}!",
"html_content": "<h1>Welcome, {{first_name|there}}!</h1><p>Your account at {{company}} is ready.</p>"
}),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);
import os
import requests
payload = {
"name": "Welcome email",
"subject": "Welcome to {{company|our platform}}, {{first_name|there}}!",
"html_content": "<h1>Welcome, {{first_name|there}}!</h1><p>Your account at {{company}} is ready.</p>",
}
res = requests.post(
"https://api.scrubimail.com/scrubimail/api/v1/send/templates/",
headers={"X-API-Key": os.environ["SCRUBIMAIL_API_KEY"]},
json=payload,
timeout=30,
)
data = res.json()
res.raise_for_status()
[
{
"key": "welcome",
"category": "Onboarding",
"name": "Welcome email",
"description": "Greets a new user and points them to their first step.",
"subject": "Welcome to {{company|our platform}}, {{first_name|there}}!",
"html_content": "<!doctype html>...",
"text_content": "Welcome aboard, {{first_name|there}}!...",
"variables": [
"company",
"action_url"
]
}
]
Errors
List starter templates: errors
Status
Code
When
401
authentication_required
No API key was sent. The response carries a WWW-Authenticate header.
401
invalid_credentials
The key is unknown, inactive, expired, or the request IP is not on the key's allow-list. The response carries a WWW-Authenticate header.
403
permission_denied
The key has scopes set and templates is not one of them.
Copy a starter template
POST/send/templates/from-starter/
Scope: templates
Copies a starter into your account as a normal template you can edit.
Body
Copy a starter template: Body
Name
Type
Required
Description
key
string
Yes
One of welcome, verify_email, password_reset, security_alert, order_confirmation, shipping_update, invoice_reminder, newsletter, event_invitation, feedback_request, win_back.
name
string
No
Name for your copy. Defaults to the starter's name.
No API key was sent. The response carries a WWW-Authenticate header.
401
invalid_credentials
The key is unknown, inactive, expired, or the request IP is not on the key's allow-list. The response carries a WWW-Authenticate header.
403
permission_denied
The key has scopes set and templates is not one of them.
Campaigns
A campaign is a template, a recipient list and a verified domain with DMARC. POST /send/bulk/ creates and starts one in a single call. Use these endpoints when you want to stage it, edit it, pause it or resume it. Scope send:bulk. The opened_count and clicked_count fields exist but stay at 0: ScrubiMail does not track opens or clicks.
Create a campaign
POST/send/campaigns/
Scope: send:bulk
Builds a campaign from a saved template and a recipient list without sending it. Start it when you are ready. POST /send/bulk/ does both in one call.
Body
Create a campaign: Body
Name
Type
Required
Description
name
string
Yes
Campaign name.
sending_domain_id
UUID
Yes
One of your domains.
from_name
string
Yes
Sender display name.
from_email
string
Yes
Sender address. Its domain must match the sending domain, or the request is rejected with 400.
template_id
UUID
No
Your template. Required before the campaign can start.
recipient_list
object[]
No
{email, name?, variables?} entries. Required before the campaign can start.
A field is missing or invalid. error.details lists each one.
400
-
The domain of from_email does not match the sending domain.
401
authentication_required
No API key was sent. The response carries a WWW-Authenticate header.
401
invalid_credentials
The key is unknown, inactive, expired, or the request IP is not on the key's allow-list. The response carries a WWW-Authenticate header.
403
permission_denied
The key has scopes set and send:bulk is not one of them.
Start or resume a campaign
POST/send/campaigns/{id}/start/
Scope: send:bulk1 sending credit per recipient
Starts a draft, scheduled or paused campaign. The first start charges 1 credit per recipient up front; resuming a paused campaign does not charge again. Credits for recipients that end up unsent are returned when the run finishes. The domain must be verified and have DMARC.
Path
Start or resume a campaign: Path
Name
Type
Required
Description
id
UUID
Yes
The campaign's id.
Request
POST /send/campaigns/c3d4e5f6-0a1b-4c2d-8e3f-4a5b6c7d8e9f/start/
curl -X POST "https://api.scrubimail.com/scrubimail/api/v1/send/campaigns/c3d4e5f6-0a1b-4c2d-8e3f-4a5b6c7d8e9f/start/" \
-H "X-API-Key: $SCRUBIMAIL_API_KEY"
const res = await fetch("https://api.scrubimail.com/scrubimail/api/v1/send/campaigns/c3d4e5f6-0a1b-4c2d-8e3f-4a5b6c7d8e9f/start/", {
method: "POST",
headers: {
"X-API-Key": process.env.SCRUBIMAIL_API_KEY,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);
import os
import requests
res = requests.post(
"https://api.scrubimail.com/scrubimail/api/v1/send/campaigns/c3d4e5f6-0a1b-4c2d-8e3f-4a5b6c7d8e9f/start/",
headers={"X-API-Key": os.environ["SCRUBIMAIL_API_KEY"]},
timeout=30,
)
data = res.json()
res.raise_for_status()
No API key was sent. The response carries a WWW-Authenticate header.
401
invalid_credentials
The key is unknown, inactive, expired, or the request IP is not on the key's allow-list. The response carries a WWW-Authenticate header.
403
permission_denied
The key has scopes set and send:bulk is not one of them.
Campaign endpoints
Request
What it does
GET /send/campaigns/
List your campaigns with their counters.
GET /send/campaigns/{id}/
One campaign.
PUT or PATCH /send/campaigns/{id}/
Edit a campaign. Only draft and paused campaigns can be edited.
DELETE /send/campaigns/{id}/
Delete a campaign.
Campaign status moves through draft, scheduled, sending, paused, completed and failed. Every campaign message includes one-click unsubscribe.
Suppressions
Your suppression list is a set of addresses ScrubiMail will not send to for you. Single sends to a suppressed address are refused, bulk sends and campaigns skip it, and none of that costs a credit. The list is yours alone: an address suppressed for another customer is not suppressed for you.
What adds an address to your suppression list
Event
Added?
Reason
Hard bounce: the recipient's server permanently rejects the mailbox (for example 5.1.1 user unknown)
Yes, automatically
bounce
The recipient clicks unsubscribe, or their mail app's one-click unsubscribe
Yes, automatically
unsubscribe
The recipient reports spam at a provider that sends feedback-loop reports (Outlook, Hotmail, Yahoo, AOL)
Yes, automatically
complaint
You add the address yourself
Yes
manual, or the reason you pass
Soft bounce, full mailbox, spam or policy block, or delivery abandoned after retries
No
-
Spam report in Gmail
No: Gmail does not report individual complaints. Add the address yourself.
-
Add a suppression
POST/send/suppressions/
Scope: suppressions
Blocks an address on your account. Sends to it are refused and bulk sends skip it, with no charge. Hard bounces, unsubscribes and spam complaints are added automatically.
{
"host": "smtp.scrubimail.com",
"port": 587,
"username": "[email protected]",
"password": "Use your ScrubiMail API key as the password",
"tls": true,
"encryption": "STARTTLS",
"instructions": "Configure your email client or application with these SMTP settings. Authenticate with your account email as the username and an API key as the password."
}
Errors
Get SMTP settings: errors
Status
Code
When
401
authentication_required
No API key was sent. The response carries a WWW-Authenticate header.
401
invalid_credentials
The key is unknown, inactive, expired, or the request IP is not on the key's allow-list. The response carries a WWW-Authenticate header.
403
permission_denied
The key has scopes set and send is not one of them.
Reputation summary
GET/send/reputation/summary/
Scope: history
Delivery, bounce and complaint figures for the last 30 days and a reputation score. The score runs from 0 to 100 and is driven mainly by bounce and complaint rates; current_score is the latest day and average_score the mean. Higher is better. Snapshots are computed daily for the previous day, so today's mail is not included yet.
Request
GET /send/reputation/summary/
curl -X GET "https://api.scrubimail.com/scrubimail/api/v1/send/reputation/summary/" \
-H "X-API-Key: $SCRUBIMAIL_API_KEY"
const res = await fetch("https://api.scrubimail.com/scrubimail/api/v1/send/reputation/summary/", {
method: "GET",
headers: {
"X-API-Key": process.env.SCRUBIMAIL_API_KEY,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);
import os
import requests
res = requests.get(
"https://api.scrubimail.com/scrubimail/api/v1/send/reputation/summary/",
headers={"X-API-Key": os.environ["SCRUBIMAIL_API_KEY"]},
timeout=30,
)
data = res.json()
res.raise_for_status()