{"openapi":"3.0.3","info":{"title":"SarabMail API","version":"0.1.0","description":"Create temporary inboxes on the mail-domain pool and read mail that arrives for them. sarabmail.com is the website, not a disposable mail domain. SarabMail does not send email. API Free allows 100 emails received a month, 50 inbox creations a month, and 5 concurrent inboxes. This API does not send CORS headers; call it from your server.","contact":{"name":"SarabMail","email":"support@sarabmail.com","url":"https://sarabmail.com"},"license":{"name":"Proprietary","url":"https://sarabmail.com/en/legal/terms"},"x-logo":{"url":"https://sarabmail.com/apple-icon","altText":"SarabMail"}},"servers":[{"url":"https://sarabmail.com/api/v1"}],"tags":[{"name":"Keys","description":"Create a free API key. The secret is returned once."},{"name":"Inboxes","description":"Create and read temporary inboxes for the current key."},{"name":"Messages","description":"Read, wait for, and delete mail in an inbox."},{"name":"Webhooks","description":"Receive message.received events on plans that include webhooks."},{"name":"Domains","description":"List mail domains and add a custom domain or private subdomain."},{"name":"Billing","description":"Read usage and start Paddle checkout for a paid plan."}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","bearerFormat":"sm_live","description":"API key secret, sent as Authorization: Bearer sm_live_…. SarabMail stores only a SHA-256 hash. If X-Api-Key is also present, that header is used instead."},"apiKey":{"type":"apiKey","in":"header","name":"X-Api-Key","description":"Same sm_live_… secret as the bearer token. This header is preferred when both are sent."}},"parameters":{"inboxId":{"name":"id","in":"path","required":true,"description":"Inbox id returned when the inbox was created.","schema":{"type":"string"}},"messageId":{"name":"messageId","in":"path","required":true,"description":"Message id.","schema":{"type":"string"}},"attachmentId":{"name":"attachmentId","in":"path","required":true,"description":"Attachment id from the message detail.","schema":{"type":"string"}}},"headers":{"RateLimitLimit":{"description":"Requests this key may make per minute.","schema":{"type":"integer"}},"RateLimitRemaining":{"description":"Requests remaining in the current minute.","schema":{"type":"integer"}},"RateLimitReset":{"description":"Unix time in seconds when the current minute window resets.","schema":{"type":"integer"}},"RetryAfter":{"description":"Seconds to wait before retrying. 429 responses send 60.","schema":{"type":"integer"}}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}}}}},"Plan":{"type":"object","required":["id","audience","monthlyPriceUsd","ads","rateLimitPerMinute","monthlyInboxQuota","maxConcurrentInboxes","maxTtlMinutes","allowPermanent","allowWebhooks","allowCustomDomains","maxCustomDomains","allowPrivateSubdomain","maxPrivateSubdomains","allowForwarding","domainPools"],"properties":{"id":{"type":"string","enum":["free","plus","pro","api_free","starter","team","business","enterprise"]},"audience":{"type":"string","enum":["consumer","api"]},"monthlyPriceUsd":{"type":"number"},"annualPriceUsd":{"type":"number","nullable":true},"annualMonthlyUsd":{"type":"number","nullable":true},"ads":{"type":"boolean"},"rateLimitPerMinute":{"type":"integer"},"monthlyInboxQuota":{"type":"integer"},"monthlyEmailQuota":{"type":"integer","nullable":true},"maxConcurrentInboxes":{"type":"integer"},"maxTtlMinutes":{"type":"integer"},"allowPermanent":{"type":"boolean"},"allowWebhooks":{"type":"boolean"},"allowCustomDomains":{"type":"boolean"},"maxCustomDomains":{"type":"integer"},"allowPrivateSubdomain":{"type":"boolean"},"maxPrivateSubdomains":{"type":"integer"},"allowForwarding":{"type":"boolean"},"domainPools":{"type":"array","items":{"type":"string","enum":["public_free","premium_pool","api_only","custom"]}}}},"Inbox":{"type":"object","required":["id","address","localPart","domain","expiresAt","isPermanent","createdAt","forwardTo"],"properties":{"id":{"type":"string"},"address":{"type":"string","example":"quiet-dune@example.com"},"localPart":{"type":"string"},"domain":{"type":"string"},"expiresAt":{"type":"string","format":"date-time"},"isPermanent":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"forwardTo":{"type":"string","nullable":true}}},"Message":{"type":"object","required":["id","fromAddress","fromName","subject","preview","receivedAt","attachmentCount"],"properties":{"id":{"type":"string"},"fromAddress":{"type":"string"},"fromName":{"type":"string","nullable":true},"subject":{"type":"string"},"preview":{"type":"string"},"receivedAt":{"type":"string","format":"date-time"},"attachmentCount":{"type":"integer"}}},"Attachment":{"type":"object","required":["id","filename","contentType","size"],"properties":{"id":{"type":"string"},"filename":{"type":"string"},"contentType":{"type":"string"},"size":{"type":"integer"}}},"MessageDetail":{"type":"object","required":["id","fromAddress","fromName","toAddress","subject","textBody","htmlBody","receivedAt","remoteImagesBlocked","attachments"],"properties":{"id":{"type":"string"},"fromAddress":{"type":"string"},"fromName":{"type":"string","nullable":true},"toAddress":{"type":"string"},"subject":{"type":"string"},"textBody":{"type":"string","nullable":true},"htmlBody":{"type":"string","nullable":true},"receivedAt":{"type":"string","format":"date-time"},"remoteImagesBlocked":{"type":"integer"},"attachments":{"type":"array","items":{"$ref":"#/components/schemas/Attachment"}}}},"Domain":{"type":"object","required":["name","status","visibility","verificationStatus","owned","privateSubdomain","addedAt"],"properties":{"name":{"type":"string"},"status":{"type":"string","enum":["active","retiring","blocked","disabled"]},"visibility":{"type":"string","enum":["public_free","premium_pool","api_only","custom"]},"verificationStatus":{"type":"string","enum":["pending","verified"]},"owned":{"type":"boolean"},"privateSubdomain":{"type":"boolean"},"addedAt":{"type":"string","format":"date-time"}}},"DnsInstructions":{"type":"object","required":["txt","cloudflare","vps"],"properties":{"txt":{"type":"object","nullable":true,"required":["type","host","value"],"properties":{"type":{"type":"string","enum":["TXT"]},"host":{"type":"string"},"value":{"type":"string"}}},"cloudflare":{"type":"string"},"vps":{"type":"string"}}}}},"security":[{"bearer":[]},{"apiKey":[]}],"paths":{"/keys":{"post":{"operationId":"createApiKey","tags":["Keys"],"summary":"Create a free API key","description":"Mints an API Free key. The `key` field is the secret and is shown only in this response. Creation is limited to five keys an hour for each network. No API key is required.","security":[],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"Label stored with the key. Defaults to Untitled key."}}}}}},"responses":{"201":{"description":"Key created. Copy `key` now.","content":{"application/json":{"schema":{"type":"object","required":["id","name","key","prefix","tier","limits"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"key":{"type":"string","description":"Full secret, sm_live_…, returned once."},"prefix":{"type":"string"},"tier":{"type":"string","enum":["api_free"]},"limits":{"$ref":"#/components/schemas/Plan"}}}}}},"429":{"description":"This network created five keys in the last hour. `error.code` is `rate_limited`.","headers":{"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure. `error.code` is `internal`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/inboxes":{"get":{"operationId":"listInboxes","tags":["Inboxes"],"summary":"List inboxes for the current key","description":"Returns up to 100 active inboxes. Expired inboxes are omitted.","responses":{"200":{"description":"Active inboxes.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}},"content":{"application/json":{"schema":{"type":"object","required":["inboxes"],"properties":{"inboxes":{"type":"array","items":{"$ref":"#/components/schemas/Inbox"}}}}}}},"401":{"description":"Missing, unknown, or revoked API key. `error.code` is `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The key exceeded its per-minute request limit. `error.code` is `rate_limited`. Retry-After is 60 seconds.","headers":{"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure. `error.code` is `internal`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createInbox","tags":["Inboxes"],"summary":"Create an inbox","description":"An empty body mints a random address on a domain the plan can use. sarabmail.com is never used. ttlMinutes is rejected when it is longer than the plan allows.","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"localPart":{"type":"string","description":"3–32 letters, numbers, dots, or hyphens."},"domain":{"type":"string"},"ttlMinutes":{"type":"integer","minimum":1,"maximum":200000},"permanent":{"type":"boolean"},"forwardTo":{"type":"string","description":"Real inbox to forward to. Requires a plan with forwarding."}}}}}},"responses":{"201":{"description":"Inbox created.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}},"content":{"application/json":{"schema":{"type":"object","required":["inbox"],"properties":{"inbox":{"$ref":"#/components/schemas/Inbox"}}}}}},"400":{"description":"The body or address is not usable. `error.code` is `invalid`, `reserved`, `unknown_domain`, `brand_domain`, `domain_unavailable`, or `domain_unverified`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, or revoked API key. `error.code` is `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The plan does not allow this inbox. `error.code` is `premium_domain`, `permanent_not_allowed`, `ttl_too_long`, `inbox_limit`, `monthly_quota`, `custom_domain_not_allowed`, `subdomain_not_allowed`, or `forwarding_not_allowed`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"That address is already in use. `error.code` is `taken`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The key exceeded its per-minute request limit. `error.code` is `rate_limited`. Retry-After is 60 seconds.","headers":{"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure. `error.code` is `internal`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/inboxes/{id}":{"parameters":[{"$ref":"#/components/parameters/inboxId"}],"get":{"operationId":"getInbox","tags":["Inboxes"],"summary":"Read an inbox","responses":{"200":{"description":"The inbox.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}},"content":{"application/json":{"schema":{"type":"object","required":["inbox"],"properties":{"inbox":{"$ref":"#/components/schemas/Inbox"}}}}}},"401":{"description":"Missing, unknown, or revoked API key. `error.code` is `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No inbox with this id belongs to the key. `error.code` is `not_found`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"The inbox existed and has expired. `error.code` is `expired`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The key exceeded its per-minute request limit. `error.code` is `rate_limited`. Retry-After is 60 seconds.","headers":{"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure. `error.code` is `internal`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"setInboxForwarding","tags":["Inboxes"],"summary":"Set or clear forwarding","description":"Send `{ \"forwardTo\": null }` to stop forwarding. A destination must be outside the mail pool.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"forwardTo":{"type":"string","nullable":true}}}}}},"responses":{"200":{"description":"Updated inbox.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}},"content":{"application/json":{"schema":{"type":"object","required":["inbox"],"properties":{"inbox":{"$ref":"#/components/schemas/Inbox"}}}}}},"400":{"description":"The destination is missing or still inside the mail pool. `error.code` is `invalid_forward`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, or revoked API key. `error.code` is `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"This plan cannot forward mail. `error.code` is `forwarding_not_allowed`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No inbox with this id belongs to the key. `error.code` is `not_found`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"The inbox existed and has expired. `error.code` is `expired`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The key exceeded its per-minute request limit. `error.code` is `rate_limited`. Retry-After is 60 seconds.","headers":{"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure. `error.code` is `internal`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteInbox","tags":["Inboxes"],"summary":"Delete an inbox","description":"Deletes the inbox, its messages, and stored attachments.","responses":{"200":{"description":"Deleted.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}},"content":{"application/json":{"schema":{"type":"object","required":["deleted"],"properties":{"deleted":{"type":"boolean","enum":[true]}}}}}},"401":{"description":"Missing, unknown, or revoked API key. `error.code` is `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No inbox with this id belongs to the key. `error.code` is `not_found`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"The inbox existed and has expired. `error.code` is `expired`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The key exceeded its per-minute request limit. `error.code` is `rate_limited`. Retry-After is 60 seconds.","headers":{"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure. `error.code` is `internal`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/inboxes/{id}/messages":{"parameters":[{"$ref":"#/components/parameters/inboxId"}],"get":{"operationId":"listMessages","tags":["Messages"],"summary":"List messages","parameters":[{"name":"limit","in":"query","required":false,"description":"How many recent messages to return. Defaults to 50 and is clamped between 1 and 100.","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}}],"responses":{"200":{"description":"Newest messages first.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}},"content":{"application/json":{"schema":{"type":"object","required":["messages"],"properties":{"messages":{"type":"array","items":{"$ref":"#/components/schemas/Message"}}}}}}},"401":{"description":"Missing, unknown, or revoked API key. `error.code` is `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No inbox with this id belongs to the key. `error.code` is `not_found`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"The inbox existed and has expired. `error.code` is `expired`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The key exceeded its per-minute request limit. `error.code` is `rate_limited`. Retry-After is 60 seconds.","headers":{"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure. `error.code` is `internal`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/inboxes/{id}/messages/wait":{"parameters":[{"$ref":"#/components/parameters/inboxId"}],"get":{"operationId":"waitForMessage","tags":["Messages"],"summary":"Long-poll for a new message","description":"Holds the request until a message newer than `after` arrives, or until the timeout. The timeout cannot exceed the server cap (8 seconds unless configured lower).","parameters":[{"name":"timeout","in":"query","required":false,"description":"Seconds to wait. Values above the server cap are reduced to the cap.","schema":{"type":"number"}},{"name":"after","in":"query","required":false,"description":"ISO timestamp. Messages received at or before this time are ignored.","schema":{"type":"string","format":"date-time"}},{"name":"images","in":"query","required":false,"description":"Pass 1 to leave remote images in the HTML. Otherwise they are removed.","schema":{"type":"string","enum":["1"]}}],"responses":{"200":{"description":"A message, or null when the timer ended first.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}},"content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"object","nullable":true,"allOf":[{"$ref":"#/components/schemas/MessageDetail"}],"description":"Null when the timer ends before a new message arrives."}}}}}},"400":{"description":"`after` is not an ISO timestamp. `error.code` is `invalid`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, or revoked API key. `error.code` is `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No inbox with this id belongs to the key. `error.code` is `not_found`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"The inbox existed and has expired. `error.code` is `expired`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The key exceeded its per-minute request limit. `error.code` is `rate_limited`. Retry-After is 60 seconds.","headers":{"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure. `error.code` is `internal`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/inboxes/{id}/events":{"parameters":[{"$ref":"#/components/parameters/inboxId"}],"get":{"operationId":"streamInboxEvents","tags":["Messages"],"summary":"Server-sent events for new messages","description":"A short text/event-stream. Events are `ready` (`{ holdMs }`), `inbox` (`{ messages }` summaries), `bye`, and `error` (`{ message: \"stream_failed\" }`). The hold cannot exceed the server cap.","parameters":[{"name":"since","in":"query","required":false,"description":"ISO timestamp. The first inbox event still includes the current list; later events fire when a newer message arrives.","schema":{"type":"string","format":"date-time"}},{"name":"timeout","in":"query","required":false,"description":"Seconds to hold the stream. Values above the server cap are reduced to the cap.","schema":{"type":"number"}}],"responses":{"200":{"description":"Event stream. This response does not include the rate-limit headers.","content":{"text/event-stream":{"schema":{"type":"string"}}}},"400":{"description":"`since` is not an ISO timestamp. `error.code` is `invalid`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, or revoked API key. `error.code` is `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No inbox with this id belongs to the key. `error.code` is `not_found`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"The inbox existed and has expired. `error.code` is `expired`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The key exceeded its per-minute request limit. `error.code` is `rate_limited`. Retry-After is 60 seconds.","headers":{"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure. `error.code` is `internal`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/inboxes/{id}/messages/{messageId}":{"parameters":[{"$ref":"#/components/parameters/inboxId"},{"$ref":"#/components/parameters/messageId"}],"get":{"operationId":"getMessage","tags":["Messages"],"summary":"Read a message","description":"HTML is sanitized. Remote images stay blocked unless `images=1`.","parameters":[{"name":"images","in":"query","required":false,"description":"Pass 1 to leave remote images in the HTML.","schema":{"type":"string","enum":["1"]}}],"responses":{"200":{"description":"Message text, sanitized HTML, and attachment metadata.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}},"content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"$ref":"#/components/schemas/MessageDetail"}}}}}},"401":{"description":"Missing, unknown, or revoked API key. `error.code` is `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The inbox or the message was not found. `error.code` is `not_found`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"The inbox existed and has expired. `error.code` is `expired`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The key exceeded its per-minute request limit. `error.code` is `rate_limited`. Retry-After is 60 seconds.","headers":{"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure. `error.code` is `internal`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteMessage","tags":["Messages"],"summary":"Delete a message","description":"Deletes the message and its stored attachments.","responses":{"200":{"description":"Deleted.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}},"content":{"application/json":{"schema":{"type":"object","required":["deleted"],"properties":{"deleted":{"type":"boolean","enum":[true]}}}}}},"401":{"description":"Missing, unknown, or revoked API key. `error.code` is `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The inbox or the message was not found. `error.code` is `not_found`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"The inbox existed and has expired. `error.code` is `expired`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The key exceeded its per-minute request limit. `error.code` is `rate_limited`. Retry-After is 60 seconds.","headers":{"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure. `error.code` is `internal`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/inboxes/{id}/messages/{messageId}/attachments/{attachmentId}":{"parameters":[{"$ref":"#/components/parameters/inboxId"},{"$ref":"#/components/parameters/messageId"},{"$ref":"#/components/parameters/attachmentId"}],"get":{"operationId":"downloadAttachment","tags":["Messages"],"summary":"Download an attachment","description":"Returns the file bytes. Content-Type is the stored type, and Content-Disposition is attachment.","responses":{"200":{"description":"File bytes. This response does not include the rate-limit headers.","headers":{"Content-Disposition":{"description":"attachment; filename=\"…\"","schema":{"type":"string"}}},"content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"401":{"description":"Missing, unknown, or revoked API key. `error.code` is `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The inbox, message, or attachment was not found. `error.code` is `not_found`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"The inbox existed and has expired. `error.code` is `expired`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The key exceeded its per-minute request limit. `error.code` is `rate_limited`. Retry-After is 60 seconds.","headers":{"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure. `error.code` is `internal`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhook":{"put":{"operationId":"setWebhook","tags":["Webhooks"],"summary":"Set the key webhook","description":"Plans with webhooks can store one https URL. SarabMail posts JSON with event message.received. X-SarabMail-Signature is sha256=HMAC(secret, raw body). The signing secret is returned here and reused on later updates.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["url"],"properties":{"url":{"type":"string","format":"uri"}}}}}},"responses":{"200":{"description":"Webhook saved.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}},"content":{"application/json":{"schema":{"type":"object","required":["url","secret"],"properties":{"url":{"type":"string"},"secret":{"type":"string","description":"whsec_… signing secret."}}}}}},"400":{"description":"The URL is missing, not https, or not a public host. `error.code` is `invalid_url`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, or revoked API key. `error.code` is `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"This plan does not include webhooks. `error.code` is `webhooks_not_allowed`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The key exceeded its per-minute request limit. `error.code` is `rate_limited`. Retry-After is 60 seconds.","headers":{"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure. `error.code` is `internal`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteWebhook","tags":["Webhooks"],"summary":"Remove the webhook","description":"Clears the URL. The signing secret is left in place.","responses":{"200":{"description":"Webhook URL removed.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}},"content":{"application/json":{"schema":{"type":"object","required":["removed"],"properties":{"removed":{"type":"boolean","enum":[true]}}}}}},"401":{"description":"Missing, unknown, or revoked API key. `error.code` is `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The key exceeded its per-minute request limit. `error.code` is `rate_limited`. Retry-After is 60 seconds.","headers":{"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure. `error.code` is `internal`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/domains":{"get":{"operationId":"listDomains","tags":["Domains"],"summary":"List domains this key can use","responses":{"200":{"description":"Shared domains for the plan, plus domains owned by this key.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}},"content":{"application/json":{"schema":{"type":"object","required":["siteDomain","domains"],"properties":{"siteDomain":{"type":"string","enum":["sarabmail.com"]},"domains":{"type":"array","items":{"$ref":"#/components/schemas/Domain"}}}}}}},"401":{"description":"Missing, unknown, or revoked API key. `error.code` is `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The key exceeded its per-minute request limit. `error.code` is `rate_limited`. Retry-After is 60 seconds.","headers":{"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure. `error.code` is `internal`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"addCustomDomain","tags":["Domains"],"summary":"Add a custom domain","description":"Pro and Business can add a domain they own. It stays disabled until the TXT record is verified. Mail still needs Cloudflare Email Routing or an MX record.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","description":"A hostname such as mail.example.com."}}}}}},"responses":{"201":{"description":"Domain registered and waiting for TXT verification.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}},"content":{"application/json":{"schema":{"type":"object","required":["domain","dns"],"properties":{"domain":{"$ref":"#/components/schemas/Domain"},"dns":{"$ref":"#/components/schemas/DnsInstructions"}}}}}},"400":{"description":"The name is not a domain, or it is sarabmail.com. `error.code` is `invalid_domain` or `brand_domain`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, or revoked API key. `error.code` is `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"This plan cannot add a custom domain, or the private-domain limit is full. `error.code` is `custom_domain_not_allowed` or `domain_limit`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"That domain is already registered. `error.code` is `domain_taken`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The key exceeded its per-minute request limit. `error.code` is `rate_limited`. Retry-After is 60 seconds.","headers":{"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure. `error.code` is `internal`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/domains/verify":{"post":{"operationId":"verifyDomain","tags":["Domains"],"summary":"Check the domain TXT record","description":"Looks up TXT records for sarabmail-verify=…. A match marks the domain active.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"}}}}}},"responses":{"200":{"description":"Verification result. `verified` is false when the TXT record is missing.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}},"content":{"application/json":{"schema":{"type":"object","required":["verified","domain","dns"],"properties":{"verified":{"type":"boolean"},"domain":{"$ref":"#/components/schemas/Domain"},"dns":{"$ref":"#/components/schemas/DnsInstructions"}}}}}},"400":{"description":"The name is missing or has no verification token. `error.code` is `invalid_domain`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, or revoked API key. `error.code` is `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"This key does not own that custom domain. `error.code` is `not_found`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The key exceeded its per-minute request limit. `error.code` is `rate_limited`. Retry-After is 60 seconds.","headers":{"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure. `error.code` is `internal`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/domains/subdomain":{"post":{"operationId":"createPrivateSubdomain","tags":["Domains"],"summary":"Allocate a private subdomain on an API mail domain","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["label"],"properties":{"label":{"type":"string","description":"Short label such as acme."},"parent":{"type":"string","description":"Optional API mail domain. The default is the first active API domain."}}}}}},"responses":{"201":{"description":"Subdomain allocated.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}},"content":{"application/json":{"schema":{"type":"object","required":["domain","dns"],"properties":{"domain":{"$ref":"#/components/schemas/Domain"},"dns":{"$ref":"#/components/schemas/DnsInstructions"}}}}}},"400":{"description":"The label or parent domain cannot be used. `error.code` is `invalid_domain`, `unknown_domain`, or `brand_domain`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, or revoked API key. `error.code` is `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"This plan cannot allocate a subdomain, or the limit is full. `error.code` is `subdomain_not_allowed` or `domain_limit`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"That subdomain is already registered. `error.code` is `domain_taken`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The key exceeded its per-minute request limit. `error.code` is `rate_limited`. Retry-After is 60 seconds.","headers":{"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure. `error.code` is `internal`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/billing/checkout":{"post":{"operationId":"createCheckout","tags":["Billing"],"summary":"Start Paddle checkout when configured","description":"Creates a Paddle transaction for a paid plan and returns the checkout URL. Nothing is charged by this call. Free and API Free are rejected.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["planId"],"properties":{"planId":{"type":"string","enum":["plus","pro","starter","team","business","enterprise"]},"interval":{"type":"string","enum":["month","year"],"default":"month"},"locale":{"type":"string","enum":["en","ar"],"default":"en"}}}}}},"responses":{"200":{"description":"Paddle checkout session.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}},"content":{"application/json":{"schema":{"type":"object","required":["url","transactionId"],"properties":{"url":{"type":"string"},"transactionId":{"type":"string","nullable":true}}}}}},"400":{"description":"The plan id is missing, unknown, or free. `error.code` is `invalid_plan`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, or revoked API key. `error.code` is `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key belongs to a different signed-in account. `error.code` is `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The key exceeded its per-minute request limit. `error.code` is `rate_limited`. Retry-After is 60 seconds.","headers":{"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure. `error.code` is `internal`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"501":{"description":"Paddle is not configured for this plan. `error.code` is `billing_not_configured`. Nothing was charged.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Paddle did not return a checkout URL. `error.code` is `billing_failed`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/usage":{"get":{"operationId":"getUsage","tags":["Billing"],"summary":"Read plan usage","responses":{"200":{"description":"Current month of usage for this key.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}},"content":{"application/json":{"schema":{"type":"object","required":["tier","limits","activeInboxes","inboxesCreatedThisMonth","emailsReceivedThisMonth","requestsThisMonth","webhookConfigured","prefix","name"],"properties":{"tier":{"type":"string"},"limits":{"$ref":"#/components/schemas/Plan"},"activeInboxes":{"type":"integer"},"inboxesCreatedThisMonth":{"type":"integer"},"emailsReceivedThisMonth":{"type":"integer"},"requestsThisMonth":{"type":"integer"},"webhookConfigured":{"type":"boolean"},"prefix":{"type":"string"},"name":{"type":"string"}}}}}},"401":{"description":"Missing, unknown, or revoked API key. `error.code` is `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The key exceeded its per-minute request limit. `error.code` is `rate_limited`. Retry-After is 60 seconds.","headers":{"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure. `error.code` is `internal`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"x-sarabmail-plans":{"free":{"id":"free","audience":"consumer","monthlyPriceUsd":0,"annualPriceUsd":0,"annualMonthlyUsd":null,"ads":true,"maxTtlMinutes":60,"maxConcurrentInboxes":5,"monthlyInboxQuota":20,"monthlyEmailQuota":null,"rateLimitPerMinute":30,"allowPermanent":false,"allowWebhooks":false,"allowCustomDomains":false,"maxCustomDomains":0,"allowPrivateSubdomain":false,"maxPrivateSubdomains":0,"allowForwarding":false,"domainPools":["public_free"]},"plus":{"id":"plus","audience":"consumer","monthlyPriceUsd":3.99,"annualPriceUsd":29,"annualMonthlyUsd":null,"ads":false,"maxTtlMinutes":43200,"maxConcurrentInboxes":10,"monthlyInboxQuota":10,"monthlyEmailQuota":null,"rateLimitPerMinute":60,"allowPermanent":false,"allowWebhooks":false,"allowCustomDomains":false,"maxCustomDomains":0,"allowPrivateSubdomain":false,"maxPrivateSubdomains":0,"allowForwarding":false,"domainPools":["premium_pool","public_free"]},"pro":{"id":"pro","audience":"consumer","monthlyPriceUsd":7.99,"annualPriceUsd":59,"annualMonthlyUsd":null,"ads":false,"maxTtlMinutes":43200,"maxConcurrentInboxes":25,"monthlyInboxQuota":100,"monthlyEmailQuota":2000,"rateLimitPerMinute":60,"allowPermanent":true,"allowWebhooks":true,"allowCustomDomains":true,"maxCustomDomains":1,"allowPrivateSubdomain":false,"maxPrivateSubdomains":0,"allowForwarding":true,"domainPools":["premium_pool","public_free","custom"]},"api_free":{"id":"api_free","audience":"api","monthlyPriceUsd":0,"annualPriceUsd":0,"annualMonthlyUsd":null,"ads":false,"maxTtlMinutes":60,"maxConcurrentInboxes":5,"monthlyInboxQuota":50,"monthlyEmailQuota":100,"rateLimitPerMinute":30,"allowPermanent":false,"allowWebhooks":false,"allowCustomDomains":false,"maxCustomDomains":0,"allowPrivateSubdomain":false,"maxPrivateSubdomains":0,"allowForwarding":false,"domainPools":["public_free"]},"starter":{"id":"starter","audience":"api","monthlyPriceUsd":12,"annualPriceUsd":null,"annualMonthlyUsd":9,"ads":false,"maxTtlMinutes":10080,"maxConcurrentInboxes":50,"monthlyInboxQuota":500,"monthlyEmailQuota":5000,"rateLimitPerMinute":120,"allowPermanent":false,"allowWebhooks":true,"allowCustomDomains":false,"maxCustomDomains":0,"allowPrivateSubdomain":false,"maxPrivateSubdomains":0,"allowForwarding":false,"domainPools":["api_only","public_free"]},"team":{"id":"team","audience":"api","monthlyPriceUsd":39,"annualPriceUsd":null,"annualMonthlyUsd":29,"ads":false,"maxTtlMinutes":43200,"maxConcurrentInboxes":200,"monthlyInboxQuota":2000,"monthlyEmailQuota":50000,"rateLimitPerMinute":300,"allowPermanent":false,"allowWebhooks":true,"allowCustomDomains":false,"maxCustomDomains":0,"allowPrivateSubdomain":true,"maxPrivateSubdomains":1,"allowForwarding":false,"domainPools":["api_only","public_free"]},"business":{"id":"business","audience":"api","monthlyPriceUsd":99,"annualPriceUsd":null,"annualMonthlyUsd":79,"ads":false,"maxTtlMinutes":43200,"maxConcurrentInboxes":1000,"monthlyInboxQuota":10000,"monthlyEmailQuota":300000,"rateLimitPerMinute":600,"allowPermanent":true,"allowWebhooks":true,"allowCustomDomains":true,"maxCustomDomains":3,"allowPrivateSubdomain":true,"maxPrivateSubdomains":3,"allowForwarding":true,"domainPools":["api_only","public_free","custom"]},"enterprise":{"id":"enterprise","audience":"api","monthlyPriceUsd":299,"annualPriceUsd":null,"annualMonthlyUsd":null,"ads":false,"maxTtlMinutes":525600,"maxConcurrentInboxes":5000,"monthlyInboxQuota":100000,"monthlyEmailQuota":null,"rateLimitPerMinute":1200,"allowPermanent":true,"allowWebhooks":true,"allowCustomDomains":true,"maxCustomDomains":50,"allowPrivateSubdomain":true,"maxPrivateSubdomains":50,"allowForwarding":true,"domainPools":["premium_pool","api_only","public_free","custom"]}}}