{"openapi":"3.1.0","info":{"title":"send0 API","version":"1.0.0","description":"Email inboxes for AI agents: create an address, receive, wait, reply, and get webhooks. https://send0.dev","license":{"name":"AGPL-3.0","identifier":"AGPL-3.0-only"}},"servers":[{"url":"https://api.send0.dev"}],"security":[{"bearerAuth":[]}],"tags":[{"name":"Inboxes"},{"name":"Messages"},{"name":"Threads"},{"name":"Drafts"},{"name":"Webhooks"},{"name":"Events"},{"name":"API keys"},{"name":"Usage"}],"paths":{"/v1/inboxes":{"post":{"operationId":"createInbox","summary":"Create an inbox","description":"Creates `name@<domain>` on the install's default mail domain (send0.email on send0.dev), or on `domain` if given. Omit `name` for a random address.","tags":["Inboxes"],"x-send0-scope":"send","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Retry-safe POSTs: same key + same body returns the stored response for 24 hours.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":64},"domain":{"type":"string","maxLength":253},"display_name":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"send_policy":{"type":"string","enum":["open","reply_only","approval"]},"retention_days":{"type":"integer","minimum":1,"maximum":30,"description":"Days to keep message content (1 to 30, default 7). After that, bodies, extracted fields, attachments and the raw message are deleted and the message reads as `expired: true`; the rest of the message is deleted after 35 days."},"metadata":{"type":"object","propertyNames":{"type":"string","maxLength":40},"additionalProperties":{"anyOf":[{"type":"string","maxLength":500},{"type":"number"},{"type":"boolean"},{"type":"null"}]}},"expires_at":{"type":"string","format":"date-time"}}}}}},"responses":{"201":{"description":"Inbox","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Inbox"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"listInboxes","summary":"List inboxes","tags":["Inboxes"],"x-send0-scope":"read","parameters":[{"name":"limit","in":"query","required":false,"schema":{"default":20,"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","maxLength":200}}],"responses":{"200":{"description":"InboxList","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InboxList"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/inboxes/{inbox_id}":{"get":{"operationId":"getInbox","summary":"Get an inbox","tags":["Inboxes"],"x-send0-scope":"read","parameters":[{"name":"inbox_id","in":"path","required":true,"description":"Inbox id (ibx_…)","schema":{"type":"string"}}],"responses":{"200":{"description":"Inbox","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Inbox"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateInbox","summary":"Update an inbox","tags":["Inboxes"],"x-send0-scope":"send","parameters":[{"name":"inbox_id","in":"path","required":true,"description":"Inbox id (ibx_…)","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"display_name":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"send_policy":{"type":"string","enum":["open","reply_only","approval"]},"retention_days":{"type":"integer","minimum":1,"maximum":30,"description":"Days to keep message content (1 to 30, default 7). After that, bodies, extracted fields, attachments and the raw message are deleted and the message reads as `expired: true`; the rest of the message is deleted after 35 days."},"metadata":{"type":"object","propertyNames":{"type":"string","maxLength":40},"additionalProperties":{"anyOf":[{"type":"string","maxLength":500},{"type":"number"},{"type":"boolean"},{"type":"null"}]}},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}}}}}},"responses":{"200":{"description":"Inbox","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Inbox"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteInbox","summary":"Delete an inbox","description":"Mail to the address is refused from now on. The address is never reassigned.","tags":["Inboxes"],"x-send0-scope":"admin","parameters":[{"name":"inbox_id","in":"path","required":true,"description":"Inbox id (ibx_…)","schema":{"type":"string"}}],"responses":{"200":{"description":"DeletedInbox","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeletedInbox"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/inboxes/{inbox_id}/messages":{"get":{"operationId":"listMessages","summary":"List and search messages","description":"Newest first. `from` accepts wildcards such as `*@acme.dev`; `q` is full-text search over subject and body.","tags":["Messages"],"x-send0-scope":"read","parameters":[{"name":"inbox_id","in":"path","required":true,"description":"Inbox id (ibx_…)","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"default":20,"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","maxLength":200}},{"name":"direction","in":"query","required":false,"schema":{"type":"string","enum":["in","out"]}},{"name":"from","in":"query","required":false,"schema":{"type":"string","maxLength":254}},{"name":"subject","in":"query","required":false,"schema":{"type":"string","maxLength":200}},{"name":"thread_id","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"since","in":"query","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"q","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":200}}],"responses":{"200":{"description":"MessageList","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageList"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"sendMessage","summary":"Send a message","description":"Starts a new thread. Inboxes with `send_policy: approval` return a draft (202) instead.","tags":["Messages"],"x-send0-scope":"send","parameters":[{"name":"inbox_id","in":"path","required":true,"description":"Inbox id (ibx_…)","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Retry-safe POSTs: same key + same body returns the stored response for 24 hours.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"to":{"anyOf":[{"anyOf":[{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"name":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]}},"required":["email"]}]},{"maxItems":50,"type":"array","items":{"anyOf":[{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"name":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]}},"required":["email"]}]}}]},"cc":{"anyOf":[{"anyOf":[{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"name":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]}},"required":["email"]}]},{"maxItems":50,"type":"array","items":{"anyOf":[{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"name":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]}},"required":["email"]}]}}]},"bcc":{"anyOf":[{"anyOf":[{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"name":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]}},"required":["email"]}]},{"maxItems":50,"type":"array","items":{"anyOf":[{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"name":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]}},"required":["email"]}]}}]},"subject":{"type":"string","minLength":1,"maxLength":998},"text":{"type":"string","maxLength":500000},"html":{"type":"string","maxLength":1000000}},"required":["to","subject"]}}}},"responses":{"201":{"description":"Message","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"202":{"description":"Draft","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Draft"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/inboxes/{inbox_id}/messages/wait":{"get":{"operationId":"waitForMessage","summary":"Wait for a message","description":"Long-poll. Returns the first message matching the filters received at or after `since` (default: one minute before the call), waiting up to `timeout` seconds. Codes and links are already extracted.","tags":["Messages"],"x-send0-scope":"read","parameters":[{"name":"inbox_id","in":"path","required":true,"description":"Inbox id (ibx_…)","schema":{"type":"string"}},{"name":"timeout","in":"query","required":false,"schema":{"default":30,"type":"integer","minimum":1,"maximum":120}},{"name":"since","in":"query","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","maxLength":254}},{"name":"subject","in":"query","required":false,"schema":{"type":"string","maxLength":200}},{"name":"direction","in":"query","required":false,"schema":{"default":"in","type":"string","enum":["in","out"]}}],"responses":{"200":{"description":"WaitResult","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WaitResult"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messages":{"get":{"operationId":"listAllMessages","summary":"List messages across inboxes","description":"Every inbox the key can see, newest first. Takes the same filters as an inbox's message list, plus `inbox_id` and `status`.","tags":["Messages"],"x-send0-scope":"read","parameters":[{"name":"limit","in":"query","required":false,"schema":{"default":20,"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","maxLength":200}},{"name":"direction","in":"query","required":false,"schema":{"type":"string","enum":["in","out"]}},{"name":"from","in":"query","required":false,"schema":{"type":"string","maxLength":254}},{"name":"subject","in":"query","required":false,"schema":{"type":"string","maxLength":200}},{"name":"thread_id","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"since","in":"query","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"q","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":200}},{"name":"inbox_id","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["received","queued","sent","delivered","bounced","complained","failed"]}}],"responses":{"200":{"description":"MessageList","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageList"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messages/{message_id}":{"get":{"operationId":"getMessage","summary":"Get a message","tags":["Messages"],"x-send0-scope":"read","parameters":[{"name":"message_id","in":"path","required":true,"description":"Message id (msg_…)","schema":{"type":"string"}}],"responses":{"200":{"description":"Message","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messages/{message_id}/raw":{"get":{"operationId":"getRawMessage","summary":"Download the original .eml","tags":["Messages"],"x-send0-scope":"read","parameters":[{"name":"message_id","in":"path","required":true,"description":"Message id (msg_…)","schema":{"type":"string"}}],"responses":{"302":{"description":"Pre-signed download link for the raw message, valid 15 minutes","headers":{"Location":{"schema":{"type":"string"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"The message is past its inbox's retention period (`message_expired`); its content was deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/files/{token}":{"get":{"operationId":"downloadFile","summary":"Download a file from a signed link","description":"Only on installs that store files locally or in R2 (hosted send0.dev uses pre-signed S3 links instead). Needs no API key: the link is the credential, and it expires.","tags":["Messages"],"security":[],"parameters":[{"name":"token","in":"path","required":true,"description":"Signed download token, taken from a download link","schema":{"type":"string"}}],"responses":{"200":{"description":"The file's bytes, as an attachment","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"403":{"description":"The download link is invalid or has expired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The file no longer exists, or this install does not serve signed links","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests from this address (`rate_limited`); see Retry-After","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messages/{message_id}/attachments/{attachment_id}":{"get":{"operationId":"getAttachment","summary":"Get an attachment download link","tags":["Messages"],"x-send0-scope":"read","parameters":[{"name":"message_id","in":"path","required":true,"description":"Message id (msg_…)","schema":{"type":"string"}},{"name":"attachment_id","in":"path","required":true,"description":"Attachment id (att_…)","schema":{"type":"string"}}],"responses":{"200":{"description":"AttachmentDownload","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttachmentDownload"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messages/{message_id}/reply":{"post":{"operationId":"replyToMessage","summary":"Reply to a message","description":"Replies in the same thread with correct In-Reply-To and References.","tags":["Messages"],"x-send0-scope":"send","parameters":[{"name":"message_id","in":"path","required":true,"description":"Message id (msg_…)","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Retry-safe POSTs: same key + same body returns the stored response for 24 hours.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reply_all":{"default":false,"type":"boolean"},"cc":{"anyOf":[{"anyOf":[{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"name":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]}},"required":["email"]}]},{"maxItems":50,"type":"array","items":{"anyOf":[{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"name":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]}},"required":["email"]}]}}]},"bcc":{"anyOf":[{"anyOf":[{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"name":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]}},"required":["email"]}]},{"maxItems":50,"type":"array","items":{"anyOf":[{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"name":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]}},"required":["email"]}]}}]},"text":{"type":"string","maxLength":500000},"html":{"type":"string","maxLength":1000000}}}}}},"responses":{"201":{"description":"Message","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"202":{"description":"Draft","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Draft"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messages/{message_id}/forward":{"post":{"operationId":"forwardMessage","summary":"Forward a message","tags":["Messages"],"x-send0-scope":"send","parameters":[{"name":"message_id","in":"path","required":true,"description":"Message id (msg_…)","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Retry-safe POSTs: same key + same body returns the stored response for 24 hours.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"to":{"anyOf":[{"anyOf":[{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"name":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]}},"required":["email"]}]},{"maxItems":50,"type":"array","items":{"anyOf":[{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"name":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]}},"required":["email"]}]}}]},"cc":{"anyOf":[{"anyOf":[{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"name":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]}},"required":["email"]}]},{"maxItems":50,"type":"array","items":{"anyOf":[{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"name":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]}},"required":["email"]}]}}]},"bcc":{"anyOf":[{"anyOf":[{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"name":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]}},"required":["email"]}]},{"maxItems":50,"type":"array","items":{"anyOf":[{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"name":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]}},"required":["email"]}]}}]},"text":{"type":"string","maxLength":500000},"html":{"type":"string","maxLength":1000000}},"required":["to"]}}}},"responses":{"201":{"description":"Message","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"202":{"description":"Draft","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Draft"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"The message is past its inbox's retention period (`message_expired`); its content was deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/inboxes/{inbox_id}/threads":{"get":{"operationId":"listThreads","summary":"List threads","description":"Most recent activity first.","tags":["Threads"],"x-send0-scope":"read","parameters":[{"name":"inbox_id","in":"path","required":true,"description":"Inbox id (ibx_…)","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"default":20,"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","maxLength":200}}],"responses":{"200":{"description":"ThreadList","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ThreadList"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/inboxes/{inbox_id}/threads/{thread_id}":{"get":{"operationId":"getThread","summary":"Get a thread with its messages","description":"Messages oldest first. HTML only with `include_html=true`.","tags":["Threads"],"x-send0-scope":"read","parameters":[{"name":"inbox_id","in":"path","required":true,"description":"Inbox id (ibx_…)","schema":{"type":"string"}},{"name":"thread_id","in":"path","required":true,"description":"Thread id (thr_…)","schema":{"type":"string"}},{"name":"include_html","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"ThreadWithMessages","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ThreadWithMessages"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/inboxes/{inbox_id}/drafts":{"get":{"operationId":"listDrafts","summary":"List drafts","tags":["Drafts"],"x-send0-scope":"read","parameters":[{"name":"inbox_id","in":"path","required":true,"description":"Inbox id (ibx_…)","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"default":20,"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","maxLength":200}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["pending","approved","rejected","sent"]}}],"responses":{"200":{"description":"DraftList","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DraftList"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/drafts":{"get":{"operationId":"listAllDrafts","summary":"List drafts across inboxes","description":"Every inbox the key can see, newest first. Pass `status=pending` for the approval queue.","tags":["Drafts"],"x-send0-scope":"read","parameters":[{"name":"limit","in":"query","required":false,"schema":{"default":20,"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","maxLength":200}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["pending","approved","rejected","sent"]}},{"name":"inbox_id","in":"query","required":false,"schema":{"type":"string","maxLength":40}}],"responses":{"200":{"description":"DraftList","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DraftList"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/drafts/{draft_id}":{"patch":{"operationId":"updateDraft","summary":"Edit a draft","description":"Changes the subject or body of a pending draft before it's approved. Needs an admin key (like approving), so an agent can't change a draft after a person has reviewed it. Decided drafts return 409.","tags":["Drafts"],"x-send0-scope":"admin","parameters":[{"name":"draft_id","in":"path","required":true,"description":"Draft id (drf_…)","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"string","minLength":1,"maxLength":998},"text":{"anyOf":[{"type":"string","maxLength":500000},{"type":"null"}]},"html":{"anyOf":[{"type":"string","maxLength":1000000},{"type":"null"}]}}}}}},"responses":{"200":{"description":"Draft","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Draft"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"getDraft","summary":"Get a draft","tags":["Drafts"],"x-send0-scope":"read","parameters":[{"name":"draft_id","in":"path","required":true,"description":"Draft id (drf_…)","schema":{"type":"string"}}],"responses":{"200":{"description":"Draft","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Draft"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/drafts/{draft_id}/send":{"post":{"operationId":"sendDraft","summary":"Approve and send a draft","description":"Needs an admin key, so an agent can't approve its own mail. Members can also approve in the dashboard. A draft someone else already decided returns 409.","tags":["Drafts"],"x-send0-scope":"admin","parameters":[{"name":"draft_id","in":"path","required":true,"description":"Draft id (drf_…)","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Retry-safe POSTs: same key + same body returns the stored response for 24 hours.","schema":{"type":"string","maxLength":255}}],"responses":{"201":{"description":"Message","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/drafts/{draft_id}/reject":{"post":{"operationId":"rejectDraft","summary":"Reject a draft","description":"Needs an admin key, so an agent can't approve its own mail. Members can also approve in the dashboard. A draft someone else already decided returns 409.","tags":["Drafts"],"x-send0-scope":"admin","parameters":[{"name":"draft_id","in":"path","required":true,"description":"Draft id (drf_…)","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Retry-safe POSTs: same key + same body returns the stored response for 24 hours.","schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"Draft","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Draft"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/webhooks":{"post":{"operationId":"createWebhook","summary":"Create a webhook","tags":["Webhooks"],"x-send0-scope":"admin","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Retry-safe POSTs: same key + same body returns the stored response for 24 hours.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","maxLength":2048},"events":{"default":["*"],"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","enum":["message.received","message.sent","message.delivered","message.bounced","message.complained","draft.created","domain.verified","inbox.suspended","*"]}},"inbox_ids":{"anyOf":[{"minItems":1,"maxItems":100,"type":"array","items":{"type":"string"}},{"type":"null"}]}},"required":["url"]}}}},"responses":{"201":{"description":"WebhookWithSecret","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookWithSecret"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"listWebhooks","summary":"List webhooks","tags":["Webhooks"],"x-send0-scope":"admin","parameters":[{"name":"limit","in":"query","required":false,"schema":{"default":20,"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","maxLength":200}}],"responses":{"200":{"description":"WebhookList","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookList"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/webhooks/{webhook_id}":{"get":{"operationId":"getWebhook","summary":"Get a webhook","tags":["Webhooks"],"x-send0-scope":"admin","parameters":[{"name":"webhook_id","in":"path","required":true,"description":"Webhook id (whk_…)","schema":{"type":"string"}}],"responses":{"200":{"description":"Webhook","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Webhook"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateWebhook","summary":"Update a webhook","tags":["Webhooks"],"x-send0-scope":"admin","parameters":[{"name":"webhook_id","in":"path","required":true,"description":"Webhook id (whk_…)","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","maxLength":2048},"events":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","enum":["message.received","message.sent","message.delivered","message.bounced","message.complained","draft.created","domain.verified","inbox.suspended","*"]}},"inbox_ids":{"anyOf":[{"minItems":1,"maxItems":100,"type":"array","items":{"type":"string"}},{"type":"null"}]},"status":{"type":"string","enum":["enabled","disabled"]}}}}}},"responses":{"200":{"description":"Webhook","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Webhook"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteWebhook","summary":"Delete a webhook","tags":["Webhooks"],"x-send0-scope":"admin","parameters":[{"name":"webhook_id","in":"path","required":true,"description":"Webhook id (whk_…)","schema":{"type":"string"}}],"responses":{"200":{"description":"DeletedWebhook","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeletedWebhook"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/webhooks/{webhook_id}/rotate-secret":{"post":{"operationId":"rotateWebhookSecret","summary":"Rotate the signing secret","tags":["Webhooks"],"x-send0-scope":"admin","parameters":[{"name":"webhook_id","in":"path","required":true,"description":"Webhook id (whk_…)","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Retry-safe POSTs: same key + same body returns the stored response for 24 hours.","schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"WebhookWithSecret","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookWithSecret"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/webhooks/{webhook_id}/test":{"post":{"operationId":"testWebhook","summary":"Send a test event","tags":["Webhooks"],"x-send0-scope":"admin","parameters":[{"name":"webhook_id","in":"path","required":true,"description":"Webhook id (whk_…)","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Retry-safe POSTs: same key + same body returns the stored response for 24 hours.","schema":{"type":"string","maxLength":255}}],"responses":{"202":{"description":"WebhookTestResult","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookTestResult"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/webhooks/{webhook_id}/deliveries":{"get":{"operationId":"listDeliveries","summary":"List delivery attempts","tags":["Webhooks"],"x-send0-scope":"admin","parameters":[{"name":"webhook_id","in":"path","required":true,"description":"Webhook id (whk_…)","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"default":20,"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","maxLength":200}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["pending","succeeded","failed"]}}],"responses":{"200":{"description":"DeliveryList","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeliveryList"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/webhooks/{webhook_id}/deliveries/{delivery_id}/retry":{"post":{"operationId":"retryDelivery","summary":"Replay a delivery","tags":["Webhooks"],"x-send0-scope":"admin","parameters":[{"name":"webhook_id","in":"path","required":true,"description":"Webhook id (whk_…)","schema":{"type":"string"}},{"name":"delivery_id","in":"path","required":true,"description":"Delivery id (dlv_…)","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Retry-safe POSTs: same key + same body returns the stored response for 24 hours.","schema":{"type":"string","maxLength":255}}],"responses":{"202":{"description":"Delivery","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Delivery"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/events/stream":{"get":{"operationId":"streamEvents","summary":"Stream events (SSE)","description":"Server-Sent Events for one inbox (`inbox_id`) or the whole organization. Send `Last-Event-ID` to resume.","tags":["Events"],"x-send0-scope":"read","parameters":[{"name":"inbox_id","in":"query","required":false,"schema":{"type":"string","maxLength":40}}],"responses":{"200":{"description":"Event stream","content":{"text/event-stream":{"schema":{"type":"string","description":"Each `data:` line is a JSON Event (see the Event schema)."}}},"x-send0-event-schema":{"$ref":"#/components/schemas/Event"}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/api-keys":{"post":{"operationId":"createApiKey","summary":"Create an API key","description":"The full key is returned once.","tags":["API keys"],"x-send0-scope":"admin","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Retry-safe POSTs: same key + same body returns the stored response for 24 hours.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"scopes":{"default":["read","send"],"minItems":1,"type":"array","items":{"type":"string","enum":["read","send","admin"]}},"inbox_ids":{"anyOf":[{"minItems":1,"maxItems":100,"type":"array","items":{"type":"string"}},{"type":"null"}]}},"required":["name"]}}}},"responses":{"201":{"description":"ApiKeyWithSecret","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyWithSecret"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"listApiKeys","summary":"List API keys","tags":["API keys"],"x-send0-scope":"admin","parameters":[{"name":"limit","in":"query","required":false,"schema":{"default":20,"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","maxLength":200}}],"responses":{"200":{"description":"ApiKeyList","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyList"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/usage":{"get":{"operationId":"getUsage","summary":"Get usage","description":"Your plan, inboxes used, sends today against the daily limit (UTC), and whether sending is paused.","tags":["Usage"],"x-send0-scope":"read","parameters":[],"responses":{"200":{"description":"Usage","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Usage"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/stats":{"get":{"operationId":"getStats","summary":"Get daily stats","description":"Mail per UTC day for the last `days` days (default 14, up to 90): received, sent, delivered, bounced and failed. Days with no mail are zeros.","tags":["Usage"],"x-send0-scope":"read","parameters":[{"name":"days","in":"query","required":false,"schema":{"default":14,"type":"integer","minimum":1,"maximum":90}},{"name":"inbox_id","in":"query","required":false,"schema":{"type":"string","maxLength":40}}],"responses":{"200":{"description":"Stats","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Stats"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/api-keys/{api_key_id}":{"delete":{"operationId":"revokeApiKey","summary":"Revoke an API key","tags":["API keys"],"x-send0-scope":"admin","parameters":[{"name":"api_key_id","in":"path","required":true,"description":"API key id (key_…)","schema":{"type":"string"}}],"responses":{"200":{"description":"RevokedApiKey","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RevokedApiKey"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed (scope, policy or account state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not visible to this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit (`rate_limited`, see Retry-After) or daily send limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"API key: s0_live_… or s0_test_…"}},"schemas":{"Mailbox":{"$id":"#/components/schemas/Mailbox","type":"object","properties":{"name":{"type":["string","null"]},"email":{"type":"string"}},"required":["name","email"],"additionalProperties":false},"Error":{"$id":"#/components/schemas/Error","type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable, machine-readable code, e.g. not_found, recipient_not_allowed"},"message":{"type":"string"},"param":{"description":"The request field the error is about","type":"string"},"request_id":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false},"Attachment":{"$id":"#/components/schemas/Attachment","type":"object","properties":{"id":{"type":"string"},"filename":{"type":["string","null"]},"content_type":{"type":"string"},"size":{"type":"integer"},"inline":{"type":"boolean"},"content_id":{"type":["string","null"]}},"required":["id","filename","content_type","size","inline","content_id"],"additionalProperties":false},"AttachmentDownload":{"$id":"#/components/schemas/AttachmentDownload","type":"object","properties":{"id":{"type":"string"},"filename":{"type":["string","null"]},"content_type":{"type":"string"},"size":{"type":"integer"},"inline":{"type":"boolean"},"content_id":{"type":["string","null"]},"object":{"type":"string","const":"attachment"},"message_id":{"type":"string"},"download_url":{"type":"string","description":"Pre-signed URL, valid until expires_at"},"expires_at":{"type":"string","format":"date-time"}},"required":["id","filename","content_type","size","inline","content_id","object","message_id","download_url","expires_at"],"additionalProperties":false},"Message":{"$id":"#/components/schemas/Message","type":"object","properties":{"object":{"type":"string","const":"message"},"id":{"type":"string"},"inbox_id":{"type":"string"},"thread_id":{"type":"string"},"direction":{"type":"string","enum":["in","out"]},"status":{"type":"string","enum":["received","queued","sent","delivered","bounced","complained","failed"]},"expired":{"type":"boolean","description":"true once the inbox's retention period has passed: text, html, extracted_text, extracted and attachments are gone (null or empty) and the raw message can't be downloaded. Addresses, subject, status and timestamps remain until the message is deleted, 35 days after it was created."},"rfc_message_id":{"type":["string","null"]},"in_reply_to":{"type":"array","items":{"type":"string"}},"references":{"type":"array","items":{"type":"string"}},"from":{"anyOf":[{"$ref":"#/components/schemas/Mailbox"},{"type":"null"}]},"to":{"type":"array","items":{"$ref":"#/components/schemas/Mailbox"}},"cc":{"type":"array","items":{"$ref":"#/components/schemas/Mailbox"}},"reply_to":{"type":"array","items":{"$ref":"#/components/schemas/Mailbox"}},"subject":{"type":"string"},"text":{"type":["string","null"]},"html":{"description":"Only on single-message reads and threads with include_html=true","type":["string","null"]},"extracted_text":{"description":"New text only: quoted history, forwards and signatures removed","type":["string","null"]},"extracted":{"anyOf":[{"type":"object","properties":{"otp":{"description":"Most likely one-time code","type":["string","null"]},"links":{"type":"array","items":{"type":"string"}},"action_link":{"description":"Most likely verify / sign-in / reset link","type":["string","null"]}},"required":["otp","links","action_link"],"additionalProperties":false},{"type":"null"}]},"auth":{"anyOf":[{"type":"object","properties":{"spf":{"type":"string"},"dkim":{"type":"string"},"dmarc":{"type":"string"}},"required":["spf","dkim","dmarc"],"additionalProperties":false},{"type":"null"}]},"safety":{"anyOf":[{"type":"object","properties":{"prompt_injection":{"type":"string","enum":["none","suspected","likely"]},"reasons":{"type":"array","items":{"type":"string"}}},"required":["prompt_injection","reasons"],"additionalProperties":false},{"type":"null"}]},"tag":{"description":"Plus-address tag, e.g. task42 for bot+task42@","type":["string","null"]},"attachments":{"type":"array","items":{"$ref":"#/components/schemas/Attachment"}},"size":{"type":"integer"},"sent_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"received_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time"}},"required":["object","id","inbox_id","thread_id","direction","status","expired","rfc_message_id","in_reply_to","references","from","to","cc","reply_to","subject","text","extracted_text","extracted","auth","safety","tag","attachments","size","sent_at","received_at","created_at"],"additionalProperties":false},"Thread":{"$id":"#/components/schemas/Thread","type":"object","properties":{"object":{"type":"string","const":"thread"},"id":{"type":"string"},"inbox_id":{"type":"string"},"subject":{"type":"string"},"participants":{"type":"array","items":{"type":"string"}},"message_count":{"type":"integer"},"labels":{"type":"array","items":{"type":"string"}},"latest_message":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"direction":{"type":"string","enum":["in","out"]},"from":{"anyOf":[{"$ref":"#/components/schemas/Mailbox"},{"type":"null"}]},"snippet":{"type":"string","description":"Start of the new text (quotes and signatures removed), whitespace collapsed"}},"required":["id","direction","from","snippet"],"additionalProperties":false},{"type":"null"}],"description":"The newest message, for list previews"},"last_message_at":{"type":"string","format":"date-time"},"created_at":{"type":"string","format":"date-time"}},"required":["object","id","inbox_id","subject","participants","message_count","labels","latest_message","last_message_at","created_at"],"additionalProperties":false},"ThreadWithMessages":{"$id":"#/components/schemas/ThreadWithMessages","type":"object","properties":{"object":{"type":"string","const":"thread"},"id":{"type":"string"},"inbox_id":{"type":"string"},"subject":{"type":"string"},"participants":{"type":"array","items":{"type":"string"}},"message_count":{"type":"integer"},"labels":{"type":"array","items":{"type":"string"}},"latest_message":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"direction":{"type":"string","enum":["in","out"]},"from":{"anyOf":[{"$ref":"#/components/schemas/Mailbox"},{"type":"null"}]},"snippet":{"type":"string","description":"Start of the new text (quotes and signatures removed), whitespace collapsed"}},"required":["id","direction","from","snippet"],"additionalProperties":false},{"type":"null"}],"description":"The newest message, for list previews"},"last_message_at":{"type":"string","format":"date-time"},"created_at":{"type":"string","format":"date-time"},"messages":{"type":"array","items":{"$ref":"#/components/schemas/Message"}}},"required":["object","id","inbox_id","subject","participants","message_count","labels","latest_message","last_message_at","created_at","messages"],"additionalProperties":false},"Inbox":{"$id":"#/components/schemas/Inbox","type":"object","properties":{"object":{"type":"string","const":"inbox"},"id":{"type":"string"},"address":{"type":"string"},"local_part":{"type":"string"},"domain":{"type":"string"},"display_name":{"type":["string","null"]},"mode":{"type":"string","enum":["live","sandbox"]},"send_policy":{"type":"string","enum":["open","reply_only","approval"]},"status":{"type":"string","enum":["active","suspended","deleted"]},"retention_days":{"type":"integer"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":["string","number","boolean","null"]}},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["object","id","address","local_part","domain","display_name","mode","send_policy","status","retention_days","metadata","expires_at","created_at","updated_at"],"additionalProperties":false},"DeletedInbox":{"$id":"#/components/schemas/DeletedInbox","type":"object","properties":{"object":{"type":"string","const":"inbox"},"id":{"type":"string"},"address":{"type":"string"},"local_part":{"type":"string"},"domain":{"type":"string"},"display_name":{"type":["string","null"]},"mode":{"type":"string","enum":["live","sandbox"]},"send_policy":{"type":"string","enum":["open","reply_only","approval"]},"status":{"type":"string","enum":["active","suspended","deleted"]},"retention_days":{"type":"integer"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":["string","number","boolean","null"]}},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"deleted":{"type":"boolean","const":true}},"required":["object","id","address","local_part","domain","display_name","mode","send_policy","status","retention_days","metadata","expires_at","created_at","updated_at","deleted"],"additionalProperties":false},"ApiKey":{"$id":"#/components/schemas/ApiKey","type":"object","properties":{"object":{"type":"string","const":"api_key"},"id":{"type":"string"},"name":{"type":"string"},"prefix":{"type":"string"},"mode":{"type":"string","enum":["live","test"]},"scopes":{"type":"array","items":{"type":"string"}},"inbox_ids":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"last_used_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time"}},"required":["object","id","name","prefix","mode","scopes","inbox_ids","last_used_at","created_at"],"additionalProperties":false},"ApiKeyWithSecret":{"$id":"#/components/schemas/ApiKeyWithSecret","type":"object","properties":{"object":{"type":"string","const":"api_key"},"id":{"type":"string"},"name":{"type":"string"},"prefix":{"type":"string"},"mode":{"type":"string","enum":["live","test"]},"scopes":{"type":"array","items":{"type":"string"}},"inbox_ids":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"last_used_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time"},"key":{"type":"string","description":"Shown once"}},"required":["object","id","name","prefix","mode","scopes","inbox_ids","last_used_at","created_at","key"],"additionalProperties":false},"RevokedApiKey":{"$id":"#/components/schemas/RevokedApiKey","type":"object","properties":{"object":{"type":"string","const":"api_key"},"id":{"type":"string"},"name":{"type":"string"},"prefix":{"type":"string"},"mode":{"type":"string","enum":["live","test"]},"scopes":{"type":"array","items":{"type":"string"}},"inbox_ids":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"last_used_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time"},"revoked":{"type":"boolean","const":true}},"required":["object","id","name","prefix","mode","scopes","inbox_ids","last_used_at","created_at","revoked"],"additionalProperties":false},"Webhook":{"$id":"#/components/schemas/Webhook","type":"object","properties":{"object":{"type":"string","const":"webhook"},"id":{"type":"string"},"url":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"inbox_ids":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"status":{"type":"string","enum":["enabled","disabled"]},"created_at":{"type":"string","format":"date-time"}},"required":["object","id","url","events","inbox_ids","status","created_at"],"additionalProperties":false},"WebhookWithSecret":{"$id":"#/components/schemas/WebhookWithSecret","type":"object","properties":{"object":{"type":"string","const":"webhook"},"id":{"type":"string"},"url":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"inbox_ids":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"status":{"type":"string","enum":["enabled","disabled"]},"created_at":{"type":"string","format":"date-time"},"secret":{"type":"string","description":"Signing secret, shown once"}},"required":["object","id","url","events","inbox_ids","status","created_at","secret"],"additionalProperties":false},"DeletedWebhook":{"$id":"#/components/schemas/DeletedWebhook","type":"object","properties":{"object":{"type":"string","const":"webhook"},"id":{"type":"string"},"url":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"inbox_ids":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"status":{"type":"string","enum":["enabled","disabled"]},"created_at":{"type":"string","format":"date-time"},"deleted":{"type":"boolean","const":true}},"required":["object","id","url","events","inbox_ids","status","created_at","deleted"],"additionalProperties":false},"WebhookTestResult":{"$id":"#/components/schemas/WebhookTestResult","type":"object","properties":{"object":{"type":"string","const":"event"},"id":{"type":"string"},"type":{"type":"string","const":"webhook.test"},"delivery_id":{"type":"string"}},"required":["object","id","type","delivery_id"],"additionalProperties":false},"Delivery":{"$id":"#/components/schemas/Delivery","type":"object","properties":{"object":{"type":"string","const":"delivery"},"id":{"type":"string"},"webhook_id":{"type":"string"},"event_id":{"type":"string"},"event_type":{"type":["string","null"]},"status":{"type":"string","enum":["pending","succeeded","failed"]},"attempts":{"type":"integer"},"last_status_code":{"anyOf":[{"type":"integer"},{"type":"null"}]},"last_error":{"type":["string","null"]},"last_duration_ms":{"anyOf":[{"type":"integer"},{"type":"null"}]},"next_attempt_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["object","id","webhook_id","event_id","event_type","status","attempts","last_status_code","last_error","last_duration_ms","next_attempt_at","created_at","updated_at"],"additionalProperties":false},"Draft":{"$id":"#/components/schemas/Draft","type":"object","properties":{"object":{"type":"string","const":"draft"},"id":{"type":"string"},"inbox_id":{"type":"string"},"thread_id":{"type":["string","null"]},"status":{"type":"string","enum":["pending","approved","rejected","sent"]},"kind":{"type":"string","enum":["new","reply","forward"]},"to":{"type":"array","items":{"$ref":"#/components/schemas/Mailbox"}},"cc":{"type":"array","items":{"$ref":"#/components/schemas/Mailbox"}},"bcc":{"type":"array","items":{"$ref":"#/components/schemas/Mailbox"}},"subject":{"type":"string"},"text":{"type":["string","null"]},"html":{"type":["string","null"]},"decided_by":{"type":["string","null"]},"decided_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time"}},"required":["object","id","inbox_id","thread_id","status","kind","to","cc","bcc","subject","text","html","decided_by","decided_at","created_at"],"additionalProperties":false},"WaitResult":{"$id":"#/components/schemas/WaitResult","type":"object","properties":{"object":{"type":"string","const":"wait_result"},"timed_out":{"type":"boolean"},"message":{"anyOf":[{"$ref":"#/components/schemas/Message"},{"type":"null"}],"description":"The first matching message, or null on timeout"}},"required":["object","timed_out","message"],"additionalProperties":false},"Event":{"$id":"#/components/schemas/Event","type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","const":"event"},"type":{"type":"string","description":"message.received, message.sent, message.delivered, message.bounced, message.complained, draft.created, inbox.suspended, webhook.test"},"created_at":{"type":"string","format":"date-time"},"inbox_id":{"type":["string","null"]},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"The payload. message.*: the message (without html). inbox.suspended: { scope: \"org\" | \"inbox\", reason, … }; \"org\" means sending is paused account-wide, \"inbox\" that one inbox is suspended."}},"required":["id","object","type","created_at","inbox_id","data"],"additionalProperties":false},"Usage":{"$id":"#/components/schemas/Usage","type":"object","properties":{"object":{"type":"string","const":"usage"},"plan":{"type":"string","enum":["free","pro","scale"]},"inboxes":{"type":"object","properties":{"used":{"type":"integer"},"limit":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"null when the install has no inbox cap (self-hosted)"}},"required":["used","limit"],"additionalProperties":false},"sends_today":{"type":"object","properties":{"used":{"type":"integer"},"limit":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"null when the install has no daily cap (self-hosted)"},"resets_at":{"type":"string","format":"date-time","description":"Midnight UTC, when the daily count starts over"}},"required":["used","limit","resets_at"],"additionalProperties":false},"sending":{"type":"object","properties":{"paused":{"type":"boolean"},"reason":{"type":["string","null"]},"paused_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["paused","reason","paused_at"],"additionalProperties":false}},"required":["object","plan","inboxes","sends_today","sending"],"additionalProperties":false},"Stats":{"$id":"#/components/schemas/Stats","type":"object","properties":{"object":{"type":"string","const":"stats"},"from":{"type":"string","format":"date-time","description":"Start of the first day (UTC)"},"days":{"type":"array","items":{"type":"object","properties":{"received":{"type":"integer"},"sent":{"type":"integer"},"delivered":{"type":"integer"},"bounced":{"type":"integer","description":"Bounces and complaints"},"failed":{"type":"integer"},"date":{"type":"string","description":"YYYY-MM-DD, UTC"}},"required":["received","sent","delivered","bounced","failed","date"],"additionalProperties":false}},"totals":{"type":"object","properties":{"received":{"type":"integer"},"sent":{"type":"integer"},"delivered":{"type":"integer"},"bounced":{"type":"integer","description":"Bounces and complaints"},"failed":{"type":"integer"}},"required":["received","sent","delivered","bounced","failed"],"additionalProperties":false}},"required":["object","from","days","totals"],"additionalProperties":false},"InboxList":{"$id":"#/components/schemas/InboxList","type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Inbox"}},"next_cursor":{"type":["string","null"]}},"required":["object","data","next_cursor"],"additionalProperties":false},"MessageList":{"$id":"#/components/schemas/MessageList","type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Message"}},"next_cursor":{"type":["string","null"]}},"required":["object","data","next_cursor"],"additionalProperties":false},"ThreadList":{"$id":"#/components/schemas/ThreadList","type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Thread"}},"next_cursor":{"type":["string","null"]}},"required":["object","data","next_cursor"],"additionalProperties":false},"ApiKeyList":{"$id":"#/components/schemas/ApiKeyList","type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/ApiKey"}},"next_cursor":{"type":["string","null"]}},"required":["object","data","next_cursor"],"additionalProperties":false},"WebhookList":{"$id":"#/components/schemas/WebhookList","type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Webhook"}},"next_cursor":{"type":["string","null"]}},"required":["object","data","next_cursor"],"additionalProperties":false},"DeliveryList":{"$id":"#/components/schemas/DeliveryList","type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Delivery"}},"next_cursor":{"type":["string","null"]}},"required":["object","data","next_cursor"],"additionalProperties":false},"DraftList":{"$id":"#/components/schemas/DraftList","type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Draft"}},"next_cursor":{"type":["string","null"]}},"required":["object","data","next_cursor"],"additionalProperties":false}}}}