ScrubiMail API documentation
One REST API for two jobs: check whether an email address is real before you send, and send email from your own domain over HTTP or SMTP. Both use the same account and the same API key.
Related:Email validationEmail sendingSMTP relay
Checked against the API source on
Email validation checks syntax, DNS, the mailbox itself and risk signals such as disposable and role addresses, and returns a verdict with a 0 to 100 score. Email sending delivers transactional and campaign mail from a domain you have verified, with DKIM signing, suppression lists and one-click unsubscribe. The SMTP relay lets any application that speaks SMTP use the same sending pipeline.
Base URL
https://api.scrubimail.com/scrubimail/api/v1- Requests and responses are JSON. Send
Content-Type: application/jsonon requests with a body. - Paths end with a slash, for example
/validate/. The server does not redirect a path without the slash, it answers 404. - Authenticate every request with the
X-API-Keyheader. See Authentication. - Errors use one JSON shape with a stable
error.code. See Errors and rate limits.
Quickstart
Three steps from nothing to a validated address and a sent email. The examples read the key from the SCRUBIMAIL_API_KEY environment variable, which keeps it out of your source code.
Create an API key
Sign in and open API keys in the app. Create a key, give it a name, and copy it into your secrets manager straight away: the full key is shown only once and cannot be viewed again. Leave the scopes empty for full access while you try things out, then narrow them later. New accounts include free validation credits; check pricing for the current allowance.
Shell export SCRUBIMAIL_API_KEY="paste-your-key-here"Validate an address
Call
POST /validate/with an address. The default is a deep check that includes a live mailbox check, so allow a few seconds. Add?mode=fastfor a quick syntax and DNS check.curl -X POST "https://api.scrubimail.com/scrubimail/api/v1/validate/" \ -H "X-API-Key: $SCRUBIMAIL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "email": "[email protected]" }'const res = await fetch("https://api.scrubimail.com/scrubimail/api/v1/validate/", { method: "POST", headers: { "X-API-Key": process.env.SCRUBIMAIL_API_KEY, "Content-Type": "application/json", }, body: JSON.stringify({ "email": "[email protected]" }), }); const data = await res.json(); if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);import os import requests payload = { "email": "[email protected]", } res = requests.post( "https://api.scrubimail.com/scrubimail/api/v1/validate/", headers={"X-API-Key": os.environ["SCRUBIMAIL_API_KEY"]}, json=payload, timeout=30, ) data = res.json() res.raise_for_status()<?php $payload = <<<'JSON' { "email": "[email protected]" } JSON; $ch = curl_init('https://api.scrubimail.com/scrubimail/api/v1/validate/'); curl_setopt_array($ch, [ CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 30, CURLOPT_HTTPHEADER => [ 'X-API-Key: ' . getenv('SCRUBIMAIL_API_KEY'), 'Content-Type: application/json', ], CURLOPT_POSTFIELDS => $payload, ]); $data = json_decode(curl_exec($ch), true); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch);is_validistrueonly when the mailbox was confirmed. Everything else is explained byverdictandsub_status; see the Validation API.Send an email
Sending needs a verified domain first: add it, publish three DNS records, and verify. That is a one-time job covered in Sending setup. Then one call sends a message.
curl -X POST "https://api.scrubimail.com/scrubimail/api/v1/send/" \ -H "X-API-Key: $SCRUBIMAIL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "sending_domain_id": "a1b2c3d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d", "from_email": "[email protected]", "from_name": "Your Company", "to_email": "[email protected]", "to_name": "Ada Lovelace", "subject": "Welcome, {{first_name|there}}!", "html_content": "<p>Hi {{first_name|there}}, thanks for joining {{company}}.</p>", "text_content": "Hi {{first_name|there}}, thanks for joining {{company}}.", "reply_to": "[email protected]", "tags": [ "welcome" ], "variables": { "company": "Kofi Logistics" } }'const res = await fetch("https://api.scrubimail.com/scrubimail/api/v1/send/", { method: "POST", headers: { "X-API-Key": process.env.SCRUBIMAIL_API_KEY, "Content-Type": "application/json", }, body: JSON.stringify({ "sending_domain_id": "a1b2c3d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d", "from_email": "[email protected]", "from_name": "Your Company", "to_email": "[email protected]", "to_name": "Ada Lovelace", "subject": "Welcome, {{first_name|there}}!", "html_content": "<p>Hi {{first_name|there}}, thanks for joining {{company}}.</p>", "text_content": "Hi {{first_name|there}}, thanks for joining {{company}}.", "reply_to": "[email protected]", "tags": [ "welcome" ], "variables": { "company": "Kofi Logistics" } }), }); const data = await res.json(); if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);import os import requests payload = { "sending_domain_id": "a1b2c3d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d", "from_email": "[email protected]", "from_name": "Your Company", "to_email": "[email protected]", "to_name": "Ada Lovelace", "subject": "Welcome, {{first_name|there}}!", "html_content": "<p>Hi {{first_name|there}}, thanks for joining {{company}}.</p>", "text_content": "Hi {{first_name|there}}, thanks for joining {{company}}.", "reply_to": "[email protected]", "tags": [ "welcome", ], "variables": { "company": "Kofi Logistics", }, } res = requests.post( "https://api.scrubimail.com/scrubimail/api/v1/send/", headers={"X-API-Key": os.environ["SCRUBIMAIL_API_KEY"]}, json=payload, timeout=30, ) data = res.json() res.raise_for_status()<?php $payload = <<<'JSON' { "sending_domain_id": "a1b2c3d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d", "from_email": "[email protected]", "from_name": "Your Company", "to_email": "[email protected]", "to_name": "Ada Lovelace", "subject": "Welcome, {{first_name|there}}!", "html_content": "<p>Hi {{first_name|there}}, thanks for joining {{company}}.</p>", "text_content": "Hi {{first_name|there}}, thanks for joining {{company}}.", "reply_to": "[email protected]", "tags": [ "welcome" ], "variables": { "company": "Kofi Logistics" } } JSON; $ch = curl_init('https://api.scrubimail.com/scrubimail/api/v1/send/'); curl_setopt_array($ch, [ CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 30, CURLOPT_HTTPHEADER => [ 'X-API-Key: ' . getenv('SCRUBIMAIL_API_KEY'), 'Content-Type: application/json', ], CURLOPT_POSTFIELDS => $payload, ]); $data = json_decode(curl_exec($ch), true); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch);The API replies
202with amessage_id. PollGET /send/status/{message_id}/to watch it go fromsendingtodelivered.
Where to go next
- AuthenticationHeaders, scopes, the IP allow-list and keeping keys safe.
- Validation APISingle and bulk checks, verdicts, sub-statuses, history and analytics.
- Sending setupAdd a domain, publish the DNS records, verify, and know the From rules.
- Sending APISend, bulk, templates, campaigns, suppressions and personalisation tags.
- SMTP relayConnect any app on port 587 with STARTTLS and read the error codes.
- Errors and rate limitsStatus codes, the error body, credits and per-plan limits.
- SDKsCopy-paste examples in curl, JavaScript, Python and PHP.
Something missing or wrong? Email [email protected].