# lewat.email Email API (OTP, password reset, invoices, notifications, contacts). Fully headless: an agent can do every step below with HTTP calls. No browser, no dashboard. Base URL: https://api.lewat.email Auth: `Authorization: Bearer ` Machine-readable index: GET https://api.lewat.email/ (every endpoint, grouped by task) MCP server (Streamable HTTP): https://api.lewat.email/mcp with the same Bearer key Agent Skill: save https://api.lewat.email/skill.md as /lewat-email/SKILL.md (Claude Code: ~/.claude/skills/lewat-email/SKILL.md) Sections: Conventions · Keys and access · Get started · Send to anyone · Inspect before sending · Sending · Track messages · Scheduled messages and batches · Queue and delivery webhooks · Content · Contacts · Integrations · Segments, mailing lists, custom fields · Suppression, unsubscribes, bounces · Privacy requests · Account and security · MCP tools · Limits · Errors · For agents ## Conventions - Success: {"data": ...}. Collections: {"data": [...], "meta": {"page","perPage","total"}} with ?page (from 1) and ?perPage (default 20, max 100). - Errors: {"message": "...", "error": "CODE"}. Read error, not message. - Fields are camelCase. Ids are 24-character hex strings. Times are ISO 8601. - PUT replaces the object unless the section says only the fields sent change. - Authenticated responses have X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset (per key, per minute; one request counts once), except read-only send simulation, which does not update counters. - Date ranges (messages, events, stats, logs): ?dateFrom and ?dateTo as YYYY-MM-DD or ISO 8601 with a zone, ?timeZone Asia/Jakarta (default) or UTC, at most 92 days. meta echoes the range used. ## Keys and access A key has access "sending" or "full". A sending key can: POST /v1/transmissions, POST /v1/send-simulations, POST /v1/email-testing/send-test, GET /v1/transmissions, /v1/analytics/transmission/..., /v1/messages..., /v1/events/{messageId}, /v1/sending-queues, /v1/me, /v1/usage, /v1/quotas, /v1/open-api/key-info, /v1/scopes. Everything else needs full access (403 INSUFFICIENT_SCOPE). Scheduled messages, batches and webhooks also need a live key. Keys: GET|POST /v1/api-keys {"name","access":"sending"|"full","mode":"live"|"test"}, GET|DELETE /v1/api-keys/{id}. At most 10 active keys. Another account's object always answers 404. ## No invite code yet curl -X POST https://api.lewat.email/waitlist -H 'Content-Type: application/json' -d '{"email":"you@example.com","useCase":"OTP for my app"}' curl -X POST https://api.lewat.email/waitlist/confirm -H 'Content-Type: application/json' -d '{"email":"you@example.com","code":"ABCD-EFGH"}' The invite code arrives by email when a place opens. Do not call these repeatedly; one confirmed entry is enough. ## Get started (3 calls) 1. Create the account. An invite code is required. A verification code is emailed. curl -X POST https://api.lewat.email/auth/signup -H 'Content-Type: application/json' -d '{"email":"you@example.com","password":"a-long-password-123","inviteCode":"..."}' 2. Ask the human for the code in that email, then confirm it. data.apiKey is the first API key. Store it; it is shown once. curl -X POST https://api.lewat.email/auth/verify -H 'Content-Type: application/json' -d '{"email":"you@example.com","code":"ABCD-EFGH"}' 3. Send a sandbox email. Sandbox delivers real mail, only to the account's own login email. curl -X POST https://api.lewat.email/v1/transmissions -H 'Authorization: Bearer le_live_...' -H 'Content-Type: application/json' -d '{"mode":"sandbox","from":{"email":"sandbox@sandbox.lewat.email"},"to":[{"email":"you@example.com"}],"subject":"Hello","bodyText":"It works."}' At any point, GET /v1/me returns data.nextStep with the exact call to make next. ## Send to anyone (live) 1. POST /v1/domain/sending {"domain":"mail.example.com"} → data.records has three DNS records (SPF, DKIM, DMARC). 2. Publish the records at the domain's DNS host. If an SPF record already exists, add our include to it; never publish two SPF records. 3. PUT /v1/domain/sending/mail.example.com/verify-txt → data.status becomes "Verified" when all three records pass. 4. data.stage "pending_activation" means DNS is correct and we are enabling the domain on our side. Poll GET /v1/domain/sending until stage is "ready". 5. POST /v1/transmissions with from.email on that domain. Omit "mode" (or use "live"). Domains that are still waiting are re-checked for you every hour. from.email must be on exactly the domain you verified (mail.example.com does not cover example.com or other subdomains). There is no automatic fallback to sandbox: a live send from an unverified domain returns 403 DOMAIN_NOT_VERIFIED. Senders: POST /v2/senders {"name":"Toko Ayu","email":"halo@mail.example.com","replyTo":"cs@example.com"} stores a From identity on a verified domain (GET|PUT|DELETE /v2/senders/{id}; /v1/senders is the same). PUT replaces all three fields. data.verified and data.canSend are read from the domain at request time. ## Inspect before sending POST /v1/send-simulations or MCP simulate_send accepts the transmission body (templateId and senderId included) and returns data.canSend, blockers, counts and limitations. No mail is sent, no quota is reserved, and no business data changes. This is a snapshot, not a delivery guarantee or inbox prediction. The send path checks again, including the gateway rate limit which inspection does not evaluate. ## Sending POST /v1/transmissions from {"email":"you@mail.example.com","name":"Your App"} or senderId to [{"email":"user@example.com","name":"User"}] (to + cc + bcc: at most 50) subject string bodyHtml, bodyText at least one cc, bcc like to; replyTo [{"email":"..."}] (one address) mode "sandbox" or "live" (default live) Header Idempotency-Key (optional, up to 255 characters, kept at least 24 hours, longer while queued or uncertain): the same key and body returns the same transmissionId and never sends twice. Use it for every retry. Response 202: {"message":"Transmission received","data":{"transmissionId":"...","status":"queued","mode":"live"}} when hosted Queue is enabled; synchronous environments may return "accepted". Recipients on your suppression list are skipped and returned in data.suppressed; they use no quota. senderId: the id of a stored sender instead of "from". The sender supplies from.email, from.name and, unless the request has its own replyTo, the sender's replyTo. Sending both from and senderId is 400; an unknown id is 404 SENDERS_NOT_FOUND; the domain is still checked on every send. Live mode only (sandbox needs the sandbox from address). Scheduled messages and batches do not take senderId: spell out "from" there. Templates: store one with POST /v1/template {"name","subject","htmlContent","textContent"} using {{placeholders}}, then send with "templateId" and "substitutionData" instead of subject and bodies. A placeholder without a value is refused (400 MISSING_SUBSTITUTION_DATA, with the missing names); nothing is sent with a literal {{name}}. Values are HTML-escaped in htmlContent. Test keys (le_test_) validate the request and return status "test". They never send and never use quota. Not available: attachments, custom headers. A request with them is 400. ## Track messages A message is one transmission and its id is the transmissionId. Message states: queued, sending, sent (handed over for delivery, no confirmation yet; POST /v1/transmissions calls it "accepted"), delivered, bounced, failed, uncertain. Recipient states: sent, delivered, bounced (always a hard bounce), failed. Opens, clicks and complaints are not recorded and appear nowhere. - GET /v1/messages/{id}/status → currentState, terminal (true when nothing more will happen), recipients [{to, currentState, terminal}], events (timeline). Poll this. - GET /v1/messages?status=&mode=&channel=&to=&from=&q= → messages, newest first (default last 30 days). from takes an address or a bare domain; q matches the subject. GET /v1/messages/{id} is one message with recipients. - GET /v1/messages/status?recipient=&state= → one row per recipient (default last day). - GET /v1/events/{messageId} → the timeline alone. GET /v1/analytics/transmission/{id} and .../events are the older views of the same data. - Full access: GET /v1/events?event=delivered|bounced&email= ; GET /v1/message-logs?to=&from=&subject=&status= and /v1/message-logs/{id}. Statistics (full access): GET /v1/stats?aggregatedBy=day|week|month&groupBy=mode|channel|senderDomain&mode=live|sandbox. Each bucket: messages, then recipient counts requests, accepted, delivered, bounces, failed, uncertain, pending, and deliveryRate and bounceRate in percent of accepted (null when nothing was accepted). A message is counted on the day it was submitted. GET /v1/metrics/bounce-classifications gives hard against soft bounce counts. Quotas: GET /v1/quotas → monthlyLimit, monthlyUsed, monthlyRemaining, monthlyResetAt; dailyLimit (null: no daily cap applies), dailyRemaining, dailyLimitReason (new_account or platform_capacity), dailyResetAt; rateLimit, rateLimitRemaining; sandbox {...}; newAccount {distinctRecipientLimit, ...} during the first 24 hours of live sending. Nothing is reserved by reading. GET /v1/quotas/history?aggregatedBy= gives sent and sandboxSent per WIB day. GET /v1/usage is the short form. ## Scheduled messages and batches A full live key is required for all deferred-job operations. Test keys cannot create or start durable work. POST /v1/scheduled-messages accepts the transmission body plus scheduledFor, an RFC3339 timestamp with an explicit zone, future and within 30 days. Templates are rendered and frozen at creation. Creation makes no provider request and reserves no quota; policy is checked again at execution. Dispatch is best effort on the minute scheduler, not a promise of exact-time delivery. Work still unadmitted 24 hours after its due time expires. GET /v1/scheduled-messages lists jobs (?page,perPage,dateFrom,dateTo). GET .../{id} reads one. PUT .../{id} with {"scheduledFor":"..."} reschedules; DELETE cancels until the job is atomically admitted to the send queue. A job already admitted cannot be recalled. Status queued means admission succeeded; use its transmissionId with get_email_status for delivery. A failureCode explains a failed admission; policy refusals are terminal and are not silently retried. POST /v1/batches {"name":"Welcome","messages":[]} validates all items and stores a draft. At most 100 messages, each rendered message up to 1,100,000 bytes and total rendered content up to 2,000,000 bytes; the HTTP request limit is 1,100,000 bytes. POST /v1/batches/{id}/send starts it. GET /v1/batches and GET .../{id} report progress and per-item outcomes. DELETE cancels only a pending draft. Partial success is possible: completed means every item was admitted or failed, not that every message was delivered. Item admission counts and transmissionStatus are separate; get_email_status provides recipient delivery detail. Use an optional Idempotency-Key for creation (MCP: idempotencyKey). The same original request returns the same current job or batch, even after cancellation or template edits; another body under that key conflicts. Schedules and batches have separate key namespaces. Repeating batch start does not resend items. Accepted jobs belong to the organization and survive API-key rotation/revocation; cancel them explicitly or pause live sending to prevent dispatch. Pausing an account still permits sandbox according to existing policy. Limits: 1,000 pending/claimed jobs and 100 open batches per organization. Authorize recipients/content before creating schedules or starting batches; existing workflow authorization counts. Do not put credentials in message content or chat. ## Queue and delivery webhooks A queued response confirms durable admission and reserves quota. It does not confirm provider acceptance or delivery. Poll GET /v1/messages/{id}/status (or GET /v1/analytics/transmission/{transmissionId}; get_email_status uses that data). Transmission states are queued, processing, accepted, delivered, bounced, failed, or uncertain. Read failureCode when present. Never resubmit an uncertain transmission with a new idempotency key; its original attempt may have delivered. GET /v1/sending-queues gives account counts; scheduled counts describe jobs before admission, which reserve no quota. Public purge/retry is not implemented. POST /v1/webhooks {"name":"Delivery","targetUrl":"https://hooks.example.com/email","eventIds":[1,2]} registers delivery (1) and bounce (2) events. A full live key is required. GET /v1/webhooks/{id}/signing-key returns a secret for the receiver's secret store, never for chat. Verify HMAC-SHA256 using the decoded hex key over Webhook-Timestamp + "." + Webhook-Id + "." + exact raw body; signature is Webhook-Signature v1=hex. Reject stale timestamps and deduplicate Webhook-Id. Delivery is at least once. POST .../{id}/test queues a synthetic request; GET .../{id}/batch-status shows counts and the last 20 attempts with safe error codes. PUT .../{id} replaces name,targetUrl,eventIds,isActive; DELETE cancels future attempts. An in-flight request cannot be recalled. Rotate a signing key: PATCH /v1/webhooks/security/{webhookId}/signing-key {"rotate": true} returns the new key. There is no overlap: the previous key stops working at once, and every later delivery, retries of earlier events included, is signed with the new one. Update the receiver in the same step. No MCP tool reveals or rotates signing keys. ## Content: templates, snippets, preview, lint, test send Templates: GET|POST /v1/template, GET|PUT|DELETE /v1/template/{id} (/v1/templates is the same). PUT replaces the whole template; a body part left out is removed. A change of subject or bodies is kept as a version: GET /v1/template/{id}/versions, GET .../versions/{versionId}, POST .../versions/{versionId}/rollback (restores that content as a new version; the newest 50 are kept). Snippets: GET|POST /v1/snippets {"name":"footer","html":"

...

","text":"..."}, GET|PUT|DELETE /v1/snippets/{id}. Include one in a template body by name: {{> footer}}. In htmlContent the snippet's html is inserted, in textContent its text. Snippets are expanded before placeholders, so a snippet can carry {{placeholders}} and include other snippets, 3 levels deep. Not allowed in the subject. A send whose template includes a snippet that does not exist, or lacks the part it is included in, is refused whole (400 UNKNOWN_SNIPPET with "snippets", SNIPPET_PART_MISSING). Editing a snippet changes every template that includes it from the next send; renaming it breaks them. Check before sending (full access, nothing is sent): - POST /v1/email-previews {"templateId" | "designId" | "subject","html","text", "substitutionData":{...}} → the rendered subject, html, text, plus placeholders, missing, snippets, unknownSnippets, problems and complete (true: content would not be refused). POST /v1/template/{id}/preview {"substitutionData"} is the same for one template. - POST /v1/email-checks/lint (same input, plus "marketing": true to require a way to unsubscribe) → issues (errors) and warnings, each {code, severity, part, message, items}. Fixed checks on the content: missing subject or text part, unbalanced braces, unknown snippets, placeholders without a value (only when substitutionData is given), images without alt, links that are not http(s), html above 102,400 bytes, script and form tags. No spam score. - POST /v1/template/validate {"subject","html","text"} → {valid, errors, warnings} for content about to be stored. POST /v1/email-testing/send-test (a sending key may call it) renders the same input and sends it in sandbox mode: "to" is 1–5 addresses and defaults to the account login email, which is the only address sandbox reaches; it counts against the sandbox limits. Static HTML analysis (full access, no sending): POST /v1/email-testing/code-analysis or /v1/email-testing/accessibility with {"html":"..."} saves bounded lexical findings. GET the same collection lists results; GET .../{id} reads one. At most 100,000 UTF-8 bytes of HTML and 100 returned findings; totalIssues and truncated describe overflow. Only content hash and findings are stored, for seven days, at most 1,000 active results per workspace. score is null and conformance is not_assessed: there is no client rendering, computed contrast, inbox prediction or full WCAG assessment. MCP: analyse_email_html, get_email_analysis, list_email_analyses, with kind code-analysis or accessibility. Designs (GET|POST /v1/designs, GET|PUT|DELETE /v1/designs/{id}, POST /v1/designs/{id}/duplicate) are stored drafts {name, subject, htmlContent, textContent, category}. They can be previewed, linted and test-sent by designId. A transmission cannot use one: copy it into a template. ## Contacts Contacts are stored per account and matched by email. Storing contacts sends nothing. Fields: email, name; the standard fields firstname, lastname, phone, city, country, company, note, gender ("MALE" or "FEMALE"), dayOfBirth (YYYY-MM-DD); customField {name: text, number or true/false} (names: letters, digits, space, _ and -; at most 30 per contact); labels [names]; state ACTIVE or UNSUBSCRIBED. curl -X POST 'https://api.lewat.email/v1/contacts/import?labels=Customers' -H 'Authorization: Bearer le_live_...' -H 'Content-Type: text/csv' --data-binary @contacts.csv curl -X POST https://api.lewat.email/v1/contacts/import -H 'Authorization: Bearer le_live_...' -H 'Content-Type: application/json' -d '{"labels":["Customers"],"contacts":[{"email":"a@example.com","name":"A","city":"Solo","customField":{"plan":"pro"}}]}' Import: up to 1000 contacts per call; split larger files and call again. data reports created, updated, duplicatesInRequest, invalid rows (with the row number and reason), total and importId; valid rows are saved even when some rows are invalid. An import only adds: fields it does not mention keep their value, custom fields are merged. CSV column mapping (header row required, any letter case): email (also "e-mail", "email address") is required; name (also "nama", "full name"); a column named after a standard field fills it; labels holds comma-separated label names; state is ACTIVE or UNSUBSCRIBED; id, createdAt and updatedAt are skipped, so an exported file imports again; every other column becomes a custom field, and "customField.city" forces a custom field that shares a standard name. PUT /v1/contacts/{id or email}: fields left out keep their value; a standard field sent as "" is cleared; customField and labels, when sent, replace the whole set; "email" moves the contact (409 CONFLICT if taken). Custom field types: once a custom field has a definition (see below), a value that does not fit is refused: the import row lands in invalid, PUT answers 400 CUSTOM_FIELD_TYPE_MISMATCH with "field" and "expected". Text that plainly is the type ("42", "true") is converted. Search: POST /v1/contacts/find with a JSON body of filters, all optional and combined with AND: q (part of email or name), state, label, labels + labelsMatch "any"|"all", any standard field or customField {name: value} (exact, ignoring case), createdFrom, createdTo; plus sort (createdAt, updatedAt, email, name), order (asc, desc), page, perPage. An unknown filter is 400, not an empty result. GET /v1/contacts takes ?q, ?label, ?state only. POST /v1/contacts/count {"label","q","state"} → {total}. Bulk operations take {"contacts":[ids or emails]} (at most 1000) or {"filter":{...}} (the find filters, at least one condition, at most 10000 matches), never both. Each runs as one transaction: a listed contact that does not exist (404 CONTACT_NOT_FOUND with notFound) or a selection over the cap (413 BULK_TOO_LARGE) changes nothing. - POST /v1/contacts/delete → {deleted} - POST /v1/contacts/unsubscribe, /v1/contacts/resubscribe → {matched, changed, state} - POST /v1/labels/append, /v1/labels/remove with "labels":[1–20 names] → {matched, labels, added | removed}. Append creates missing labels. Export: POST /v1/contacts/export with the find filters at the top level of the body → text/csv with the import's columns. One response holds at most 10000 rows; above that it answers 413 EXPORT_TOO_LARGE with "pages": send "page": 1..pages. Headers X-Total-Count, X-Export-Page, X-Export-Pages. Less often: GET /v1/contacts/fields (standard and custom fields in use, with contactCount; ?search=), GET /v1/contacts/fields/values?field=city (or customField.plan), POST /v1/contacts/fields/rename {"name","newName"} and /fields/delete {"name"} act on a custom field of every contact. GET /v1/contacts/{id or email}/activity lists what was sent to the contact. GET /v1/contacts/import/history and /import/{id} show past imports. Labels: GET|POST /v1/labels, GET /v1/labels/{name or id}, PUT /v1/labels/{name} {"name":"New"}, DELETE /v1/labels/{names} (comma-separated; contacts are kept), GET /v1/labels/count?labels=A,B. ## Keep contacts in sync (integrations) Instead of uploading a file each time, point us at the source and we pull it every hour: curl -X POST https://api.lewat.email/v1/integrations -H 'Authorization: Bearer le_live_...' -H 'Content-Type: application/json' -d '{"name":"Customers sheet","provider":"google_sheets","config":{"url":"https://docs.google.com/spreadsheets/d/.../edit","labels":["Customers"]}}' - provider "google_sheets": any link to the sheet. It must be shared as "Anyone with the link: Viewer"; otherwise the answer is 422 SOURCE_NOT_SHARED. - provider "csv_url": any public https URL that returns CSV. - Same rules as CSV import: a header row with an email column; other columns become custom fields; matched by email. - The first sync runs during the POST and is returned in data.firstSync, so a wrong link is reported at once. POST /v1/integrations/{id}/sync runs it again on demand. data.lastStatus, lastError and lastResult show the latest run. - Removing rows from the source does not delete contacts. After five failed syncs in a row the integration turns itself off (active: false); fix the source and PUT {"active": true}. ## Segments, mailing lists, custom fields Segment: a saved filter over contacts. Membership is computed when asked; there is nothing to refresh. POST /v1/segments {"name":"Active Jakarta buyers","match":"all","rules":[ {"field":"state","operator":"equals","value":"ACTIVE"}, {"field":"labels","operator":"has_any","value":["Customers","VIP"]}, {"match":"any","rules":[{"field":"kota","operator":"equals","value":"Jakarta"},{"field":"email","operator":"domain","value":"example.co.id"}]}, {"field":"createdAt","operator":"in_last_days","value":90}]} - A rule is a condition {field, operator, value} or a group {match, rules}. match is "all" (default) or "any". At most 25 conditions, 3 levels, 20 values in one condition. - email: equals, not_equals, contains, not_contains, starts_with, ends_with, domain, not_domain - name: the six text operators, exists, not_exists - state: equals, not_equals with "ACTIVE" or "UNSUBSCRIBED" - labels: has_any, has_all, has_none with a label name or a list (the label must exist) - createdAt, updatedAt: before, after, between [from, to], in_last_days N. Dates are YYYY-MM-DD (00:00 UTC) or ISO 8601 with a zone. - a custom field, by its name or as customField.: the text operators, exists, not_exists, greater_than, greater_or_equal, less_than, less_or_equal (a number or a date), before, after, between - The standard fields other than email and name (city, phone, ...) cannot be used in a rule: "city" there means the custom field named city. Opens, clicks, campaign history and purchases are not kept: 400 SEGMENT_CONDITION_UNAVAILABLE. A rule that is wrong is 400 INVALID_SEGMENT_RULE with "rule" naming it, e.g. rules[2].rules[0]. - PUT /v1/segments/{id} changes only the fields sent. GET /v1/segments/{id}/contacts pages the matches. GET /v1/segments/{id}/count-recipient → {contactCount, recipientCount}: recipientCount leaves out UNSUBSCRIBED contacts and suppressed addresses. Mailing list: a fixed set of addresses with data per member, separate from contacts and labels. A list has no address that receives mail, and storing members sends nothing. POST /v1/mailing-lists {"name","description"}; PUT changes only the fields sent. Members: POST /v1/mailing-lists/{id}/members {"email","name","vars":{...},"subscribed":true} (409 CONFLICT if already a member), POST .../members/bulk {"members":[...]} (up to 1000; existing addresses are skipped; → {added, skipped, invalid}), GET .../members?subscribed=true|false, GET|PUT|DELETE .../members/{email} (PUT changes name, vars, subscribed; vars is replaced as a whole). Custom field definitions: POST /v1/custom-fields {"name":"plan","fieldType":"text"|"number"|"boolean"|"date"}. Optional: a custom field without a definition accepts any text, number or true/false. With one, contact writes are checked (see Contacts). Stored values are never rewritten; GET /v1/custom-fields/{id} shows contactCount and mismatchedCount. PUT changes only the fields sent; renaming a definition whose name is in use is 409 CUSTOM_FIELD_IN_USE. DELETE removes the definition, not the values. ## Suppression, unsubscribes, bounces Three separate records: - Suppression list: addresses no live send goes to, transactional included. POST /v1/transmissions checks this list and nothing else. A hard bounce adds the address automatically. GET /v1/suppressions, GET /v1/suppressions/bounces, GET /v1/suppressions/lookup?email=, POST /v1/suppressions {"email"}, POST /v1/suppression {"emails":[{"email","reason":"manual"|"bounce"|"complaint"|"unsubscribe"}]} (up to 1000; one invalid entry adds nothing), DELETE /v1/suppressions/{id or email}. - Unsubscribes: who asked to stop marketing mail. POST /v1/unsubscribes {"email","reason","groupId"}: without groupId it is account-wide and sets the contact to UNSUBSCRIBED; with groupId it applies to that unsubscribe group. GET /v1/unsubscribes?search=&groupId= (groupId=none: account-wide only). DELETE /v1/unsubscribes/{email} removes the account-wide one and sets the contact ACTIVE again. Unsubscribes are not applied to POST /v1/transmissions: you decide what is marketing mail and leave these addresses out (segment recipientCount already does). - Unsubscribe groups: GET|POST /v1/unsubscribe-groups {"name","description"}, GET|PUT|DELETE /v1/unsubscribe-groups/{id} (PUT replaces both fields; DELETE also deletes the unsubscribes in the group), GET|POST /v1/unsubscribe-groups/{id}/emails {"emails":["a@example.com"]} (up to 1000), DELETE .../emails/{email}. Unsubscribe links: https://api.lewat.email/u/{token} is public and signed. GET shows {email, groupId, group, unsubscribed} (an HTML page when the Accept header asks for text/html) and changes nothing; POST unsubscribes, and a mail client's one-click POST (List-Unsubscribe=One-Click) is recorded with origin "one_click". Links do not expire. No endpoint issues a link yet and transmissions do not add one. Bounces: GET /v1/bounces?type=hard|soft&transmissionId=&email= lists bounce events with suppressed (true while the address is blocked). Hard: the address does not exist, and it was suppressed. Soft: anything else, not suppressed. The receiving server's reason text is not stored. POST /v1/bounces/{id}/reactivate lifts the suppression that bounce caused (409 NOT_SUPPRESSED if there is none). ## Privacy requests POST /v1/privacy-requests {"type","email"} about one address in this account. Each request completes inside the call; GET /v1/privacy-requests/{id} reads its record. - "access" (200): data.export holds the contact, labels, suppression, first live send and the messages sent to the address (subject and status; bodies are not stored). - "opt_out" (202): suppresses the address and sets its contact to UNSUBSCRIBED. - "erasure" (202): deletes the contact and replaces the address with a placeholder everywhere else it is kept, so counts stay correct. It cannot be reversed. The suppression entry is kept unless "removeSuppression": true. - Erasure dry run: add "dryRun": true (200). Nothing changes; data.wouldAffect counts what would be touched and data.blockedBy says why it would be refused: cannot_erase_login_email, or erasure_blocked_pending_send while a message to the address is queued (the real call answers 409 with those codes). POST /v1/data-erasure/jobs {"email"} and GET /v1/data-erasure/jobs/{id} are the erasure-only form of the same operation. ## Account and security - GET /v1/account, GET /v1/user/profile, PATCH /v1/user/profile {"workspaceName"}, GET /v1/billing/plan (free plan; paid plans are not open). - Login email: PATCH /v1/user/email {"email","currentPassword"} mails a code to the new address and changes nothing (202); PATCH {"email","code"} switches it. Password: PATCH /v1/user/password {"currentPassword","newPassword"}. Existing API keys keep working after both; five password checks per 10 minutes. - IP allowlist: POST /v1/ip-access {"ip":"203.0.113.50","note":"office"}; single IPv4 addresses, no ranges. With no rules the account is not restricted. With rules, every authenticated call from another address, MCP included, is 403 IP_NOT_ALLOWED with yourIp. A change that would leave a list without the caller's own address is 409 IP_LOCKOUT_GUARD; deleting the last rule lifts the restriction. Signup, login, password reset and the public unsubscribe link are not restricted. - GET /v1/audit-logs?action=create|update|delete&resource= lists recorded account events. - GET /v1/status (no key): operational, degraded or down. Recover an account: POST /auth/reset with email requests a code. The response is generic; repeated requests are limited. POST /auth/reset/confirm with email, code and a new password changes the password atomically. Existing integration keys stay valid. Store data.apiKey if returned. If all 10 key slots are occupied, password reset still succeeds and returns data.recoveryToken with a 15-minute expiry instead of a new API key. Keep it private. Use it as Bearer for GET /auth/recovery/api-keys, choose a key the user wants revoked, then DELETE /auth/recovery/api-keys/{id}. Finally POST /auth/login with the new password. The recovery token cannot send mail, create keys, or access ordinary API/MCP routes. Never revoke an integration key without the user's choice. ## MCP tools Same key and the same data as REST; a failed tool call returns the error envelope as its result. A sending key sees only the first group. - Sending key: get_account, simulate_send, send_email, send_test_email, get_email_status, get_message_status, list_messages, get_queue_status, get_quotas - Account and domains: get_usage, list_domains, add_domain, get_domain_status, list_senders, save_sender - Delivery: get_stats, list_bounces, schedule_email, list_scheduled_emails, get_scheduled_email, reschedule_email, cancel_scheduled_email, create_email_batch, list_email_batches, get_email_batch, start_email_batch, cancel_email_batch, list_webhooks, add_webhook, get_webhook_status, test_webhook - Content: list_templates, get_template, save_template, list_snippets, get_snippet, save_snippet, preview_email, lint_email, analyse_email_html, get_email_analysis, list_email_analyses - Contacts: import_contacts, list_contacts, search_contacts, get_contact, update_contact, get_contact_activity, list_contact_fields, list_labels, add_labels_to_contacts, list_integrations, add_integration, sync_integration - Audiences: list_segments, save_segment, list_segment_contacts, count_segment_recipients, list_mailing_lists, save_mailing_list, list_mailing_list_members, add_mailing_list_members, update_mailing_list_member, list_custom_fields, save_custom_field - Consent: list_unsubscribes, add_unsubscribe, list_unsubscribe_groups, save_unsubscribe_group, block_recipients, privacy_request save_* tools create when id is omitted and change the object when id is given. block_recipients adds to the suppression list. privacy_request does access, opt_out and the erasure dry run only. REST only, with a full-access key, by design: creating or revoking API keys; reading or rotating webhook signing keys; changing the login email or password; the IP allowlist; every DELETE; bulk contact delete, unsubscribe, resubscribe, label removal and export; renaming or deleting a custom field across contacts; removing a suppression or an unsubscribe; reactivating a bounce; setting a contact or list member back to subscribed; real erasure; template rollback. Also REST only, because an agent rarely needs them: designs, template versions, the events and message-log lists, the audit log, import history, field values, creating or renaming a label, reading the suppression list. ## Limits - Monthly quota per account (GET /v1/quotas). A request larger than what is left is rejected whole; nothing is sent. - New accounts: 10 different recipients in the first 24 hours of live sending, then a daily cap that rises with account age. - Sandbox has its own small daily and monthly limits. - Requests per key per minute: see the X-RateLimit-* headers. - Per account, by default: 5000 contacts, 100 templates, 100 snippets, 100 designs, 100 segments, 100 custom field definitions, 50 mailing lists of 5000 members, 50 senders, 50 unsubscribe groups, 50 IP rules, 5 integrations, 5 webhooks, 10 active keys. Reaching one is 403 _LIMIT_REACHED and nothing is created. ## Errors 409 MARKETING_CONSENT_LOST permission or workflow changed before admission; refresh state and do not force retry 409 ANALYSIS_LIMIT_REACHED 1000 unexpired analysis results; results expire after seven days 409 INBOUND_REPLY_TARGET_LOST source message/thread was deleted before admission; nothing was queued 400 INVALID_REQUEST_BODY a field is missing, wrong or not part of the request (also 415 for a wrong Content-Type); fix it, do not retry unchanged 400 INVALID_QUERY, INVALID_DATE_FORMAT, INVALID_DATE_RANGE a query parameter is wrong; ranges cover at most 92 days 400 INVALID_FROM sandbox sends must use the sandbox from address 400 MISSING_SUBSTITUTION_DATA the template needs values listed in "missing" 400 UNKNOWN_SNIPPET, SNIPPET_PART_MISSING, SNIPPET_IN_SUBJECT, SNIPPET_DEPTH_EXCEEDED, TOO_MANY_SNIPPETS, CONTENT_TOO_LARGE the content's {{> snippet}} includes cannot be resolved; nothing sent 400 CONTENT_REQUIRED preview, lint and validate need content, a templateId or a designId 400 INVALID_SEGMENT_RULE, SEGMENT_CONDITION_UNAVAILABLE "rule" names the condition; the second is data we do not keep 400 CUSTOM_FIELD_TYPE_MISMATCH, INVALID_FIELD_TYPE "field" and "expected" say which value does not fit its definition 400 NAME_REQUIRED, INVALID_NAME, EMAIL_REQUIRED, TYPE_REQUIRED, ID_REQUIRED, IP_REQUIRED, INVALID_IP_FORMAT, DUPLICATE_IP, INVALID_TYPE that one field is missing or malformed 400 DOMAIN_NOT_ALLOWED this domain cannot be added as a sending domain 400 INVALID_VERIFICATION, INVALID_RESET wrong or expired code; request a new one 401 UNAUTHORIZED key missing, wrong or revoked 401 INVALID_CREDENTIALS · 403 EMAIL_NOT_VERIFIED · 403 INVALID_INVITE · 403 INVALID_CURRENT_PASSWORD sign-in and password problems 403 INSUFFICIENT_SCOPE, LIVE_KEY_REQUIRED this call needs a full-access key, or a live key 403 IP_NOT_ALLOWED the account has an IP allowlist and this address is not on it 403 DOMAIN_NOT_VERIFIED verify the from domain first 403 SANDBOX_RECIPIENT_NOT_ALLOWED sandbox only reaches the login email 403 ACCOUNT_PAUSED live sending is stopped after too many bounces; sandbox still works; do not retry 403 ACCOUNT_SUSPENDED the account is closed to all calls 403 *_LIMIT_REACHED the account holds its maximum of that object (see Limits); nothing was created 404 NOT_FOUND and *_NOT_FOUND wrong id or path, or another account's object 409 CONFLICT, SENDER_EXISTS, WEBHOOK_EXISTS the name or address is already in use 409 IDEMPOTENCY_CONFLICT same Idempotency-Key with a different body 409 KEY_LIMIT 10 active keys; revoke one first 409 ALREADY_STARTED, ALREADY_CANCELLED, WEBHOOK_INACTIVE the scheduled message, batch or webhook is past the state this call needs 409 CUSTOM_FIELD_IN_USE contacts hold values under that name; it cannot be renamed 409 IP_LOCKOUT_GUARD the change would lock out the caller; nothing was changed 409 CANNOT_ERASE_LOGIN_EMAIL, ERASURE_BLOCKED_PENDING_SEND, ERASURE_BLOCKED_PENDING_DEFERRED, ERASURE_BLOCKED_WORKFLOW_DATA erasure refused; nothing was erased (the second: retry after the queued message is sent) 409 NOT_SUPPRESSED nothing to reactivate for that bounce 413 PAYLOAD_TOO_LARGE, IMPORT_TOO_LARGE, BULK_TOO_LARGE, EXPORT_TOO_LARGE, TOO_MANY_ITEMS split the request; "max" says how much one call takes 422 ALL_RECIPIENTS_SUPPRESSED, NO_ELIGIBLE_TO_RECIPIENT every recipient, or every To recipient, is suppressed; nothing sent 422 SOURCE_NOT_SHARED, SOURCE_UNREACHABLE, SOURCE_TOO_LARGE the integration source cannot be read as it is 429 QUOTA_EXCEEDED monthly quota used up until the month resets; upgradeUrl says whether paid plans are open (not yet) 429 DAILY_LIMIT_REACHED, NEW_ACCOUNT_LIMIT, SANDBOX_LIMIT_REACHED, TOO_MANY_REQUESTS wait retryAfterSeconds 429 TOO_MANY_ATTEMPTS, EMAIL_CHANGE_LIMITED, WEBHOOK_TEST_LIMITED, DEFERRED_LIMIT too many codes, checks, tests or pending jobs; wait, or cancel pending jobs 500 INTERNAL_SERVER_ERROR our fault; retry later with the same Idempotency-Key 502 SEND_FAILED not sent, no quota used; safe to retry 502 SEND_UNCERTAIN may have been sent and quota stays reserved. The same Idempotency-Key returns this transmission again and never sends twice; send again with a new key only if a duplicate is acceptable 502 SYNC_FAILED the integration source could not be synced; try again later 503 PLATFORM_CAPACITY our capacity, not your quota; wait retryAfterSeconds 503 SERVICE_UNAVAILABLE, SIMULATION_UNAVAILABLE, QUEUE_UNAVAILABLE, WEBHOOKS_UNAVAILABLE temporarily unavailable; retry later ## For agents - Confirm the recipient with the user before sending live email. - Never invent DNS values: read them from GET /v1/domain/sending. - Do not create extra accounts to get around a limit. - Deleting, erasing, unblocking and re-subscribing are the account owner's decisions: ask before calling those REST endpoints.