Updated

REST API reference

Use the Smailor API to provision addresses, send email from verified domains,
submit contact forms into a shared inbox, and inspect domain reputation. This
reference separates API-key endpoints from browser-session endpoints so you can
choose the correct authentication model.

Messages sent through the API count toward the authenticated account's plan and
safety limits.

Before you start

You need:

  • a Smailor account with API access;
  • an API key created in Settings, API & MCP;
  • a verified custom domain for mailbox provisioning and outbound sending;
  • a server-side environment variable or secret manager for the API key;
  • a recipient address you control for the first delivery test.

Never embed a Smailor API key in browser JavaScript, a mobile application bundle,
a public repository, or a support screenshot. The key grants account-level
access and is shown in full only when it is created.

Request flow

Your backend
    |
    +--> Authorization: Bearer 
    |
    v
Smailor API --> validate account, domain, limits, and reputation
    |
    +--> 2xx: request accepted
    +--> 4xx: change the request or account configuration
    `--> 5xx: temporary failure; retry conservatively

Base URL

Use the origin of the Smailor instance:

Environment Base URL
Production https://smailor.com
Local development http://localhost:5173

Examples below use production. Do not send production credentials to a local or
untrusted origin.

Authentication

Send one of these headers on every API-key request:

Authorization: Bearer YOUR_API_KEY

or:

X-API-Key: YOUR_API_KEY

Prefer the standard Authorization header unless an intermediary strips it.
Treat a 401 unauthorized response as a key/configuration problem; creating
automatic retries will not fix an invalid credential.

Scopes

A key carries a set of scopes and each endpoint asserts the one it needs. Grant
the narrowest set that works: a key that only reads domains cannot be turned into
a key that sends if it leaks.

Scope Grants
mail:send POST /api/v1/send
mail:read GET /api/v1/messages, GET /api/v1/messages/{id}, GET /api/v1/suppressions
mail:suppressions:write POST /api/v1/suppressions, DELETE /api/v1/suppressions/{email}
mailboxes:write POST /api/v1/mailboxes
domains:read GET /api/v1/domains
focus:read the three Focus endpoints below
settings:read, settings:write, forwarding:write, staff:invite POST /api/v1/mcp, the MCP endpoint that lets an AI assistant read and set up the mailbox. forwarding:write is the separate permission for forwarding rules, staff:invite the one for inviting a person to the team
domains:write, invoices:read The same endpoint, to add a domain and check its DNS, and to find invoices and have them emailed to the billing address. The PDF is never handed to the assistant
inbox:read, inbox:draft, inbox:manage, inbox:send The same endpoint, for working on conversations: read them, leave reply drafts, work the queue (status, group, owner, trash, internal notes), queue replies held ten minutes. Four separate levels, none includes the next, and a key that holds any of them is refused if it also holds forwarding:write or staff:invite
calendar:read, calendar:write The same endpoint, for the calendar tools. Events of a connected Google or Apple calendar are read, never changed
sms:send POST /api/v1/sms/send, POST /api/v1/sms/estimate, POST /api/v1/sms/templates, POST /api/v1/sms/destination-requests
sms:read GET /api/v1/sms/messages, GET /api/v1/sms/messages/{id}, GET /api/v1/sms/templates, GET /api/v1/sms/destination-requests
sms:wallet:read GET /api/v1/sms/balance
sms:usage:read GET /api/v1/sms/usage
sms:senders:read, sms:senders:write GET /api/v1/sms/senders, POST /api/v1/sms/senders
sms:campaigns:read, sms:campaigns:write GET /api/v1/sms/campaigns, GET /api/v1/sms/campaigns/{id}, POST /api/v1/sms/campaigns
mailboxes:read, tickets:read, tickets:write, focus:write Part of the vocabulary; no endpoint asserts them yet. A key may hold them and nothing changes today.

Scopes are per resource and verb class rather than per endpoint, so an endpoint
added to a resource you already granted never invalidates a deployed key.

A request whose key lacks the scope is refused with 403 insufficient_scope, and
the body names both what was required and what the key holds:

{
  "error": "insufficient_scope",
  "message": "This API key is missing the \"focus:read\" scope.",
  "requiredScope": "focus:read",
  "grantedScopes": ["domains:read"]
}

Retrying will not fix it: issue a key with the scope. Keys created before scopes
existed carry none in storage and are treated as unrestricted; re-issue them
rather than relying on that.

Limiting a key to some addresses or groups

A key can be limited to some of your addresses and groups (Which mail can it
reach?
when you create or edit it). A limited key reaches a conversation when
it was received at one of its addresses or sits in one of its groups, and:

  • POST /api/v1/send accepts a from only among its addresses and the
    addresses bound to its groups, otherwise 403 from_outside_key_limit;
  • GET /api/v1/messages lists only messages sent from those addresses, and
    GET /api/v1/messages/{id} answers 404 for any other;
  • the Focus board, verdicts and promises show only conversations inside the
    limit, and a verdict outside it answers 404.

A limited key holds only scopes the limit is applied in: mail:send,
mail:read, focus:read, the assistant mail scopes, settings:read and
invoices:read. Anything that acts on the whole account (domains, address
creation, suppressions, SMS, settings changes) is refused at creation and, for
an older key, on every call with 403 outside_key_limit. An address deleted
later drops out of the limit; it never widens it.

smtp:send is deliberately not in this vocabulary: it belongs to an SMTP
credential typed into a mail client and cannot be granted to an HTTP key. Same
for pop3:read and imap:read. Those are issued in the dashboard under
Settings, Mail client access, and are never interchangeable with a key.

  1. Add and verify a custom domain.
  2. Call GET /api/v1/domains and require the expected domain to be verified.
  3. Create member addresses with POST /api/v1/mailboxes when needed.
  4. Send a single controlled message with POST /api/v1/send.
  5. Confirm receipt and authentication at the destination mailbox.
  6. Handle documented 4xx responses explicitly and retry only temporary
    failures.
  7. Monitor bounce and complaint trends before increasing volume.

Endpoint: List Domains + Reputation

GET /api/v1/domains

Returns all custom domains in your account with:

  • Verification state (verified)
  • 30-day sends, bounces, complaints
  • Reputation status (healthy, watch, blocked)
  • Recommendation message

Example

curl "https://smailor.com/api/v1/domains" \
  -H "Authorization: Bearer sk_smailor_..."

Endpoint: Create Mailbox (White-Label)

POST /api/v1/mailboxes

Content-Type: application/json

JSON body

Field Type Required Notes
localPart string yes Mailbox local part, example john-doe
domain string yes Must be a verified custom domain in your account
displayName string no Sender display name

Example

curl -X POST "https://smailor.com/api/v1/mailboxes" \
  -H "Authorization: Bearer sk_smailor_..." \
  -H "Content-Type: application/json" \
  -d '{
    "localPart": "john-doe",
    "domain": "mailer.yourhost.com",
    "displayName": "John Doe"
  }'

Reputation Guard

Mailbox creation is automatically blocked when domain reputation is too risky:

  • blocked status => API returns 409 domain_reputation_blocked
  • Prevents large-scale onboarding on unhealthy domains
  • Helps protect IP/domain reputation for all tenants

Endpoint: Send Email

POST /api/v1/send

Content-Type: application/json

JSON body

Field Type Required Notes
to string yes Recipient email
from string yes Must be an active address on a verified custom domain
subject string yes Subject line
text string one of text/html Plain text body
html string one of text/html HTML body (sanitized server-side)
headers object no List-Unsubscribe and List-Unsubscribe-Post together for RFC 8058 one-click unsubscribe
trackOpens boolean no Set false to omit Smailor's open-tracking pixel for this message; account tracking opt-in still applies when omitted or true
silent boolean no Set true to keep the sent message out of your mailbox. It is delivered normally but no conversation appears in the dashboard until the recipient replies, which brings the conversation back as an open, unread one
tag string no 1 to 64 letters, digits, _, -, . or :. A routing rule with the same tag (Settings, Sending providers) sends this message through the provider it names; rules without a tag ignore it

At least one of text or html must be non-empty.

Retrying safely: Idempotency-Key

Send an Idempotency-Key header (1 to 255 printable ASCII characters, no
spaces) to make a retry safe. For 24 hours, a request with the same key and the
same message gets the first answer back with "deduplicated": true, and nothing
is sent or counted twice. A malformed key is refused with
400 invalid_idempotency_key rather than ignored. The same key with a different
message is 422 idempotency_key_reused; a retry that arrives while the first
request is still being processed is 409 idempotency_in_progress, so wait and
retry.

Idempotency-Key: order-1042-welcome

Success response

{ "ok": true, "id": "9b2f...", "ticketId": "4c1e...", "remaining": 1487 }

id is the message id for GET /api/v1/messages/{id}, ticketId the
conversation, and remaining the outbound conversations left this month. A
200 means the message is queued for delivery.

A 202 with "held": true means the message was set aside for a quick check
by a person before it leaves. It is sent or rejected after that check, the
account is emailed either way, and the rest of your sending is not affected.
Do not send it again.

Send errors

Status Error Meaning
400 invalid_body, invalid_headers, invalid_idempotency_key The request itself is malformed
400 invalid_from from is not one of your active Smailor addresses
400 custom_domain_required, domain_not_verified from must be on a custom domain whose DNS is verified
400 no_group Create at least one group in the app first
403 forbidden The REST API is not available on the Free plan
403 from_outside_key_limit The key is limited to other addresses
403 sender_paused This address or its domain is paused (see Sender Pause Webhooks)
403 verification_required The account is held for a review by Smailor; sending resumes once it is approved
403 account_suspended, outbound_blocked Sending is stopped for this account
409 idempotency_in_progress The same key is still being processed
422 idempotency_key_reused The same key was used for a different message
422 recipient_suppressed, recipient_unreachable See below
422 message_blocked The content failed a safety check (a dangerous link, for example). Change the message
429 too_many_requests Per-minute pace exceeded. Wait for the Retry-After header
429 send_limit_reached No outbound conversations left this month (see capacity)
503 service_unavailable, ledger_unavailable Temporary; retry with the same Idempotency-Key

A recipient on your suppression list is refused
with 422 recipient_suppressed and nothing is sent or counted. The body carries
reason (bounced, complained, unsubscribed or manual).

A recipient whose mail server refuses every address (typically a retired
temporary-inbox domain) is refused with 422 recipient_unreachable, also before
anything is sent or counted, since the message would bounce anyway. The body
carries matched (domain or mx). Treat it as a hard bounce and do not retry.
Temporary inboxes that do receive mail are delivered as usual.

For marketing or subscribed mail, supply both email headers in the JSON body:

{
  "headers": {
    "List-Unsubscribe": "",
    "List-Unsubscribe-Post": "List-Unsubscribe=One-Click"
  },
  "trackOpens": false
}

The HTTPS URL must identify the recipient and list and accept Gmail's POST
without a login or confirmation. Smailor passes these headers to its outbound
transports and signs both when Smailor performs DKIM signing. If you use your
own SMTP or API provider, confirm its received DKIM h= list includes both
headers. Other email headers are rejected with 400 invalid_headers rather
than silently ignored. A sender name comes from the sending address's Sender
name
setting; the API from field only selects the address.

Example

curl -X POST "https://smailor.com/api/v1/send" \
  -H "Authorization: Bearer sk_smailor_..." \
  -H "Content-Type: application/json" \
  -d '{
    "to": "[email protected]",
    "from": "[email protected]",
    "subject": "Welcome",
    "text": "Your mailbox is now active."
  }'

Trying it without sending: the playground

POST /api/playground/v1/send takes the same body and headers and runs the
same checks as /api/v1/send, in the same order: scope, body, key limit,
email headers, Idempotency-Key, account, from address, suppression list,
domain, group and monthly allowance. It answers with the status and error code
the real endpoint would give, then stops. Nothing is queued, stored in your
mailbox, counted against your allowance or delivered.

  • Open on every plan, Free included. Free accounts get the answer a paid plan
    would get; the real endpoint answers them 403 forbidden.
  • Authenticate with the playground key shown in Settings, API & MCP,
    Playground
    (sk_play_...), or with a real key, whose scopes and address
    limit then apply exactly as they would. A playground key is refused by
    /api/v1.
  • Every answer carries the Smailor-Playground: 1 header and
    "playground": true in the body. A success also carries "sent": false.
  • Not checked here, because they need a real send: the content review, the
    lookup of the recipient's mail server (recipient_unreachable), the
    per-minute pace (too_many_requests) and delivery itself.
  • Each request appears live on the playground page with every check it went
    through. The last 50 are kept for 24 hours. The endpoint allows 60 requests a
    minute per account.
  • POST /api/playground/v1/sms/send and /api/playground/v1/sms/estimate do
    the same for SMS: no SMS, no quota, no credit. See
    SMS API.
curl -X POST "https://smailor.com/api/playground/v1/send" \
  -H "Authorization: Bearer sk_play_..." \
  -H "Content-Type: application/json" \
  -d '{
    "to": "[email protected]",
    "from": "[email protected]",
    "subject": "Welcome",
    "text": "Your mailbox is now active."
  }'

Endpoint: Sent Messages

GET /api/v1/messages (scope mail:read)

Your sends, newest first. Query parameters: limit (1 to 100, default 25),
before (the nextBefore value of the previous page) and to (one exact
recipient).

GET /api/v1/messages/{id} returns one message by the id that
POST /api/v1/send returned.

Each message has id, to, from, status, provider, createdAt,
sentAt, failureReason, failure and events:

status Meaning
queued, sending Not handed to a receiving server yet
deferred The receiving server asked to try later; Smailor retries
sent A receiving server or your provider accepted the message
unconfirmed The connection broke after the message was transmitted; it is held for a person rather than risk a duplicate
failed Refused for good, or given up after retrying. failureReason is the receiving server's reply
cancelled Not sent (a limit or a guard)

For a failed or deferred message, failure explains the reply:
category (for example mailbox_full, no_such_user, provider_policy),
summary (one sentence) and side, which says where the cause is:

side Meaning
recipient The address or the mailbox (unknown user, full mailbox)
recipient_provider The receiving provider's own rules or servers
sender Your message or your domain (content refused, SPF, DKIM or DMARC)
smailor Smailor's sending servers
unknown The reply does not say

The same list is shown in Settings, API & MCP, under Delivery problems.

provider is resend, brevo or mailjet when the message left through one
of your own providers, smailor otherwise. events lists what that provider
reported afterwards (see Delivery events from your own
provider
): each has type
(delivered, deferred, bounced, soft_bounced, complained, failed,
opened, clicked, unsubscribed), recipient, detail, url (for a
click) and occurredAt.

curl "https://smailor.com/api/v1/messages?limit=10" \
  -H "Authorization: Bearer sk_smailor_..."

Endpoint: Suppression List

Addresses on this list are not mailed by POST /api/v1/send or the SMTP
gateway. Mail you write in the Smailor app is not affected. An address is added
automatically after a hard bounce, a complaint or an unsubscribe reported by
your own provider, and you can add or remove one at any time, here or in
Settings, Sending providers.

Method Path Scope Notes
GET /api/v1/suppressions mail:read Query: limit (1 to 200), before, search
POST /api/v1/suppressions mail:suppressions:write Body { "email", "reason"? }. 201 when added, 200 when it was already there (the first reason is kept)
DELETE /api/v1/suppressions/{email} mail:suppressions:write URL-encode the address. 404 when it was not on the list

Delivery events from your own provider

When a message leaves through your own Resend, Brevo or Mailjet account, that
provider knows what happened next: delivered, bounced, marked as spam, opened,
clicked. To bring those events back into Smailor:

  1. In Settings, Sending providers, open Delivery events under the
    provider and copy its webhook URL.
  2. Paste the URL into the provider: Resend (Webhooks, email events), Brevo
    (transactional webhook) or Mailjet (event notifications, one URL per event).
  3. For Resend, paste the signing secret (whsec_...) Resend shows back into
    Smailor. From then on, a call without a valid Svix signature is refused.

The URL is the credential for Brevo and Mailjet, which do not sign their calls:
keep it private, and use Replace URL if it leaks. Events then appear on the
message in GET /api/v1/messages, hard bounces, complaints and unsubscribes
add the recipient to the suppression list, and they can be forwarded to your
own server (next section). Events are kept 180 days.

Customer Delivery Webhooks

The customer webhook endpoints in Settings, API & MCP can also opt into
email.delivered, email.deferred, email.bounced, email.soft_bounced,
email.complained, email.failed, email.opened, email.clicked and
email.unsubscribed. Nothing is sent to an endpoint until you tick an event.
They come from your own provider, so they need the setup above.

{
  "event": "email.bounced",
  "id": "5b1f7d1e-3f43-4a4c-9a0f-6f8b8c1d2e3f",
  "created_at": "2026-10-23T12:00:00.000Z",
  "data": {
    "message_id": "the id POST /api/v1/send returned, or null",
    "recipient": "[email protected]",
    "provider": "resend",
    "provider_message_id": "4ef9a417-...",
    "occurred_at": "2026-10-23T11:59:58.000Z",
    "detail": "mailbox does not exist",
    "url": null
  }
}

Delivery, retries and signature work as for SMS events below: a 2xx
acknowledges, other answers are retried up to eight times, deduplicate on
X-Smailor-Delivery, and verify X-Smailor-Signature when the endpoint has a
secret.

Sender Pause Webhooks

An account that sends for several mailboxes (its own customers, one address
or one subdomain each) is checked per mailbox. When one mailbox sends a message
that needs a person to look at it, that mailbox alone is paused: the rest of
the account keeps sending, and POST /api/v1/send from the paused address
answers 403 with the code sender_paused. Several mailboxes of one domain
paused in the same week pause the domain.

The same endpoints can opt into sender.paused and sender.resumed, so your
system can stop that customer on its side straight away. Neither needs a
provider. The payload names the address, never the rule that stopped it:

{
  "event": "sender.paused",
  "id": "e2c7a91f-4b06-4d8e-a3f5-6b1d0c9e2a74",
  "created_at": "2026-11-18T09:42:07.000Z",
  "data": {
    "scope": "address",
    "address": "[email protected]",
    "domain": "client1.example.com",
    "subject": "Your invoice is ready",
    "paused_at": "2026-11-18T09:42:07.000Z"
  }
}

scope is address or domain; on a domain pause address is null.
sender.resumed carries the same id and adds resumed_at. Messages refused
while the address was paused were not sent: send them again. Paused addresses
are also listed in Settings, API & MCP.

Focus Webhooks

The same endpoints can opt into events from the Focus board. Nothing is sent
until you tick an event, and an endpoint with none ticked keeps receiving only
inbound.ticket_created.

Event When
focus.item.created A conversation was surfaced on the Focus board.
focus.item.escalated A conversation became urgent enough for Do Now.
promise.created Your team promised something in an outbound reply.
promise.overdue A promise passed its due date without being kept.
customer.risk.high A customer relationship reached high or critical risk.
conversation.needs_attention A conversation needs a reply and has no owner.

These describe a state, not an occurrence. The board is recomputed every 15
minutes, and an event is sent again for the same conversation only when what
justified it changed (its section, priority or risk band), never because time
passed. A request that is not answered with a 2xx is sent again on the next
pass, so treat (event, conversation.id) as the identity of an event, not
X-Smailor-Delivery, which is new on every attempt.

{
  "event": "conversation.needs_attention",
  "sent_at": "2026-11-02T09:15:00.000Z",
  "conversation": {
    "id": "6c0e3b0a-...",
    "subject": "Invoice question",
    "from_email": "[email protected]",
    "section": "needs_attention",
    "priority": "high",
    "customer_risk": "medium",
    "why_here": "Waiting over 48 hours and nobody owns it",
    "reason_codes": ["WAITING_OVER_48H", "NO_OWNER"],
    "waiting_minutes": 2880,
    "follow_up_count": 1,
    "owner_id": null
  }
}

promise.* events carry a promise object instead: id, conversation_id,
subject, from_email, promise (the wording), due_at and status.
due_at is null when the wording gave no deadline; Smailor never guesses one.

Requests carry X-Smailor-Event, X-Smailor-Webhook-Id, X-Smailor-Delivery
and, when the endpoint has a secret, X-Smailor-Signature: sha256=<hmac> over
the raw body.

Endpoint: Focus Board

GET /api/v1/focus

Scope: focus:read. The attention board as data: what Focus decided a human
should look at, in the same order the dashboard shows it. Cards are always scoped
to the key's owner.

Read-only by design. There is no endpoint to dismiss or reprioritise a card:
an integration that could would make the board disagree with what the team
actually did, and the board's value is that it is trustworthy at a glance.

Query parameters

Parameter Notes
section One of do_now, needs_attention, waiting_too_long, quick_win, needs_review. Omit for every section. An unknown value is 400 invalid_section.
limit Cards per section, clamped to 1–50.

Success response

{
  "generatedAt": "2026-09-26T08:15:00.000Z",
  "total": 12,
  "summary": { "do_now": 3, "needs_attention": 5 },
  "sections": { "do_now": [ { "ticketId": "...", "subject": "..." } ] }
}

503 unavailable means Focus is not enabled on the account, not a transient
error, so do not retry it on a loop.

Endpoint: Focus Verdict for One Conversation

GET /api/v1/focus/conversations/:id

Scope: focus:read. Covers both the priority and the risk verdict for a single
conversation. An id from another workspace reads as 404 not_found, the same as
an id that does not exist.

The response carries priority (level, section, state, score, reasonCodes,
whyHere, suggestedAction, confidence), risk (level, score, factors), and
the surrounding facts: waitingMinutes, followUpCount, ownerId,
handlingTime, promise, spamStatus, securityRisk, updatedAt.

reasonCodes are machine-stable and safe to branch on. whyHere is the sentence
a human reads and is not a stable contract.

Endpoint: Focus Promises

GET /api/v1/focus/promises

Scope: focus:read. Commitments detected in what your team wrote, such as "I'll get back
to you tomorrow", with the deadline the wording implied.

Parameter Notes
status open, overdue, completed, cancelled, or all (default). Anything else is 400 invalid_status.
limit Maximum promises returned.

Each entry carries id, conversationId, subject, senderEmail, promise,
promiseText, dueAt, needsReview, status, overdueMinutes, confidence,
detectedBy and createdAt.

dueAt is null when the wording carried no deadline. It is never a guess,
so treat null as "no deadline stated" rather than substituting one, and
needsReview marks the ones a human should confirm.

Endpoint: Contact Widget Submit

POST /api/widget/submit

Content-Type: application/json

Powers the embeddable contact forms generated in Settings, Widgets. A website visitor fills in a form, and the message lands in your Smailor inbox as a new ticket from that visitor.

Unlike /api/v1/send, this endpoint delivers inbound to your own inbox, so to only has to be an active address on your account; a verified custom domain is not required.

Two ways to authenticate

Mode Header Where it runs Recipient
Publishable widget key (recommended for websites) X-Widget-Key: wk_... In the page Pinned to the form widget's address; to is ignored
Account API key Authorization: Bearer ... or X-API-Key Your backend only to is required

A publishable key is created per address in Settings, Widgets, Contact forms. It can only deliver into that address, can be restricted to your websites, and is rate-limited to 10 submissions per 10 minutes per visitor IP. See the widgets guide for the full model, and for the live chat widget, which is built on the same keys.

JSON body

Field Type Required Notes
to string API key only Must be one of your active Smailor addresses. Ignored with a publishable key
from string yes Visitor's email; appears as the sender in your inbox
name string no Visitor display name, max 255 chars
subject string yes 1–998 chars
message string yes Plain text, 1–100000 chars. The HTML body is generated and sanitized server-side
attachments array no Files uploaded by the visitor, see Attachments

Attachments

Each entry of attachments is an object:

Field Type Required Notes
filename string yes 1–255 chars. Shown on the ticket
mimeType string no e.g. image/png. Falls back to the file extension when omitted
contentBase64 string yes Base64 of the file bytes. A data: URL prefix (data:image/png;base64,...) is accepted and stripped

Default limits, configurable per deployment:

Limit Default Environment variable
Files per submission 3 WIDGET_MAX_ATTACHMENTS
Size per file 5 MB WIDGET_ATTACHMENT_MAX_PER_FILE_MB
Total size per submission 10 MB WIDGET_ATTACHMENT_MAX_TOTAL_MB

The widget limits are always clamped to the mailbox-wide ones (ATTACHMENT_MAX_PER_FILE_MB,
ATTACHMENT_MAX_PER_TICKET_MB), and the whole request must still fit under BODY_SIZE_LIMIT.
Base64 inflates payloads by roughly one third, so budget accordingly.

Accepted file types. Documents (PDF, Office, OpenDocument, RTF, TXT, CSV, Markdown, JSON,
XML), images, audio, video and archives. Executables, scripts and active web content are
refused. The declared mimeType is only a hint: the file is re-identified from its magic bytes
before it is written to disk, so renaming an executable does not get it through.

Example

curl -X POST "https://smailor.com/api/widget/submit" \
  -H "Authorization: Bearer sk_smailor_..." \
  -H "Content-Type: application/json" \
  -d '{
    "to": "[email protected]",
    "from": "[email protected]",
    "name": "Jane Doe",
    "subject": "Question about pricing",
    "message": "Hi, do you offer annual billing?"
  }'

With an attachment:

curl -X POST "https://smailor.com/api/widget/submit" \
  -H "Authorization: Bearer sk_smailor_..." \
  -H "Content-Type: application/json" \
  -d "{
    \"to\": \"[email protected]\",
    \"from\": \"[email protected]\",
    \"subject\": \"Invoice problem\",
    \"message\": \"The total on this invoice looks wrong.\",
    \"attachments\": [{
      \"filename\": \"invoice.pdf\",
      \"mimeType\": \"application/pdf\",
      \"contentBase64\": \"$(base64 -w0 invoice.pdf)\"
    }]
  }"

From a browser, read the file with FileReader.readAsDataURL and send everything after the
comma. That is exactly what the generated Settings, Widgets contact-form snippet does:

const toAttachment = (file) =>
  new Promise((resolve, reject) => {
    const reader = new FileReader();
    reader.onload = () => {
      const result = String(reader.result);
      resolve({
        filename: file.name,
        mimeType: file.type || undefined,
        contentBase64: result.slice(result.indexOf(',') + 1),
      });
    };
    reader.onerror = () => reject(new Error(`Could not read ${file.name}`));
    reader.readAsDataURL(file);
  });

const attachments = await Promise.all([...fileInput.files].map(toAttachment));

Success response

{ "ok": true, "messageId": "", "attachments": 1 }

attachments is the number of files accepted for the ticket.

Errors

Status Error Meaning
400 invalid_body, invalid_headers Schema or one-click email header validation failed
400 invalid_to The to address is not an active address on your account
403 origin_not_allowed The page's origin is not in the widget's allowed websites
403 account_suspended The account behind the key is suspended
429 rate_limited More than 10 submissions in 10 minutes from this visitor
400 too_many_attachments More files than WIDGET_MAX_ATTACHMENTS allows
400 attachment_too_large A file, or the batch, exceeds the size limit
400 attachment_type_rejected The file type is not on the allowlist
400 invalid_attachment Missing filename, empty file, or malformed base64
401 unauthorized Missing or invalid API key
503 service_unavailable Message queue temporarily unavailable, retry
500 internal_error Temporary server issue

Attachment errors carry a human-readable message naming the offending file, plus a limits
object with the effective maxCount, maxPerFileBytes and maxTotalBytes. Show it to the
visitor as-is:

{
  "error": "attachment_too_large",
  "message": "\"screenshot.png\" exceeds the 5 MB per-file limit.",
  "limits": { "maxCount": 3, "maxPerFileBytes": 5242880, "maxTotalBytes": 10485760 }
}

CORS

The endpoint answers OPTIONS preflight and allows cross-origin POST, so it can be called from your website's front-end. Restrict the allowed origins with the API_CORS_ORIGIN or API_CORS_ALLOWLIST environment variables (default: *).

Keep your API key server-side

Your API key is not limited to widget submissions: it carries every scope you granted it, and this endpoint accepts any valid key. Pasting it into front-end JavaScript makes it readable by any visitor via page source or the network tab, and reusable with those scopes, sending mail in your name included.

For production, put the key behind your own server and have the browser call your endpoint instead:

// your-server/contact  ->  proxies to Smailor with the key from an env var
const upstream = await fetch('https://smailor.com/api/widget/submit', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    Authorization: `Bearer ${process.env.SMAILOR_API_KEY}`,
  },
  body: JSON.stringify({ to: RECIPIENT, from: visitorEmail, subject, message, attachments }),
});

If you forward attachments through your own server, raise its body-size limit too. Express
defaults to 100 KB (app.use(express.json({ limit: '12mb' }))).

Set the recipient (to) on your server too, never from the request body. Otherwise the endpoint lets anyone send mail to any of your addresses.

SMS endpoints

SMS has its own reference: SMS API. It covers every endpoint
below with its body, its answers and its errors, the webhooks, the limits and
the SMS playground.

Method Path Scope
POST /api/v1/sms/send sms:send (Idempotency-Key required)
POST /api/v1/sms/estimate sms:send
GET /api/v1/sms/messages, /api/v1/sms/messages/{id} sms:read
GET, POST /api/v1/sms/templates sms:read, sms:send
GET, POST /api/v1/sms/destination-requests sms:read, sms:send
GET /api/v1/sms/usage sms:usage:read
GET /api/v1/sms/balance sms:wallet:read
GET, POST /api/v1/sms/senders sms:senders:read, sms:senders:write
GET, POST /api/v1/sms/campaigns, GET /api/v1/sms/campaigns/{id} sms:campaigns:read, sms:campaigns:write

SMS events (sms.sent, sms.delivered, sms.failed, sms.received and the
campaign events) are delivered to the customer webhooks of Settings, API &
MCP
, signed like the other events.

Common Errors

Applies to /api/v1 endpoints.

Status Error Meaning
400 invalid_body, invalid_headers, domain_not_verified, invalid_section, invalid_status Validation or domain verification issue
401 unauthorized Missing or invalid API key
403 forbidden Plan or account restriction: the REST API is not available on Free
403 insufficient_scope The key is valid but lacks the scope the endpoint requires
403 outside_key_limit The key is limited to some addresses or groups and this endpoint acts on the whole account
404 not_found, user_not_found No such resource, or none visible to this key
409 address_taken, domain_reputation_blocked Conflict or safety guard triggered
422 recipient_suppressed, recipient_unreachable The recipient is on your suppression list (remove it to send again), or its mail server refuses all mail
429 too_many_requests, send_limit_reached Send frequency limit hit, or no outbound conversations left this month
503 unavailable The feature is not enabled on this account (e.g. Focus)
5xx internal_error Temporary server issue

403 and 503 are decisions, not transient failures: retrying either without
changing the key or the plan produces the same answer.

Best Practices for Reputation Safety

  • Use double opt-in for new senders
  • Warm up new domains gradually
  • Stop onboarding when bounce/complaint rates increase
  • Separate transactional and marketing traffic per domain
  • Monitor domain-level events daily

For bulk marketing or subscription mail to personal Gmail accounts, see
one-click unsubscribe requirements.
The send API accepts the RFC 8058 unsubscribe header pair; customers must host
the unsubscribe endpoint and suppress opted-out recipients. Smailor's own
outreach workflow handles its own opt-outs.

Reply Templates (Web Session API)

These routes power the in-app template editor and ticket composer. They authenticate with the same session as the dashboard (browser cookies after login), not with Authorization: Bearer sk_... keys used for /api/v1.

Use cases: building automation around your own logged-in browser session, internal tools same-origin with Smailor, or understanding what the UI calls.

Method Path Purpose
GET /api/templates List your templates. Optional query: ?groupId= (UUID) or ?ticketId= (UUID) to scope suggestions like the ticket reply UI.
POST /api/templates Create a template (JSON body below). Max 50 templates per account.
GET /api/templates/{id} Load one template (owner only).
PATCH /api/templates/{id} Update fields (name, description, subject, body_html, body_text, is_default, group_ids).
DELETE /api/templates/{id} Delete template.
POST /api/templates/{id}/preview Body: { "ticketId": "<uuid>" }. Returns rendered subject, html, text for that ticket.
POST /api/templates/{id}/use Fire-and-forget use counter (called when a template is inserted in the UI).

Create template (POST /api/templates)

Content-Type: application/json

Field Type Required Notes
name string yes Display name
description string no Short note
subject string yes Can include {{placeholders}}
body_html string yes HTML body, min length 10
body_text string no Plain text; if omitted, derived from HTML
is_default boolean no Mark as default
group_ids string[] (UUID) no Restrict template to groups; omit or empty = all groups

Placeholders

Subject and HTML may use {{variable}} tokens. Common keys: customer_name, customer_email, ticket_id, subject, group_name, sender_name, company_name, date. Unknown keys are left unchanged at render time.

curl -X POST "https://smailor.com/api/templates" \
  -H "Content-Type: application/json" \
  -H "Cookie:  Application > Cookies while signed in>" \
  -d '{
    "name": "Thanks",
    "subject": "Re: {{subject}}",
    "body_html": "

Hi {{customer_name}},

Thanks for your message.

" }'

Errors mirror other JSON APIs: 401 when not signed in, 400 for validation or template quota, 403/404 when listing with ticketId you cannot access.

See Also

Outbound conversation capacity

Plan Monthly subscription Annual subscription Outbound conversations / month
Free €0.00 €0.00 100
Solo Annual only €19.90 600
Starter €3.99 €39.90 1,800
Pro €9.99 €99.90 6,000
Business €31.99 €319.90 30,000

Prices are in EUR. VAT is not applicable (Article 293 B of the French General Tax Code), so the price shown is the price charged. Solo is annual-only. Annual Starter, Pro and Business cost ten monthly payments. Usage allowances renew every calendar month, including on annual plans.

Business includes 50 people, the account owner included. Each further person costs €0.99 per month, billed monthly on the account's charge date with the plan, including on annual Business.

Additional monthly capacity Monthly recurring price per pack
+1,000 outbound conversations €0.99
+2,500 outbound conversations €1.49
+5,000 outbound conversations €2.49
+10,000 outbound conversations €3.99
+25,000 outbound conversations €7.99

Available on every paid plan. Packs bought on Free before 24 November 2026 keep renewing. Packs are stackable and billed monthly on the same day as the plan. A new pack is charged pro rata up to that day, then at the full price.

Automatic packs: on every paid plan, the account owner can turn them on with a monthly budget between €5.00 and €1000.00. New conversations beyond the allowance and packs then keep going out, and at the end of the month only the packs needed are added, at the monthly pack prices above, in the cheapest combination. Nothing is billed if the month stays under. Past the budget, new conversations pause. They are off by default and charged with the plan on the account's charge date.

One-off credits are no longer sold. Credits already bought stay valid until they expire and are used before automatic packs.

A new conversation started by you counts as one outbound conversation. Replies don't count.

POST /api/v1/send starts a new conversation and consumes one outbound unit when accepted into the queue. Retries with the same idempotency key do not consume another unit. Existing-thread replies and SMTP messages with a valid owned thread reference do not consume another unit. remaining reports available outbound capacity, including paid packs and credits, for the UTC calendar month. It never includes billing by usage: on a Business account whose owner turned it on, new conversations keep being accepted after remaining reaches 0, until the month reaches the owner's cap. 429 send_limit_reached means no capacity for new conversations; existing replies still work. Rate-limit errors are independent and may affect replies too.

Usage is shared across the account and its team, including your own sending provider. Packs do not grant paid API access on Free. See plans and outbound packs for the complete counting, reset and billing rules.

All guides

Found an issue on this page?