{"openapi":"3.1.0","info":{"title":"MailCraft API","description":"Email infrastructure for AI agents.\n\n## Ids\n\nEvery id the API returns starts with a prefix that names its kind: `ibx_` an inbox, `thr_` a thread, `msg_` a message, `att_` an attachment, `evt_` an event, `drf_` a draft, `dat_` a draft's attachment, `key_` an API key, `whk_` a webhook endpoint, `dlv_` a webhook delivery, `usr_` a user (a member, an author or a reviewer), `inv_` an invitation. Organization ids are UUIDs. An id of the wrong kind is answered as an unknown one.\n\n## API changes, 2026-12-01\n\n- New mail domains: new inboxes get addresses on `agents.mxcraft.cc` (NT Connect's own organizations: `agents.mxcraft.ntconnect.com`). Every existing inbox on `agents.mailcraft.cc` or `agents.mailcraft.ntconnect.com` also receives at the same name on the new domain, in the same inbox; the old address keeps working with no end date.\n- Inbox answers carry `aliases`, the inbox's other addresses. When the switch is made (announced on the status page), an existing inbox's `address` becomes its new-domain address and the old one moves to `aliases`; both keep receiving and sending.\n- Messages carry `deliveredTo`: the inbox address a received message was delivered to (null for sent mail and for mail received before this change). A reply goes from the address the original was delivered to or sent from; a new message or a forward goes from `address`. Drafts carry `fromAddress`, the address a send of the draft goes from.\n- A thread's message summaries carry `deliveredTo` too.\n\n## API changes, 2026-11-28\n\n- Forward: `POST /v0/messages/{messageId}/forward` (and its sign-in twin) sends a message on from its inbox to new recipients with an optional note, the original's attachments included unless `includeAttachments` is false. MCP gains the `forward` tool.\n\n## API changes, 2026-11-27\n\n- Unread markers for people: with a sign-in token, thread lists, search results and a thread carry `unread`, inbox answers carry `unreadCount`, and `POST /v0/orgs/{orgId}/threads/{threadId}/read` and `…/unread` mark a thread for the signed-in person. API-key answers are unchanged.\n\n## API changes, 2026-11-25\n\n- A message with nothing in it is refused: text and html missing, empty or only whitespace, with no attachment, now answers 422 on send, reply, draft send and submitting a draft for approval. A draft can still be saved blank.\n- JSON bodies are no longer type-coerced: a number, boolean or null where a string is expected, \"3\" for an integer, \"true\" or 1 for a boolean, and a bare string where an array is expected are now 422. Query strings are unchanged (`?limit=10` still reads as 10).\n- Drafts refuse a malformed to, cc or bcc address at create and update (422), as a send does.\n- A field that fails its pattern is named in plain English (such as \"subject can't contain line breaks.\") rather than with the pattern itself.\n- Every 400 for a bad cursor has a detail: \"This cursor isn't valid for this list. Read again without it.\"\n- An API key's 401 carries `WWW-Authenticate: Bearer`, as a sign-in token's already did.\n- Webhook deliveries carry `User-Agent`, `Mailcraft-Event-Id`, `Mailcraft-Delivery-Id` and `Mailcraft-Delivery-Attempt` headers.\n- This document lists every status each operation can answer, with `Retry-After` and the `X-RateLimit-*` headers on each 429.\n- A list cursor works only on the list that returned it: another list (another inbox's threads, say) answers 400 \"Invalid cursor\". Cursors returned before this change answer the same 400; read again without one.\n- A path the API does not serve on this host (such as `/`) answers a problem+json 404, as an unknown `/v0` path does.\n- A reply takes `replyAll: true` to also copy the original's other To and Cc (minus the inbox and anyone already in `to`), as MCP `reply_all` does.\n- Thread search: an inbox's thread list takes `q`, `from`, `subject`, `after`, `before` and `hasAttachments`, and the new `GET /v0/threads` (and `/v0/orgs/{orgId}/threads`) searches every inbox, or the one `inbox` names, with at least one of them. A search that runs too long answers 503.\n\n## API changes, 2026-11-23\n\n- The `draft.submitted`, `draft.sent` and `draft.rejected` events also carry `author_name`, `approved_by_name` and `rejected_by_name`: an API key's name, or a person's name or, without one, their email, as it was when the event fired. An API key cannot read the members or API-keys lists, so these say who the ids are.\n\n## API changes, 2026-11-20\n\n- API key, webhook endpoint, delivery, member (user) and invitation ids, and a draft's `authorApiKeyId`, `authorUserId` and `reviewedBy`, are now prefixed like every other id. Paths and bodies still accept the raw UUIDs they used to carry.\n- The `draft.submitted`, `draft.sent` and `draft.rejected` events carry prefixed `author_key_id`, `author_user_id`, `approved_by` and `rejected_by` from now on; events created before keep the raw UUIDs they were made with.\n- Events, in the feed and in webhook bodies, carry `createdAt`. `created_at` has the same value and is deprecated; it will be removed on or after 2026-12-21. Read `createdAt`.\n- Creating an inbox answers `heldCount` (0), as reading one does.\n\n## Limits and the status each answers\n\nThe API applies no general request rate limit: the only 429 it answers is a sending limit, and only that 429 carries rate-limit headers (a successful response has none). Each refusal below is an `application/problem+json` body.\n\n- **Inboxes:** a plan allows a fixed number of active inboxes (Free: 3). Creating one past it answers **403** \"Inbox limit reached\"; an organization with no active plan also gets **403**.\n- **Recipients:** at most 50 in to, cc and bcc together, each once. More, or none, answers **422**.\n- **Message size:** the organization's limit (Free: 10 MiB), never more than 40 MB. A larger send answers **413**.\n- **Sending rate:** messages, not recipients, per minute, hour and day (Free: 10, 50, 100; Pro and Scale are higher). A new organization is held to 50 a day at first. Over a limit answers **429** with a `Retry-After` header (seconds) and `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset` headers.\n- **Messages used up:** when the organization has used its messages, sending answers **402** until a top-up or the monthly refill.\n- **Paused, suspended or closed:** sending paused for the organization, a suspended organization, or a closed one answers **403**.","version":"0.3.57"},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"A MailCraft API key."},"zitadelAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"A sign-in access token (Zitadel): the user, organization-member and staff routes."}},"schemas":{"def-0":{"title":"ProblemDetails","type":"object","required":["type","title","status"],"properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"}}}},"responses":{"Unauthorized":{"description":"The Authorization header is missing, or its API key or sign-in token is not valid.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"Forbidden":{"description":"The credential is valid but may not do this: its organization is suspended, or (a sign-in token) the member's role in the organization is too low for the operation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"TooManyRequests":{"description":"The organization's sending limit was reached. Wait the number of seconds in the Retry-After header before sending again.","headers":{"Retry-After":{"description":"Seconds to wait before sending again.","schema":{"type":"integer","minimum":0}},"X-RateLimit-Limit":{"description":"The limit of the window that was reached, in messages.","schema":{"type":"integer","minimum":0}},"X-RateLimit-Remaining":{"description":"Messages left in that window: 0.","schema":{"type":"integer","minimum":0}},"X-RateLimit-Reset":{"description":"Seconds until that window has room again; the same as Retry-After.","schema":{"type":"integer","minimum":0}}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"BadRequest":{"description":"Malformed request. The body is not valid JSON, or is empty while its Content-Type says JSON.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"InvalidCursor":{"description":"Invalid cursor. This cursor isn't valid for this list. Read again without it.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"IdempotencyKeyMissing":{"description":"Idempotency-Key missing. The Idempotency-Key header is missing, empty or over 255 characters, or (a send or a reply) starts with the reserved \"draft:\"; or the body is not valid JSON.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"PaymentRequired":{"description":"Out of messages. The organization has used its messages; sending resumes after a top-up or the monthly refill.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"NotFound":{"description":"Not found. An id in the path is unknown, of the wrong kind, in another organization or deleted; on a /v0/orgs/{orgId}/… path, also an organization the caller is not a member of.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"Conflict":{"description":"Conflict. The request clashes with the current state of what it names; the detail says how.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"PayloadTooLarge":{"description":"Body too large. The request body is over the operation's limit (for a send, the organization's message size limit).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"UnsupportedMediaType":{"description":"Not JSON. The body's Content-Type is not one the operation reads: send application/json.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"ValidationFailed":{"description":"Invalid request. A field is missing, unknown, of the wrong type or out of range, or the request breaks one of the operation's rules; the detail says which.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"ServiceUnavailable":{"description":"Unavailable just now. Sign-in could not be checked or is not configured, or a service the operation needs is not available; try again shortly.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}},"paths":{"/openapi.json":{"get":{"summary":"OpenAPI document","tags":["Status"],"description":"This API's OpenAPI 3.1 description, as JSON. Needs no credential.","responses":{"200":{"description":"The OpenAPI document.","content":{"application/json":{"schema":{"additionalProperties":true,"description":"The OpenAPI document.","type":"object","properties":{}}}}}}}},"/health":{"get":{"summary":"Health check","tags":["Status"],"description":"Answers {\"status\": \"ok\", \"version\": \"<api version>\"} while the API is running. Needs no credential.","responses":{"200":{"description":"Running, and which api version.","content":{"application/json":{"schema":{"description":"Running, and which api version.","type":"object","required":["status","version"],"properties":{"status":{"type":"string","enum":["ok"]},"version":{"type":"string"}}}}}}}}},"/v0/brief":{"get":{"summary":"API Brief","tags":["Status"],"description":"Every operation on one line, each ending in its ref, as plain text: the API Brief's index. GET /v0/brief/{ref} has one operation in full. Needs no credential.","responses":{"200":{"description":"The index.","content":{"text/plain":{"schema":{"type":"string"}}}}}}},"/v0/brief/{ref}":{"get":{"summary":"Operation's Brief","tags":["Status"],"description":"One operation in full, as plain text: auth, parameters, body, responses, errors and an example request. The ref is the one its index line ends with, without the #. Needs no credential.","parameters":[{"schema":{"type":"string"},"in":"path","name":"ref","required":true}],"responses":{"200":{"description":"The operation's page.","content":{"text/plain":{"schema":{"type":"string"}}}},"404":{"description":"No operation has this ref.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}}},"/v0/inboxes":{"post":{"summary":"Create inbox","tags":["Inboxes"],"description":"Creates an inbox. For a customer organization its address is <username>.<organization handle>@agents.mxcraft.cc (the username is assigned when omitted). Usernames and display names may not use an NT Connect name.","requestBody":{"required":true,"content":{"application/json":{"schema":{"additionalProperties":false,"type":"object","properties":{"username":{"minLength":1,"maxLength":64,"pattern":"^[a-zA-Z0-9._-]+$","type":"string"},"displayName":{"maxLength":200,"type":"string"}}}}}},"security":[{"bearerAuth":[]}],"responses":{"201":{"description":"The new inbox.","content":{"application/json":{"schema":{"type":"object","required":["id","address","aliases","displayName","createdAt","heldCount","requireApproval","roleAddress"],"properties":{"id":{"type":"string"},"address":{"type":"string"},"aliases":{"description":"The inbox's other addresses. Mail to any of them lands in this inbox, and a reply goes from the one the original used. Empty for most inboxes.","type":"array","items":{"type":"string"}},"displayName":{"type":"string","nullable":true},"createdAt":{"format":"date-time","type":"string"},"heldCount":{"description":"Held, not yet expired messages: a count, no content.","type":"integer"},"requireApproval":{"description":"Sends from this inbox by API keys and members wait for an owner's or admin's approval.","type":"boolean"},"roleAddress":{"description":"One of NT Connect's role addresses on the shared domains (such as postmaster@); it cannot be deleted.","type":"boolean"},"unreadCount":{"description":"Present only with a sign-in token: threads in this inbox with mail this person hasn't opened.","type":"integer"}},"description":"The new inbox."}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"The organization already has as many active inboxes as its plan allows, or (while Prism enforcement is on) has no active plan.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"409":{"description":"The requested username is already in use, or is reserved (a role name such as postmaster, or an NT Connect name). These are reported identically so this endpoint cannot be used to enumerate existing inboxes.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"description":"The request body failed schema validation; the display name uses an NT Connect name; or the username with the organization's handle would pass 64 characters.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}},"get":{"summary":"List inboxes","tags":["Inboxes"],"description":"Pages through the organization's inboxes. Pass the nextCursor of a page as cursor to read the next.","parameters":[{"schema":{"minimum":1,"maximum":100,"default":25,"type":"integer"},"in":"query","name":"limit","required":false},{"schema":{"type":"string"},"in":"query","name":"cursor","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"A page of inboxes.","content":{"application/json":{"schema":{"description":"A page of inboxes.","type":"object","required":["data","nextCursor"],"properties":{"data":{"type":"array","items":{"type":"object","required":["id","address","aliases","displayName","createdAt","heldCount","requireApproval","roleAddress"],"properties":{"id":{"type":"string"},"address":{"type":"string"},"aliases":{"description":"The inbox's other addresses. Mail to any of them lands in this inbox, and a reply goes from the one the original used. Empty for most inboxes.","type":"array","items":{"type":"string"}},"displayName":{"type":"string","nullable":true},"createdAt":{"format":"date-time","type":"string"},"heldCount":{"description":"Held, not yet expired messages: a count, no content.","type":"integer"},"requireApproval":{"description":"Sends from this inbox by API keys and members wait for an owner's or admin's approval.","type":"boolean"},"roleAddress":{"description":"One of NT Connect's role addresses on the shared domains (such as postmaster@); it cannot be deleted.","type":"boolean"},"unreadCount":{"description":"Present only with a sign-in token: threads in this inbox with mail this person hasn't opened.","type":"integer"}}}},"nextCursor":{"type":"string","nullable":true,"description":"The next page's cursor; null on the last page."}}}}}},"400":{"$ref":"#/components/responses/InvalidCursor"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"description":"The query string failed schema validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}}},"/v0/orgs/{orgId}/inboxes":{"post":{"summary":"Create inbox","tags":["Inboxes"],"description":"Creates an inbox. For a customer organization its address is <username>.<organization handle>@agents.mxcraft.cc (the username is assigned when omitted). Usernames and display names may not use an NT Connect name.","requestBody":{"required":true,"content":{"application/json":{"schema":{"additionalProperties":false,"type":"object","properties":{"username":{"minLength":1,"maxLength":64,"pattern":"^[a-zA-Z0-9._-]+$","type":"string"},"displayName":{"maxLength":200,"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"201":{"description":"The new inbox.","content":{"application/json":{"schema":{"type":"object","required":["id","address","aliases","displayName","createdAt","heldCount","requireApproval","roleAddress"],"properties":{"id":{"type":"string"},"address":{"type":"string"},"aliases":{"description":"The inbox's other addresses. Mail to any of them lands in this inbox, and a reply goes from the one the original used. Empty for most inboxes.","type":"array","items":{"type":"string"}},"displayName":{"type":"string","nullable":true},"createdAt":{"format":"date-time","type":"string"},"heldCount":{"description":"Held, not yet expired messages: a count, no content.","type":"integer"},"requireApproval":{"description":"Sends from this inbox by API keys and members wait for an owner's or admin's approval.","type":"boolean"},"roleAddress":{"description":"One of NT Connect's role addresses on the shared domains (such as postmaster@); it cannot be deleted.","type":"boolean"},"unreadCount":{"description":"Present only with a sign-in token: threads in this inbox with mail this person hasn't opened.","type":"integer"}},"description":"The new inbox."}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"The organization already has as many active inboxes as its plan allows, or (while Prism enforcement is on) has no active plan.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"The requested username is already in use, or is reserved (a role name such as postmaster, or an NT Connect name). These are reported identically so this endpoint cannot be used to enumerate existing inboxes.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"description":"The request body failed schema validation; the display name uses an NT Connect name; or the username with the organization's handle would pass 64 characters.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}},"get":{"summary":"List inboxes","tags":["Inboxes"],"description":"Pages through the organization's inboxes. Pass the nextCursor of a page as cursor to read the next.","parameters":[{"schema":{"minimum":1,"maximum":100,"default":25,"type":"integer"},"in":"query","name":"limit","required":false},{"schema":{"type":"string"},"in":"query","name":"cursor","required":false},{"schema":{"type":"string"},"in":"path","name":"orgId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"A page of inboxes.","content":{"application/json":{"schema":{"description":"A page of inboxes.","type":"object","required":["data","nextCursor"],"properties":{"data":{"type":"array","items":{"type":"object","required":["id","address","aliases","displayName","createdAt","heldCount","requireApproval","roleAddress"],"properties":{"id":{"type":"string"},"address":{"type":"string"},"aliases":{"description":"The inbox's other addresses. Mail to any of them lands in this inbox, and a reply goes from the one the original used. Empty for most inboxes.","type":"array","items":{"type":"string"}},"displayName":{"type":"string","nullable":true},"createdAt":{"format":"date-time","type":"string"},"heldCount":{"description":"Held, not yet expired messages: a count, no content.","type":"integer"},"requireApproval":{"description":"Sends from this inbox by API keys and members wait for an owner's or admin's approval.","type":"boolean"},"roleAddress":{"description":"One of NT Connect's role addresses on the shared domains (such as postmaster@); it cannot be deleted.","type":"boolean"},"unreadCount":{"description":"Present only with a sign-in token: threads in this inbox with mail this person hasn't opened.","type":"integer"}}}},"nextCursor":{"type":"string","nullable":true,"description":"The next page's cursor; null on the last page."}}}}}},"400":{"$ref":"#/components/responses/InvalidCursor"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"description":"The query string failed schema validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs/{orgId}/inboxes/{inboxId}":{"patch":{"summary":"Set inbox approval","tags":["Inboxes"],"description":"Switch whether sends from this inbox by API keys and members wait for an owner's or admin's approval. Admin and owner only; not available to API keys.","requestBody":{"required":true,"content":{"application/json":{"schema":{"additionalProperties":false,"type":"object","required":["requireApproval"],"properties":{"requireApproval":{"type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string"},"in":"path","name":"inboxId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"The inbox.","content":{"application/json":{"schema":{"type":"object","required":["id","address","aliases","displayName","createdAt","heldCount","requireApproval","roleAddress"],"properties":{"id":{"type":"string"},"address":{"type":"string"},"aliases":{"description":"The inbox's other addresses. Mail to any of them lands in this inbox, and a reply goes from the one the original used. Empty for most inboxes.","type":"array","items":{"type":"string"}},"displayName":{"type":"string","nullable":true},"createdAt":{"format":"date-time","type":"string"},"heldCount":{"description":"Held, not yet expired messages: a count, no content.","type":"integer"},"requireApproval":{"description":"Sends from this inbox by API keys and members wait for an owner's or admin's approval.","type":"boolean"},"roleAddress":{"description":"One of NT Connect's role addresses on the shared domains (such as postmaster@); it cannot be deleted.","type":"boolean"},"unreadCount":{"description":"Present only with a sign-in token: threads in this inbox with mail this person hasn't opened.","type":"integer"}},"description":"The inbox."}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"$ref":"#/components/responses/ValidationFailed"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}},"delete":{"summary":"Delete inbox","tags":["Inboxes"],"description":"Deletes the inbox for good. Its address is retired and never issued again, and mail sent to it is refused at RCPT TO. All of its mail and drafts are deleted. An inbox.deleted event is sent. Answers 204; 404 when the inbox is not in this organization or is already deleted. NT Connect's role addresses on the shared domains (such as postmaster@) cannot be deleted: 403. Sign-in token only; needs the admin role or above.","parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string"},"in":"path","name":"inboxId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"204":{"description":"The inbox was deleted."},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"The member's role in the organization is below admin; the inbox is one of NT Connect's role addresses (such as postmaster@ or abuse@), which cannot be deleted; or the organization is suspended.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"description":"No such inbox in this organization (the id is unknown, belongs to another organization, or the inbox is already deleted), or no such organization for this member.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}},"get":{"summary":"Get inbox","tags":["Inboxes"],"description":"Returns one inbox of the organization: its address, display name, approval setting and count of held messages.","parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string"},"in":"path","name":"inboxId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"The inbox.","content":{"application/json":{"schema":{"type":"object","required":["id","address","aliases","displayName","createdAt","heldCount","requireApproval","roleAddress"],"properties":{"id":{"type":"string"},"address":{"type":"string"},"aliases":{"description":"The inbox's other addresses. Mail to any of them lands in this inbox, and a reply goes from the one the original used. Empty for most inboxes.","type":"array","items":{"type":"string"}},"displayName":{"type":"string","nullable":true},"createdAt":{"format":"date-time","type":"string"},"heldCount":{"description":"Held, not yet expired messages: a count, no content.","type":"integer"},"requireApproval":{"description":"Sends from this inbox by API keys and members wait for an owner's or admin's approval.","type":"boolean"},"roleAddress":{"description":"One of NT Connect's role addresses on the shared domains (such as postmaster@); it cannot be deleted.","type":"boolean"},"unreadCount":{"description":"Present only with a sign-in token: threads in this inbox with mail this person hasn't opened.","type":"integer"}},"description":"The inbox."}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/inboxes/{inboxId}":{"delete":{"summary":"Delete inbox","tags":["Inboxes"],"description":"Deletes the inbox for good. Its address is retired and never issued again, and mail sent to it is refused at RCPT TO. All of its mail and drafts are deleted. An inbox.deleted event is sent. Answers 204; 404 when the inbox is not in this organization or is already deleted. NT Connect's role addresses on the shared domains (such as postmaster@) cannot be deleted: 403. Needs an API key that an owner or admin has allowed to delete inboxes; any other key gets 403. The permission is checked before the inbox is looked up, so such a key gets 403 for any id, even one that does not exist.","parameters":[{"schema":{"type":"string"},"in":"path","name":"inboxId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"The inbox was deleted."},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"This API key is not allowed to delete inboxes (an owner or admin can allow it on the API keys page); the inbox is one of NT Connect's role addresses (such as postmaster@ or abuse@), which cannot be deleted; or the organization is suspended.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"description":"No such inbox in this organization: the id is unknown, belongs to another organization, or the inbox is already deleted.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}},"get":{"summary":"Get inbox","tags":["Inboxes"],"description":"Returns one inbox of the organization: its address, display name, approval setting and count of held messages.","parameters":[{"schema":{"type":"string"},"in":"path","name":"inboxId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The inbox.","content":{"application/json":{"schema":{"type":"object","required":["id","address","aliases","displayName","createdAt","heldCount","requireApproval","roleAddress"],"properties":{"id":{"type":"string"},"address":{"type":"string"},"aliases":{"description":"The inbox's other addresses. Mail to any of them lands in this inbox, and a reply goes from the one the original used. Empty for most inboxes.","type":"array","items":{"type":"string"}},"displayName":{"type":"string","nullable":true},"createdAt":{"format":"date-time","type":"string"},"heldCount":{"description":"Held, not yet expired messages: a count, no content.","type":"integer"},"requireApproval":{"description":"Sends from this inbox by API keys and members wait for an owner's or admin's approval.","type":"boolean"},"roleAddress":{"description":"One of NT Connect's role addresses on the shared domains (such as postmaster@); it cannot be deleted.","type":"boolean"},"unreadCount":{"description":"Present only with a sign-in token: threads in this inbox with mail this person hasn't opened.","type":"integer"}},"description":"The inbox."}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v0/orgs/{orgId}/api-keys":{"get":{"summary":"List API keys","tags":["API keys"],"description":"Lists the organization's API keys. A key's secret is never shown again after it is created. Sign-in token only; needs the member role or above.","parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"The organization's API keys, revoked ones included.","content":{"application/json":{"schema":{"description":"The organization's API keys, revoked ones included.","type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"type":"object","required":["id","name","prefix","createdBy","createdAt","lastUsedAt","revokedAt","canDeleteInboxes"],"properties":{"id":{"description":"key_…","type":"string"},"name":{"type":"string"},"prefix":{"type":"string"},"createdBy":{"type":"string","nullable":true,"description":"The member who created it (usr_…)."},"createdAt":{"format":"date-time","type":"string"},"lastUsedAt":{"type":"string","nullable":true,"format":"date-time"},"revokedAt":{"type":"string","nullable":true,"format":"date-time"},"canDeleteInboxes":{"type":"boolean"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}},"post":{"summary":"Create API key","tags":["API keys"],"description":"Creates a named API key and returns its secret in the response. This is the only time the secret is shown. Sign-in token only; needs the admin role or above.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"minLength":1,"maxLength":100,"type":"string"},"canDeleteInboxes":{"type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"201":{"description":"The key, with its secret shown this once.","content":{"application/json":{"schema":{"description":"The key, with its secret shown this once.","type":"object","required":["id","name","prefix","createdBy","createdAt","lastUsedAt","revokedAt","canDeleteInboxes","key"],"properties":{"id":{"description":"key_…","type":"string"},"name":{"type":"string"},"prefix":{"type":"string"},"createdBy":{"type":"string","nullable":true,"description":"The member who created it (usr_…)."},"createdAt":{"format":"date-time","type":"string"},"lastUsedAt":{"type":"string","nullable":true,"format":"date-time"},"revokedAt":{"type":"string","nullable":true,"format":"date-time"},"canDeleteInboxes":{"type":"boolean"},"key":{"description":"The secret. Shown only in this response.","type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"$ref":"#/components/responses/ValidationFailed"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs/{orgId}/api-keys/{keyId}":{"patch":{"summary":"Set key permissions","tags":["API keys"],"description":"Allows or forbids one of the organization's API keys to delete inboxes. Answers 200 with the key; 404 when the key is not in this organization or is revoked. Sign-in token only; needs the admin role or above.","requestBody":{"required":true,"content":{"application/json":{"schema":{"additionalProperties":false,"type":"object","required":["canDeleteInboxes"],"properties":{"canDeleteInboxes":{"type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string"},"in":"path","name":"keyId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"The key.","content":{"application/json":{"schema":{"type":"object","required":["id","name","prefix","createdBy","createdAt","lastUsedAt","revokedAt","canDeleteInboxes"],"properties":{"id":{"description":"key_…","type":"string"},"name":{"type":"string"},"prefix":{"type":"string"},"createdBy":{"type":"string","nullable":true,"description":"The member who created it (usr_…)."},"createdAt":{"format":"date-time","type":"string"},"lastUsedAt":{"type":"string","nullable":true,"format":"date-time"},"revokedAt":{"type":"string","nullable":true,"format":"date-time"},"canDeleteInboxes":{"type":"boolean"}},"description":"The key."}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"$ref":"#/components/responses/ValidationFailed"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}},"delete":{"summary":"Revoke API key","tags":["API keys"],"description":"Revokes one of the organization's API keys. Answers 204; 404 when the key is not in this organization. Sign-in token only; needs the admin role or above.","parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string"},"in":"path","name":"keyId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"204":{"description":"The key was revoked."},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs/{orgId}/billing":{"get":{"summary":"Get billing","tags":["Billing and usage"],"description":"Returns the organization's plan, mail status, lapse state and this cycle's usage. If the billing provider does not answer, the plan is null and planUnavailable is true rather than an error. Sign-in token only.","parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"The organization's plan, mail status, lapse state and usage this cycle.","content":{"application/json":{"schema":{"description":"The organization's plan, mail status, lapse state and usage this cycle.","type":"object","required":["tier","provisionedAt","mailStatus","lapse","plan","planUnavailable","usage"],"properties":{"tier":{"type":"string","nullable":true},"provisionedAt":{"type":"string","nullable":true,"format":"date-time"},"mailStatus":{"type":"string","enum":["receiving","held","refused_no_plan","refused_low_balance","suspended"],"description":"What happens to new mail now."},"lapse":{"type":"object","required":["held","awaitingFallback","fellBack"],"properties":{"held":{"type":"boolean"},"awaitingFallback":{"type":"boolean"},"fellBack":{"type":"boolean"}}},"plan":{"description":"The billing provider's live plan; null when it did not answer.","type":"object","required":["granted","tier","kind","paymentState","periodStart","interval"],"properties":{"granted":{"type":"boolean"},"tier":{"type":"string","nullable":true},"kind":{"type":"string","nullable":true},"paymentState":{"type":"string","nullable":true},"periodStart":{"type":"string","nullable":true},"interval":{"type":"string","enum":["month","year",null],"nullable":true}},"nullable":true},"planUnavailable":{"type":"boolean"},"usage":{"description":"Usage this cycle: the billed figures, with our own counts beside them; null when the provider gives none.","type":"object","required":["periodStart","periodEnd","allowance","credit","used","available","carriedDebt","purchasedThisCycle","received","sent"],"properties":{"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"allowance":{"type":"number"},"credit":{"type":"number"},"used":{"type":"number"},"available":{"type":"number"},"carriedDebt":{"type":"number"},"purchasedThisCycle":{"type":"number"},"received":{"description":"Our count of received mail this cycle.","type":"integer"},"sent":{"description":"Our count of sent mail this cycle, one per recipient.","type":"integer"}},"nullable":true}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs/{orgId}/billing/refresh":{"post":{"summary":"Refresh billing","tags":["Billing and usage"],"description":"Re-reads the plan from the billing provider and returns the same body as GET /v0/orgs/{orgId}/billing. Answers 503 when billing is not configured. Sign-in token only.","parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"The organization's plan, mail status, lapse state and usage this cycle.","content":{"application/json":{"schema":{"description":"The organization's plan, mail status, lapse state and usage this cycle.","type":"object","required":["tier","provisionedAt","mailStatus","lapse","plan","planUnavailable","usage"],"properties":{"tier":{"type":"string","nullable":true},"provisionedAt":{"type":"string","nullable":true,"format":"date-time"},"mailStatus":{"type":"string","enum":["receiving","held","refused_no_plan","refused_low_balance","suspended"],"description":"What happens to new mail now."},"lapse":{"type":"object","required":["held","awaitingFallback","fellBack"],"properties":{"held":{"type":"boolean"},"awaitingFallback":{"type":"boolean"},"fellBack":{"type":"boolean"}}},"plan":{"description":"The billing provider's live plan; null when it did not answer.","type":"object","required":["granted","tier","kind","paymentState","periodStart","interval"],"properties":{"granted":{"type":"boolean"},"tier":{"type":"string","nullable":true},"kind":{"type":"string","nullable":true},"paymentState":{"type":"string","nullable":true},"periodStart":{"type":"string","nullable":true},"interval":{"type":"string","enum":["month","year",null],"nullable":true}},"nullable":true},"planUnavailable":{"type":"boolean"},"usage":{"description":"Usage this cycle: the billed figures, with our own counts beside them; null when the provider gives none.","type":"object","required":["periodStart","periodEnd","allowance","credit","used","available","carriedDebt","purchasedThisCycle","received","sent"],"properties":{"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"allowance":{"type":"number"},"credit":{"type":"number"},"used":{"type":"number"},"available":{"type":"number"},"carriedDebt":{"type":"number"},"purchasedThisCycle":{"type":"number"},"received":{"description":"Our count of received mail this cycle.","type":"integer"},"sent":{"description":"Our count of sent mail this cycle, one per recipient.","type":"integer"}},"nullable":true}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs/{orgId}/billing/checkout":{"post":{"summary":"Plan checkout","tags":["Billing and usage"],"description":"Owner only. Returns a url to the hosted checkout page for the chosen tier (pro or scale) and interval (month or year). Answers 409 while the organization is still being set up or another checkout is starting. Sign-in token only.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["tier","interval"],"properties":{"tier":{"anyOf":[{"type":"string","enum":["pro"]},{"type":"string","enum":["scale"]}]},"interval":{"anyOf":[{"type":"string","enum":["month"]},{"type":"string","enum":["year"]}]}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"Where to send the browser: the hosted page.","content":{"application/json":{"schema":{"description":"Where to send the browser: the hosted page.","type":"object","required":["url"],"properties":{"url":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"$ref":"#/components/responses/ValidationFailed"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs/{orgId}/billing/topup":{"post":{"summary":"Top-up checkout","tags":["Billing and usage"],"description":"Owner only. Returns a url to the hosted checkout page for the message pack that goes with the organization's plan. Answers 409 on a plan without packs. Sign-in token only.","parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"Where to send the browser: the hosted page.","content":{"application/json":{"schema":{"description":"Where to send the browser: the hosted page.","type":"object","required":["url"],"properties":{"url":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs/{orgId}/billing/portal":{"post":{"summary":"Billing portal","tags":["Billing and usage"],"description":"Owner only. Returns a url to the hosted page where the payment method and subscription are managed. Answers 409 when there is no billing account yet. Sign-in token only.","parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"Where to send the browser: the hosted page.","content":{"application/json":{"schema":{"description":"Where to send the browser: the hosted page.","type":"object","required":["url"],"properties":{"url":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/usage":{"get":{"summary":"Get usage","tags":["Billing and usage"],"description":"Our count, by UTC day and by inbox, for an inclusive range of at most 400 days. `total`, `count` and `byDay[].count` are messages received; `sentTotal` and `sent` are messages sent, counted once per recipient. Not Prism's billed usage: that is `usage` on GET /v0/orgs/{orgId}/billing.","parameters":[{"schema":{"anyOf":[{"description":"First UTC day, YYYY-MM-DD.","type":"string"},{"type":"array","items":{"type":"string"}}]},"in":"query","name":"from","required":false},{"schema":{"anyOf":[{"description":"Last UTC day, YYYY-MM-DD, inclusive.","type":"string"},{"type":"array","items":{"type":"string"}}]},"in":"query","name":"to","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Our count of received and sent mail; not the billed usage.","content":{"application/json":{"schema":{"description":"Our count of received and sent mail; not the billed usage.","type":"object","required":["from","to","total","sentTotal","byDay","byInbox"],"properties":{"from":{"description":"First UTC day, YYYY-MM-DD.","type":"string"},"to":{"description":"Last UTC day, YYYY-MM-DD.","type":"string"},"total":{"description":"Messages received.","type":"integer"},"sentTotal":{"description":"Messages sent, one per recipient.","type":"integer"},"byDay":{"type":"array","items":{"type":"object","required":["day","count","sent"],"properties":{"day":{"description":"YYYY-MM-DD.","type":"string"},"count":{"description":"Received.","type":"integer"},"sent":{"description":"Sent, one per recipient.","type":"integer"}}}},"byInbox":{"type":"array","items":{"type":"object","required":["inboxId","address","deleted","count","sent"],"properties":{"inboxId":{"type":"string","nullable":true,"description":"null for mail received before usage tracking."},"address":{"type":"string","nullable":true},"deleted":{"type":"boolean"},"count":{"type":"integer"},"sent":{"type":"integer"}}}}}}}}},"400":{"description":"A bad range: from or to missing, given twice or not a real YYYY-MM-DD day; from after to; or more than 400 days.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/v0/orgs/{orgId}/usage":{"get":{"summary":"Get usage","tags":["Billing and usage"],"description":"Our count, by UTC day and by inbox, for an inclusive range of at most 400 days. `total`, `count` and `byDay[].count` are messages received; `sentTotal` and `sent` are messages sent, counted once per recipient. Not Prism's billed usage: that is `usage` on GET /v0/orgs/{orgId}/billing.","parameters":[{"schema":{"anyOf":[{"description":"First UTC day, YYYY-MM-DD.","type":"string"},{"type":"array","items":{"type":"string"}}]},"in":"query","name":"from","required":false},{"schema":{"anyOf":[{"description":"Last UTC day, YYYY-MM-DD, inclusive.","type":"string"},{"type":"array","items":{"type":"string"}}]},"in":"query","name":"to","required":false},{"schema":{"type":"string"},"in":"path","name":"orgId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"Our count of received and sent mail; not the billed usage.","content":{"application/json":{"schema":{"description":"Our count of received and sent mail; not the billed usage.","type":"object","required":["from","to","total","sentTotal","byDay","byInbox"],"properties":{"from":{"description":"First UTC day, YYYY-MM-DD.","type":"string"},"to":{"description":"Last UTC day, YYYY-MM-DD.","type":"string"},"total":{"description":"Messages received.","type":"integer"},"sentTotal":{"description":"Messages sent, one per recipient.","type":"integer"},"byDay":{"type":"array","items":{"type":"object","required":["day","count","sent"],"properties":{"day":{"description":"YYYY-MM-DD.","type":"string"},"count":{"description":"Received.","type":"integer"},"sent":{"description":"Sent, one per recipient.","type":"integer"}}}},"byInbox":{"type":"array","items":{"type":"object","required":["inboxId","address","deleted","count","sent"],"properties":{"inboxId":{"type":"string","nullable":true,"description":"null for mail received before usage tracking."},"address":{"type":"string","nullable":true},"deleted":{"type":"boolean"},"count":{"type":"integer"},"sent":{"type":"integer"}}}}}}}}},"400":{"description":"A bad range: from or to missing, given twice or not a real YYYY-MM-DD day; from after to; or more than 400 days.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs/{orgId}/lapse":{"get":{"summary":"Get lapse state","tags":["Billing and usage"],"description":"Shows whether the organization is in a payment lapse and where the choice of addresses to keep stands. Sign-in token only.","parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"The payment-lapse state and the inboxes it affects.","content":{"application/json":{"schema":{"description":"The payment-lapse state and the inboxes it affects.","type":"object","required":["state","enforcement","heldSince","fallbackAt","receivingStopsAt","deletedAt","deletionIsPermanent","canChoose","keepMode","keepMin","keepMax","freeQuota","inboxes"],"properties":{"state":{"type":"string","enum":["none","held","awaiting_fallback","fell_back"]},"enforcement":{"type":"boolean"},"heldSince":{"type":"string","nullable":true,"format":"date-time"},"fallbackAt":{"type":"string","nullable":true,"format":"date-time"},"receivingStopsAt":{"type":"string","nullable":true,"format":"date-time"},"deletedAt":{"type":"string","nullable":true,"format":"date-time"},"deletionIsPermanent":{"type":"boolean"},"canChoose":{"type":"boolean"},"keepMode":{"type":"string","enum":["choose","swap","restore",null],"description":"How a keep choice applies now; null when none can be made.","nullable":true},"keepMin":{"description":"The fewest addresses a choice may name now.","type":"integer"},"keepMax":{"description":"The most addresses a choice may name now.","type":"integer"},"freeQuota":{"type":"integer"},"inboxes":{"type":"array","items":{"type":"object","required":["id","address","keepChosen","lastMailAt","status","receivingStopsAt","deletedAt"],"properties":{"id":{"type":"string"},"address":{"type":"string"},"keepChosen":{"type":"boolean"},"lastMailAt":{"type":"string","nullable":true,"format":"date-time"},"status":{"type":"string","enum":["kept","stops","stopped"]},"receivingStopsAt":{"type":"string","nullable":true,"format":"date-time"},"deletedAt":{"type":"string","nullable":true,"format":"date-time"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs/{orgId}/lapse/keep":{"put":{"summary":"Keep inboxes","tags":["Billing and usage"],"description":"Sets which inboxes (at most 50) keep their addresses through a payment lapse. Admin or owner. Answers 409 when there is no lapse in progress, or when addresses have already stopped receiving and the choice can no longer change. Sign-in token only.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["inboxIds"],"properties":{"inboxIds":{"maxItems":50,"type":"array","items":{"type":"string"}}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"The payment-lapse state and the inboxes it affects.","content":{"application/json":{"schema":{"description":"The payment-lapse state and the inboxes it affects.","type":"object","required":["state","enforcement","heldSince","fallbackAt","receivingStopsAt","deletedAt","deletionIsPermanent","canChoose","keepMode","keepMin","keepMax","freeQuota","inboxes"],"properties":{"state":{"type":"string","enum":["none","held","awaiting_fallback","fell_back"]},"enforcement":{"type":"boolean"},"heldSince":{"type":"string","nullable":true,"format":"date-time"},"fallbackAt":{"type":"string","nullable":true,"format":"date-time"},"receivingStopsAt":{"type":"string","nullable":true,"format":"date-time"},"deletedAt":{"type":"string","nullable":true,"format":"date-time"},"deletionIsPermanent":{"type":"boolean"},"canChoose":{"type":"boolean"},"keepMode":{"type":"string","enum":["choose","swap","restore",null],"description":"How a keep choice applies now; null when none can be made.","nullable":true},"keepMin":{"description":"The fewest addresses a choice may name now.","type":"integer"},"keepMax":{"description":"The most addresses a choice may name now.","type":"integer"},"freeQuota":{"type":"integer"},"inboxes":{"type":"array","items":{"type":"object","required":["id","address","keepChosen","lastMailAt","status","receivingStopsAt","deletedAt"],"properties":{"id":{"type":"string"},"address":{"type":"string"},"keepChosen":{"type":"boolean"},"lastMailAt":{"type":"string","nullable":true,"format":"date-time"},"status":{"type":"string","enum":["kept","stops","stopped"]},"receivingStopsAt":{"type":"string","nullable":true,"format":"date-time"},"deletedAt":{"type":"string","nullable":true,"format":"date-time"}}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"$ref":"#/components/responses/ValidationFailed"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/me/session":{"post":{"summary":"Start a session","tags":["Account"],"description":"Call right after the sign-in redirect. Registers the signed-in user, taking their email from the identity provider with the caller's own token, and returns their profile. Idempotent; it never creates an organization.","security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"The signed-in user and their organizations.","content":{"application/json":{"schema":{"description":"The signed-in user and their organizations.","type":"object","required":["user","orgs","canCreateFreeOrg","canStart"],"properties":{"user":{"type":"object","required":["id","email","name"],"properties":{"id":{"description":"usr_…, as in the members list.","type":"string"},"email":{"type":"string","nullable":true},"name":{"type":"string","nullable":true}}},"orgs":{"type":"array","items":{"type":"object","required":["id","name","role","tier","handle"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"role":{"type":"string","enum":["owner","admin","member","viewer"]},"tier":{"type":"string","nullable":true},"handle":{"type":"string","nullable":true}}}},"canCreateFreeOrg":{"type":"boolean"},"canStart":{"description":"May create an organization now.","type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"description":"No valid access token, or (GET) sign-in not completed.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"503":{"description":"Sign-in is not configured, or Zitadel could not be reached; nothing was written.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}}},"/v0/me":{"get":{"summary":"Get the user","tags":["Account"],"description":"Returns the signed-in user's profile. Answers 401 until sign-in has been completed with POST /v0/me/session.","security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"The signed-in user and their organizations.","content":{"application/json":{"schema":{"description":"The signed-in user and their organizations.","type":"object","required":["user","orgs","canCreateFreeOrg","canStart"],"properties":{"user":{"type":"object","required":["id","email","name"],"properties":{"id":{"description":"usr_…, as in the members list.","type":"string"},"email":{"type":"string","nullable":true},"name":{"type":"string","nullable":true}}},"orgs":{"type":"array","items":{"type":"object","required":["id","name","role","tier","handle"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"role":{"type":"string","enum":["owner","admin","member","viewer"]},"tier":{"type":"string","nullable":true},"handle":{"type":"string","nullable":true}}}},"canCreateFreeOrg":{"type":"boolean"},"canStart":{"description":"May create an organization now.","type":"boolean"}}}}}},"401":{"description":"No valid access token, or (GET) sign-in not completed.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"503":{"description":"Sign-in is not configured, or Zitadel could not be reached; nothing was written.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}}},"/v0/event-types":{"get":{"summary":"Event types","tags":["Webhooks"],"description":"Lists the event types a webhook endpoint can subscribe to. Sign-in token only.","security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"The event types a webhook endpoint can subscribe to.","content":{"application/json":{"schema":{"description":"The event types a webhook endpoint can subscribe to.","type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"type":"string"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs/{orgId}/members":{"get":{"summary":"List members","tags":["Members"],"description":"Lists the organization's members and their roles. Sign-in token only.","parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"The organization's members.","content":{"application/json":{"schema":{"description":"The organization's members.","type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"type":"object","required":["userId","email","name","role","createdAt"],"properties":{"userId":{"description":"usr_…","type":"string"},"email":{"type":"string","nullable":true},"name":{"type":"string","nullable":true},"role":{"type":"string","enum":["owner","admin","member","viewer"]},"createdAt":{"format":"date-time","type":"string"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs/{orgId}/members/{userId}":{"patch":{"summary":"Set member role","tags":["Members"],"description":"Admin or owner. Answers 204. The owner's role changes only by an ownership transfer (409). Sign-in token only.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["role"],"properties":{"role":{"anyOf":[{"type":"string","enum":["admin"]},{"type":"string","enum":["member"]},{"type":"string","enum":["viewer"]}]}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string"},"in":"path","name":"userId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"204":{"description":"The role was changed."},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"$ref":"#/components/responses/ValidationFailed"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}},"delete":{"summary":"Remove member or leave","tags":["Members"],"description":"Removes a member; any member may remove themselves, removing someone else needs admin. Answers 204. The owner cannot be removed or leave (409). Sign-in token only.","parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string"},"in":"path","name":"userId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"204":{"description":"The member was removed."},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Only an admin can remove other members; removing someone else waits while the organization is suspended; or the organization's deletion is pending.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"The owner cannot be removed or leave.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs/{orgId}/invitations":{"post":{"summary":"Invite","tags":["Members"],"description":"Admin or owner. Creates an invitation for an email address with a role and answers 201. Answers 409 if the person is already a member. Sign-in token only.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email","role"],"properties":{"email":{"minLength":3,"maxLength":254,"pattern":"^\\s*[^@\\s]+@[^@\\s]+\\s*$","type":"string"},"role":{"anyOf":[{"type":"string","enum":["admin"]},{"type":"string","enum":["member"]},{"type":"string","enum":["viewer"]}]}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"201":{"description":"The invitation, with its link shown this once.","content":{"application/json":{"schema":{"description":"The invitation, with its link shown this once.","type":"object","required":["id","link","expiresAt"],"properties":{"id":{"description":"inv_…","type":"string"},"link":{"description":"The invitation link. It exists only in this response.","type":"string"},"expiresAt":{"format":"date-time","type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"The person is already a member.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"$ref":"#/components/responses/ValidationFailed"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}},"get":{"summary":"List invitations","tags":["Members"],"description":"Admin or owner. Lists the organization's open invitations. Sign-in token only.","parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"The open invitations.","content":{"application/json":{"schema":{"description":"The open invitations.","type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"type":"object","required":["id","email","role","createdAt","expiresAt"],"properties":{"id":{"description":"inv_…","type":"string"},"email":{"type":"string"},"role":{"type":"string","enum":["admin","member","viewer"]},"createdAt":{"format":"date-time","type":"string"},"expiresAt":{"format":"date-time","type":"string"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs/{orgId}/invitations/{id}":{"delete":{"summary":"Revoke invitation","tags":["Members"],"description":"Admin or owner. Revokes an open invitation. Answers 204, or 404 if there is no such open invitation. Sign-in token only.","parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"204":{"description":"The invitation was revoked."},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/invitations/accept":{"post":{"summary":"Accept invitation","tags":["Members"],"description":"Joins the organization an invitation token names. The signed-in user's verified email must match the invited address (403 otherwise). Sign-in token only.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["token"],"properties":{"token":{"minLength":1,"maxLength":200,"type":"string"}}}}}},"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"The organization joined, and the role in it.","content":{"application/json":{"schema":{"description":"The organization joined, and the role in it.","type":"object","required":["orgId","role"],"properties":{"orgId":{"type":"string"},"role":{"type":"string","enum":["owner","admin","member","viewer"]}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Not for this user. The signed-in user's email is not verified or not the invited one, the user belongs to a suspended organization or one being deleted, or the inviting organization is suspended or being deleted.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"description":"The invitation token is not a valid open invitation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"$ref":"#/components/responses/ValidationFailed"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs":{"post":{"summary":"Create org","tags":["Organizations"],"description":"Creates an organization for the signed-in user and returns it with its first API key, shown once. A user may own only one organization on the free plan (409). Omit handle to have one suggested from the name. Sign-in token only.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"minLength":1,"maxLength":200,"type":"string"},"handle":{"minLength":1,"maxLength":64,"description":"3 to 30 lower-case letters, digits or single hyphens, starting and ending with a letter or digit; fixed once set. Omit it to have one suggested from the name.","type":"string"}}}}}},"security":[{"zitadelAuth":[]}],"responses":{"201":{"description":"The organization (with its handle), its first API key (shown once) and where provisioning stands.","content":{"application/json":{"schema":{"description":"The organization (with its handle), its first API key (shown once) and where provisioning stands.","type":"object","required":["org","apiKey","provisioning"],"properties":{"org":{"type":"object","required":["id","name","tier","provisionedAt","role","inboxDomain","handle","inboxQuota","deletionScheduledFor","addressSuffix"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"tier":{"type":"string","nullable":true},"provisionedAt":{"type":"string","nullable":true,"format":"date-time"},"role":{"type":"string","enum":["owner","admin","member","viewer"]},"inboxDomain":{"description":"The domain this organization's next inbox is minted on.","type":"string"},"handle":{"type":"string","nullable":true,"description":"Fixed at creation; null only for an organization made before handles existed."},"inboxQuota":{"description":"How many active inboxes the organization may have.","type":"integer"},"deletionScheduledFor":{"type":"string","nullable":true,"format":"date-time","description":"When the organization's content will be erased, while an owner's deletion request is pending; null otherwise."},"addressSuffix":{"description":"How the next inbox address ends: a dot, the handle, @ and the domain; for NT Connect's own organizations, @ and the domain.","type":"string"}}},"apiKey":{"type":"object","required":["id","name","prefix","createdBy","createdAt","lastUsedAt","revokedAt","canDeleteInboxes","key"],"properties":{"id":{"description":"key_…","type":"string"},"name":{"type":"string"},"prefix":{"type":"string"},"createdBy":{"type":"string","nullable":true,"description":"The member who created it (usr_…)."},"createdAt":{"format":"date-time","type":"string"},"lastUsedAt":{"type":"string","nullable":true,"format":"date-time"},"revokedAt":{"type":"string","nullable":true,"format":"date-time"},"canDeleteInboxes":{"type":"boolean"},"key":{"description":"The secret. Shown only in this response.","type":"string"}}},"provisioning":{"type":"string","enum":["granted","pending"]}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"The user belongs to a suspended organization or one being deleted, or is still on the waitlist.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"409":{"description":"The handle is taken, or the user already owns an organization on the free plan (orgId names it).","content":{"application/json":{"schema":{"description":"The handle is taken, or the user already owns an organization on the free plan (orgId names it)."}}}},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"description":"The handle has the wrong shape or uses an NT Connect name, or the name is blank.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs/{orgId}":{"get":{"summary":"Get org","tags":["Organizations"],"description":"Returns the organization and the caller's role in it. Sign-in token only.","parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"The organization.","content":{"application/json":{"schema":{"type":"object","required":["id","name","tier","provisionedAt","role","inboxDomain","handle","inboxQuota","deletionScheduledFor","addressSuffix"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"tier":{"type":"string","nullable":true},"provisionedAt":{"type":"string","nullable":true,"format":"date-time"},"role":{"type":"string","enum":["owner","admin","member","viewer"]},"inboxDomain":{"description":"The domain this organization's next inbox is minted on.","type":"string"},"handle":{"type":"string","nullable":true,"description":"Fixed at creation; null only for an organization made before handles existed."},"inboxQuota":{"description":"How many active inboxes the organization may have.","type":"integer"},"deletionScheduledFor":{"type":"string","nullable":true,"format":"date-time","description":"When the organization's content will be erased, while an owner's deletion request is pending; null otherwise."},"addressSuffix":{"description":"How the next inbox address ends: a dot, the handle, @ and the domain; for NT Connect's own organizations, @ and the domain.","type":"string"}},"description":"The organization."}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}},"patch":{"summary":"Rename org","tags":["Organizations"],"description":"Admin or owner. Changes the organization's name; the handle is fixed once set. Sign-in token only.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"minLength":1,"maxLength":200,"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"The renamed organization.","content":{"application/json":{"schema":{"type":"object","required":["id","name","tier","provisionedAt","role","inboxDomain","handle","inboxQuota","deletionScheduledFor","addressSuffix"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"tier":{"type":"string","nullable":true},"provisionedAt":{"type":"string","nullable":true,"format":"date-time"},"role":{"type":"string","enum":["owner","admin","member","viewer"]},"inboxDomain":{"description":"The domain this organization's next inbox is minted on.","type":"string"},"handle":{"type":"string","nullable":true,"description":"Fixed at creation; null only for an organization made before handles existed."},"inboxQuota":{"description":"How many active inboxes the organization may have.","type":"integer"},"deletionScheduledFor":{"type":"string","nullable":true,"format":"date-time","description":"When the organization's content will be erased, while an owner's deletion request is pending; null otherwise."},"addressSuffix":{"description":"How the next inbox address ends: a dot, the handle, @ and the domain; for NT Connect's own organizations, @ and the domain.","type":"string"}},"description":"The renamed organization."}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"$ref":"#/components/responses/ValidationFailed"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}},"delete":{"summary":"Delete org","tags":["Organizations"],"description":"Owner only. Starts a 7-day grace, after which the organization's content is erased; undo it any time before with POST /v0/orgs/{orgId}/undo-delete. Send the organization's exact name as confirm. Refused (409) while on a paid plan. Sign-in token only.","requestBody":{"required":true,"content":{"application/json":{"schema":{"additionalProperties":false,"type":"object","required":["confirm"],"properties":{"confirm":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"The deletion is scheduled; undo it before scheduledFor.","content":{"application/json":{"schema":{"description":"The deletion is scheduled; undo it before scheduledFor.","type":"object","required":["status","scheduledFor"],"properties":{"status":{"type":"string","enum":["deletion_scheduled"]},"scheduledFor":{"format":"date-time","description":"When the content will be erased.","type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"On a paid plan, NT Connect's own organization, or a deletion is already pending.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"description":"The confirm text is not the organization's exact name.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs/{orgId}/undo-delete":{"post":{"summary":"Undo deletion","tags":["Organizations"],"description":"Owner only. Cancels a pending deletion before the grace ends. 409 when none is pending. Sign-in token only.","parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"The organization, no longer being deleted.","content":{"application/json":{"schema":{"type":"object","required":["id","name","tier","provisionedAt","role","inboxDomain","handle","inboxQuota","deletionScheduledFor","addressSuffix"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"tier":{"type":"string","nullable":true},"provisionedAt":{"type":"string","nullable":true,"format":"date-time"},"role":{"type":"string","enum":["owner","admin","member","viewer"]},"inboxDomain":{"description":"The domain this organization's next inbox is minted on.","type":"string"},"handle":{"type":"string","nullable":true,"description":"Fixed at creation; null only for an organization made before handles existed."},"inboxQuota":{"description":"How many active inboxes the organization may have.","type":"integer"},"deletionScheduledFor":{"type":"string","nullable":true,"format":"date-time","description":"When the organization's content will be erased, while an owner's deletion request is pending; null otherwise."},"addressSuffix":{"description":"How the next inbox address ends: a dot, the handle, @ and the domain; for NT Connect's own organizations, @ and the domain.","type":"string"}},"description":"The organization, no longer being deleted."}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"No deletion is pending.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs/{orgId}/owner":{"post":{"summary":"Transfer ownership","tags":["Organizations"],"description":"Owner only. Makes an existing member the owner. Answers 409 if a transfer is already in progress or the new owner already owns a free-plan organization, and 503 if the transfer could not be completed, in which case nothing changed. Sign-in token only.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["userId"],"properties":{"userId":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"Ownership moved to this user.","content":{"application/json":{"schema":{"description":"Ownership moved to this user.","type":"object","required":["ownerUserId"],"properties":{"ownerUserId":{"description":"usr_…","type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"$ref":"#/components/responses/ValidationFailed"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs/{orgId}/webhooks":{"get":{"summary":"List webhooks","tags":["Webhooks"],"description":"Lists the organization's webhook endpoints. Sign-in token only.","parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"The organization's webhook endpoints.","content":{"application/json":{"schema":{"description":"The organization's webhook endpoints.","type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"type":"object","required":["id","url","eventTypes","enabled","createdAt"],"properties":{"id":{"description":"whk_…","type":"string"},"url":{"type":"string"},"eventTypes":{"description":"Empty: every event type.","type":"array","items":{"type":"string"}},"enabled":{"type":"boolean"},"createdAt":{"format":"date-time","type":"string"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}},"post":{"summary":"Create webhook","tags":["Webhooks"],"description":"Registers a URL to receive events, optionally limited to some event types. The signing secret is returned only here and by rotate-secret. Answers 201; 409 at the per-organization endpoint limit; 422 for an unknown event type or a URL that is refused. Needs the member role or above. Sign-in token only.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["url"],"properties":{"url":{"minLength":1,"maxLength":2048,"type":"string","example":"https://example.com/webhooks"},"eventTypes":{"maxItems":50,"type":"array","items":{"type":"string"}}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"201":{"description":"The new endpoint, with its signing secret shown this once.","content":{"application/json":{"schema":{"description":"The new endpoint, with its signing secret shown this once.","type":"object","required":["id","url","eventTypes","enabled","createdAt","secret"],"properties":{"id":{"description":"whk_…","type":"string"},"url":{"type":"string"},"eventTypes":{"description":"Empty: every event type.","type":"array","items":{"type":"string"}},"enabled":{"type":"boolean"},"createdAt":{"format":"date-time","type":"string"},"secret":{"description":"The signing secret. Shown only here and by rotate-secret.","type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"$ref":"#/components/responses/ValidationFailed"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs/{orgId}/webhooks/{endpointId}":{"patch":{"summary":"Update webhook","tags":["Webhooks"],"description":"Changes an endpoint's URL, event types or enabled flag. A new or re-enabled URL gets the same check as a new endpoint. Needs the member role or above. Sign-in token only.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"minLength":1,"maxLength":2048,"type":"string","example":"https://example.com/webhooks"},"eventTypes":{"maxItems":50,"type":"array","items":{"type":"string"}},"enabled":{"type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string"},"in":"path","name":"endpointId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"The endpoint.","content":{"application/json":{"schema":{"type":"object","required":["id","url","eventTypes","enabled","createdAt"],"properties":{"id":{"description":"whk_…","type":"string"},"url":{"type":"string"},"eventTypes":{"description":"Empty: every event type.","type":"array","items":{"type":"string"}},"enabled":{"type":"boolean"},"createdAt":{"format":"date-time","type":"string"}},"description":"The endpoint."}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"$ref":"#/components/responses/ValidationFailed"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}},"delete":{"summary":"Delete webhook","tags":["Webhooks"],"description":"Deletes the endpoint. Answers 204, or 404 if there is no such endpoint. Needs the member role or above. Sign-in token only.","parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string"},"in":"path","name":"endpointId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"204":{"description":"The endpoint was deleted."},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs/{orgId}/webhooks/{endpointId}/deliveries":{"get":{"summary":"Webhook deliveries","tags":["Webhooks"],"description":"Pages through an endpoint's delivery attempts. Pass the nextCursor of a page as cursor to read the next. Sign-in token only.","parameters":[{"schema":{"minimum":1,"maximum":100,"default":25,"type":"integer"},"in":"query","name":"limit","required":false},{"schema":{"type":"string"},"in":"query","name":"cursor","required":false},{"schema":{"type":"string"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string"},"in":"path","name":"endpointId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"A page of delivery attempts, newest first.","content":{"application/json":{"schema":{"description":"A page of delivery attempts, newest first.","type":"object","required":["data","nextCursor"],"properties":{"data":{"type":"array","items":{"type":"object","required":["id","eventId","eventType","state","held","statusCode","error","attempt","nextRetryAt","deliveredAt","createdAt"],"properties":{"id":{"description":"dlv_…","type":"string"},"eventId":{"description":"The event's id (evt_…), as in the webhook body.","type":"string"},"eventType":{"type":"string"},"state":{"type":"string","enum":["delivered","pending","retrying","held","failed"]},"held":{"description":"The same as state \"held\".","type":"boolean"},"statusCode":{"type":"integer","nullable":true},"error":{"type":"string","nullable":true},"attempt":{"type":"integer"},"nextRetryAt":{"type":"string","nullable":true,"format":"date-time","description":"null when held or when no retry is scheduled."},"deliveredAt":{"type":"string","nullable":true,"format":"date-time"},"createdAt":{"format":"date-time","type":"string"}}}},"nextCursor":{"type":"string","nullable":true,"description":"The next page's cursor; null on the last page."}}}}}},"400":{"$ref":"#/components/responses/InvalidCursor"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs/{orgId}/webhooks/{endpointId}/rotate-secret":{"post":{"summary":"Rotate secret","tags":["Webhooks"],"description":"Issues a new signing secret for the endpoint and returns it; this is the only time it is shown. Needs the member role or above. Sign-in token only.","parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string"},"in":"path","name":"endpointId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"The new signing secret.","content":{"application/json":{"schema":{"description":"The new signing secret.","type":"object","required":["secret"],"properties":{"secret":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/suppressions":{"get":{"summary":"List suppressions","tags":["Suppressions"],"description":"Addresses this organization will not send to, newest first.","parameters":[{"schema":{"minimum":1,"maximum":100,"default":25,"type":"integer"},"in":"query","name":"limit","required":false},{"schema":{"type":"string"},"in":"query","name":"cursor","required":false},{"schema":{"minLength":1,"maxLength":254,"type":"string"},"in":"query","name":"search","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"A page of suppressions.","content":{"application/json":{"schema":{"description":"A page of suppressions.","type":"object","required":["data","nextCursor"],"properties":{"data":{"type":"array","items":{"type":"object","required":["address","reason","source","messageId","createdAt"],"properties":{"address":{"type":"string"},"reason":{"type":"string","enum":["hard_bounce","complaint","manual"]},"source":{"type":"string","enum":["ses","api"]},"messageId":{"type":"string","nullable":true,"description":"The message whose bounce or complaint caused it."},"createdAt":{"format":"date-time","type":"string"}}}},"nextCursor":{"type":"string","nullable":true,"description":"The next page's cursor; null on the last page."}}}}}},"400":{"$ref":"#/components/responses/InvalidCursor"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"description":"The query string failed schema validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}},"delete":{"summary":"Remove suppression","tags":["Suppressions"],"description":"Remove an address from the suppression list. A complaint can be removed only by an organization admin, in the console.","parameters":[{"schema":{"minLength":3,"maxLength":254,"type":"string"},"example":"a@example.com","in":"query","name":"address","required":true,"description":"The suppressed address, in any case."}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"The address was removed."},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"description":"No such suppression: the address is not suppressed in this organization (or, at /v0/orgs/{orgId}/…, no such organization).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"422":{"description":"The query string failed schema validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}}},"/v0/orgs/{orgId}/suppressions":{"get":{"summary":"List suppressions","tags":["Suppressions"],"description":"Addresses this organization will not send to, newest first.","parameters":[{"schema":{"minimum":1,"maximum":100,"default":25,"type":"integer"},"in":"query","name":"limit","required":false},{"schema":{"type":"string"},"in":"query","name":"cursor","required":false},{"schema":{"minLength":1,"maxLength":254,"type":"string"},"in":"query","name":"search","required":false},{"schema":{"type":"string"},"in":"path","name":"orgId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"A page of suppressions.","content":{"application/json":{"schema":{"description":"A page of suppressions.","type":"object","required":["data","nextCursor"],"properties":{"data":{"type":"array","items":{"type":"object","required":["address","reason","source","messageId","createdAt"],"properties":{"address":{"type":"string"},"reason":{"type":"string","enum":["hard_bounce","complaint","manual"]},"source":{"type":"string","enum":["ses","api"]},"messageId":{"type":"string","nullable":true,"description":"The message whose bounce or complaint caused it."},"createdAt":{"format":"date-time","type":"string"}}}},"nextCursor":{"type":"string","nullable":true,"description":"The next page's cursor; null on the last page."}}}}}},"400":{"$ref":"#/components/responses/InvalidCursor"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"description":"The query string failed schema validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}},"delete":{"summary":"Remove suppression","tags":["Suppressions"],"description":"Remove an address from the suppression list. A complaint can be removed only by an organization admin, in the console.","parameters":[{"schema":{"minLength":3,"maxLength":254,"type":"string"},"example":"a@example.com","in":"query","name":"address","required":true,"description":"The suppressed address, in any case."},{"schema":{"type":"string"},"in":"path","name":"orgId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"204":{"description":"The address was removed."},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"description":"No such suppression: the address is not suppressed in this organization (or, at /v0/orgs/{orgId}/…, no such organization).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"422":{"description":"The query string failed schema validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/status":{"get":{"summary":"Service status","tags":["Status"],"description":"Each component's current state and its last 90 UTC days of checks, oldest first: how many minutes were up, degraded, down and disabled. Outbound is `disabled` while sending is switched off, and carries `queued`, the number of sends waiting. A component with no check in the last 3 minutes is `unknown`. Needs no credential; cached for 30 seconds.","responses":{"200":{"description":"Each component's current state and daily history.","content":{"application/json":{"schema":{"description":"Each component's current state and daily history.","type":"object","required":["generatedAt","components"],"properties":{"generatedAt":{"format":"date-time","type":"string"},"components":{"type":"array","items":{"type":"object","required":["id","name","state","days"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"state":{"anyOf":[{"type":"string","enum":["up"]},{"type":"string","enum":["degraded"]},{"type":"string","enum":["down"]},{"type":"string","enum":["disabled"]},{"type":"string","enum":["unknown"]}]},"queued":{"minimum":0,"description":"Outbound only: sends waiting to go out at the latest check. Absent for the other components, and when the check is not recent.","type":"integer"},"days":{"type":"array","items":{"type":"object","required":["date","up","degraded","down","disabled"],"properties":{"date":{"description":"A UTC day, YYYY-MM-DD.","type":"string"},"up":{"type":"integer"},"degraded":{"type":"integer"},"down":{"type":"integer"},"disabled":{"description":"Minutes outbound was switched off (always 0 for the other components).","type":"integer"}}}}}}}}}}}}}}},"/v0/inboxes/{inboxId}/threads":{"get":{"summary":"List threads","tags":["Threads and messages"],"description":"Pages through the threads in one inbox, newest activity first. Pass the `nextCursor` of a page as `cursor` to read the next. The optional filters list only threads with a message matching all of them; a cursor works only with the filters it was returned for.","parameters":[{"schema":{"minimum":1,"maximum":100,"default":25,"type":"integer"},"in":"query","name":"limit","required":false},{"schema":{"type":"string"},"in":"query","name":"cursor","required":false},{"schema":{"minLength":1,"maxLength":200,"type":"string"},"in":"query","name":"q","required":false,"description":"Full-text search of subject, From, To, Cc and text: words are ANDed; `\"a phrase\"`, `or` and `-word` work."},{"schema":{"minLength":1,"maxLength":200,"type":"string"},"in":"query","name":"from","required":false,"description":"Only messages whose From address contains this, ignoring case."},{"schema":{"minLength":1,"maxLength":200,"type":"string"},"in":"query","name":"subject","required":false,"description":"Only messages whose subject contains this, ignoring case."},{"schema":{"format":"date-time","type":"string"},"in":"query","name":"after","required":false,"description":"Only messages created at or after this ISO 8601 time with its zone (`Z` or `+02:00`)."},{"schema":{"format":"date-time","type":"string"},"in":"query","name":"before","required":false,"description":"Only messages created before this ISO 8601 time with its zone (`Z` or `+02:00`)."},{"schema":{"type":"boolean"},"in":"query","name":"hasAttachments","required":false,"description":"true: only messages with an attachment; false: without."},{"schema":{"type":"string"},"in":"path","name":"inboxId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"A page of threads.","content":{"application/json":{"schema":{"description":"A page of threads.","type":"object","required":["data","nextCursor"],"properties":{"data":{"type":"array","items":{"type":"object","required":["id","inboxId","subject","participants","messageCount","lastMessageAt"],"properties":{"id":{"type":"string"},"inboxId":{"type":"string"},"subject":{"type":"string","nullable":true},"participants":{"type":"array","items":{"type":"string"}},"messageCount":{"type":"integer"},"lastMessageAt":{"format":"date-time","type":"string"},"unread":{"description":"Present only with a sign-in token: the thread has received mail this person hasn't opened.","type":"boolean"}}}},"nextCursor":{"type":"string","nullable":true,"description":"The next page's cursor; null on the last page."}}}}}},"400":{"$ref":"#/components/responses/InvalidCursor"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"description":"Invalid query. A parameter is malformed or out of range, `q` has no words, or `after` is later than `before`; the detail says which.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"503":{"description":"Search took too long; narrow it. On a sign-in token, also: sign-in could not be checked or is not configured.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}}},"/v0/orgs/{orgId}/inboxes/{inboxId}/threads":{"get":{"summary":"List threads","tags":["Threads and messages"],"description":"Pages through the threads in one inbox, newest activity first. Pass the `nextCursor` of a page as `cursor` to read the next. The optional filters list only threads with a message matching all of them; a cursor works only with the filters it was returned for.","parameters":[{"schema":{"minimum":1,"maximum":100,"default":25,"type":"integer"},"in":"query","name":"limit","required":false},{"schema":{"type":"string"},"in":"query","name":"cursor","required":false},{"schema":{"minLength":1,"maxLength":200,"type":"string"},"in":"query","name":"q","required":false,"description":"Full-text search of subject, From, To, Cc and text: words are ANDed; `\"a phrase\"`, `or` and `-word` work."},{"schema":{"minLength":1,"maxLength":200,"type":"string"},"in":"query","name":"from","required":false,"description":"Only messages whose From address contains this, ignoring case."},{"schema":{"minLength":1,"maxLength":200,"type":"string"},"in":"query","name":"subject","required":false,"description":"Only messages whose subject contains this, ignoring case."},{"schema":{"format":"date-time","type":"string"},"in":"query","name":"after","required":false,"description":"Only messages created at or after this ISO 8601 time with its zone (`Z` or `+02:00`)."},{"schema":{"format":"date-time","type":"string"},"in":"query","name":"before","required":false,"description":"Only messages created before this ISO 8601 time with its zone (`Z` or `+02:00`)."},{"schema":{"type":"boolean"},"in":"query","name":"hasAttachments","required":false,"description":"true: only messages with an attachment; false: without."},{"schema":{"type":"string"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string"},"in":"path","name":"inboxId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"A page of threads.","content":{"application/json":{"schema":{"description":"A page of threads.","type":"object","required":["data","nextCursor"],"properties":{"data":{"type":"array","items":{"type":"object","required":["id","inboxId","subject","participants","messageCount","lastMessageAt"],"properties":{"id":{"type":"string"},"inboxId":{"type":"string"},"subject":{"type":"string","nullable":true},"participants":{"type":"array","items":{"type":"string"}},"messageCount":{"type":"integer"},"lastMessageAt":{"format":"date-time","type":"string"},"unread":{"description":"Present only with a sign-in token: the thread has received mail this person hasn't opened.","type":"boolean"}}}},"nextCursor":{"type":"string","nullable":true,"description":"The next page's cursor; null on the last page."}}}}}},"400":{"$ref":"#/components/responses/InvalidCursor"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"description":"Invalid query. A parameter is malformed or out of range, `q` has no words, or `after` is later than `before`; the detail says which.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"503":{"description":"Search took too long; narrow it. On a sign-in token, also: sign-in could not be checked or is not configured.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}}},"/v0/threads":{"get":{"summary":"Search threads","tags":["Threads and messages"],"description":"Pages through the threads of every inbox in the organization, or of the one `inbox` names, that have a message matching all the filters given; at least one filter is required. Each thread carries its `inboxId`. Pass the `nextCursor` of a page as `cursor`, with the same filters, to read the next.","parameters":[{"schema":{"minimum":1,"maximum":100,"default":25,"type":"integer"},"in":"query","name":"limit","required":false},{"schema":{"type":"string"},"in":"query","name":"cursor","required":false},{"schema":{"minLength":1,"maxLength":200,"type":"string"},"example":"invoice","in":"query","name":"q","required":false,"description":"Full-text search of subject, From, To, Cc and text: words are ANDed; `\"a phrase\"`, `or` and `-word` work."},{"schema":{"minLength":1,"maxLength":200,"type":"string"},"in":"query","name":"from","required":false,"description":"Only messages whose From address contains this, ignoring case."},{"schema":{"minLength":1,"maxLength":200,"type":"string"},"in":"query","name":"subject","required":false,"description":"Only messages whose subject contains this, ignoring case."},{"schema":{"format":"date-time","type":"string"},"in":"query","name":"after","required":false,"description":"Only messages created at or after this ISO 8601 time with its zone (`Z` or `+02:00`)."},{"schema":{"format":"date-time","type":"string"},"in":"query","name":"before","required":false,"description":"Only messages created before this ISO 8601 time with its zone (`Z` or `+02:00`)."},{"schema":{"type":"boolean"},"in":"query","name":"hasAttachments","required":false,"description":"true: only messages with an attachment; false: without."},{"schema":{"type":"string"},"in":"query","name":"inbox","required":false,"description":"Only this inbox's threads (an `ibx_` id)."}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"A page of threads.","content":{"application/json":{"schema":{"description":"A page of threads.","type":"object","required":["data","nextCursor"],"properties":{"data":{"type":"array","items":{"type":"object","required":["id","inboxId","subject","participants","messageCount","lastMessageAt"],"properties":{"id":{"type":"string"},"inboxId":{"type":"string"},"subject":{"type":"string","nullable":true},"participants":{"type":"array","items":{"type":"string"}},"messageCount":{"type":"integer"},"lastMessageAt":{"format":"date-time","type":"string"},"unread":{"description":"Present only with a sign-in token: the thread has received mail this person hasn't opened.","type":"boolean"}}}},"nextCursor":{"type":"string","nullable":true,"description":"The next page's cursor; null on the last page."}}}}}},"400":{"$ref":"#/components/responses/InvalidCursor"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"description":"Not found. `inbox` is unknown, of the wrong kind, in another organization or deleted; on /v0/orgs/{orgId}/threads, also an organization the caller is not a member of.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"422":{"description":"Invalid query. A parameter is malformed or out of range, `q` has no words, or `after` is later than `before`; the detail says which. Or no filter was given (`inbox` alone is none).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"503":{"description":"Search took too long; narrow it. On a sign-in token, also: sign-in could not be checked or is not configured.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}}},"/v0/orgs/{orgId}/threads":{"get":{"summary":"Search threads","tags":["Threads and messages"],"description":"Pages through the threads of every inbox in the organization, or of the one `inbox` names, that have a message matching all the filters given; at least one filter is required. Each thread carries its `inboxId`. Pass the `nextCursor` of a page as `cursor`, with the same filters, to read the next.","parameters":[{"schema":{"minimum":1,"maximum":100,"default":25,"type":"integer"},"in":"query","name":"limit","required":false},{"schema":{"type":"string"},"in":"query","name":"cursor","required":false},{"schema":{"minLength":1,"maxLength":200,"type":"string"},"example":"invoice","in":"query","name":"q","required":false,"description":"Full-text search of subject, From, To, Cc and text: words are ANDed; `\"a phrase\"`, `or` and `-word` work."},{"schema":{"minLength":1,"maxLength":200,"type":"string"},"in":"query","name":"from","required":false,"description":"Only messages whose From address contains this, ignoring case."},{"schema":{"minLength":1,"maxLength":200,"type":"string"},"in":"query","name":"subject","required":false,"description":"Only messages whose subject contains this, ignoring case."},{"schema":{"format":"date-time","type":"string"},"in":"query","name":"after","required":false,"description":"Only messages created at or after this ISO 8601 time with its zone (`Z` or `+02:00`)."},{"schema":{"format":"date-time","type":"string"},"in":"query","name":"before","required":false,"description":"Only messages created before this ISO 8601 time with its zone (`Z` or `+02:00`)."},{"schema":{"type":"boolean"},"in":"query","name":"hasAttachments","required":false,"description":"true: only messages with an attachment; false: without."},{"schema":{"type":"string"},"in":"query","name":"inbox","required":false,"description":"Only this inbox's threads (an `ibx_` id)."},{"schema":{"type":"string"},"in":"path","name":"orgId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"A page of threads.","content":{"application/json":{"schema":{"description":"A page of threads.","type":"object","required":["data","nextCursor"],"properties":{"data":{"type":"array","items":{"type":"object","required":["id","inboxId","subject","participants","messageCount","lastMessageAt"],"properties":{"id":{"type":"string"},"inboxId":{"type":"string"},"subject":{"type":"string","nullable":true},"participants":{"type":"array","items":{"type":"string"}},"messageCount":{"type":"integer"},"lastMessageAt":{"format":"date-time","type":"string"},"unread":{"description":"Present only with a sign-in token: the thread has received mail this person hasn't opened.","type":"boolean"}}}},"nextCursor":{"type":"string","nullable":true,"description":"The next page's cursor; null on the last page."}}}}}},"400":{"$ref":"#/components/responses/InvalidCursor"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Not found. `inbox` is unknown, of the wrong kind, in another organization or deleted; on /v0/orgs/{orgId}/threads, also an organization the caller is not a member of.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"422":{"description":"Invalid query. A parameter is malformed or out of range, `q` has no words, or `after` is later than `before`; the detail says which. Or no filter was given (`inbox` alone is none).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"503":{"description":"Search took too long; narrow it. On a sign-in token, also: sign-in could not be checked or is not configured.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}}},"/v0/threads/{threadId}":{"get":{"summary":"Get thread","tags":["Threads and messages"],"description":"Returns one thread with a summary of each of its messages and its count of held messages. Read a message by its id for the full text.","parameters":[{"schema":{"type":"string"},"in":"path","name":"threadId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The thread and a summary of each visible message.","content":{"application/json":{"schema":{"description":"The thread and a summary of each visible message.","type":"object","required":["id","inboxId","subject","participants","messageCount","lastMessageAt","heldCount","messages"],"properties":{"id":{"type":"string"},"inboxId":{"type":"string"},"subject":{"type":"string","nullable":true},"participants":{"type":"array","items":{"type":"string"}},"messageCount":{"type":"integer"},"lastMessageAt":{"format":"date-time","type":"string"},"unread":{"description":"Present only with a sign-in token: the thread has received mail this person hasn't opened.","type":"boolean"},"heldCount":{"type":"integer"},"messages":{"description":"Visible messages, oldest first.","type":"array","items":{"type":"object","required":["id","channel","from","to","deliveredTo","subject","receivedAt","snippet","hasHtml","attachmentCount"],"properties":{"id":{"type":"string"},"channel":{"type":"string"},"from":{"type":"string","nullable":true},"to":{"type":"array","items":{"type":"string"},"nullable":true},"deliveredTo":{"type":"string","nullable":true,"description":"The inbox address a received message was delivered to; null for a sent message and for mail received before 2026-12-01."},"subject":{"type":"string","nullable":true},"receivedAt":{"format":"date-time","type":"string"},"snippet":{"type":"string","nullable":true,"description":"The first 200 characters of the text; null when there is none."},"hasHtml":{"type":"boolean"},"attachmentCount":{"type":"integer"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v0/orgs/{orgId}/threads/{threadId}":{"get":{"summary":"Get thread","tags":["Threads and messages"],"description":"Returns one thread with a summary of each of its messages and its count of held messages. Read a message by its id for the full text.","parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string"},"in":"path","name":"threadId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"The thread and a summary of each visible message.","content":{"application/json":{"schema":{"description":"The thread and a summary of each visible message.","type":"object","required":["id","inboxId","subject","participants","messageCount","lastMessageAt","heldCount","messages"],"properties":{"id":{"type":"string"},"inboxId":{"type":"string"},"subject":{"type":"string","nullable":true},"participants":{"type":"array","items":{"type":"string"}},"messageCount":{"type":"integer"},"lastMessageAt":{"format":"date-time","type":"string"},"unread":{"description":"Present only with a sign-in token: the thread has received mail this person hasn't opened.","type":"boolean"},"heldCount":{"type":"integer"},"messages":{"description":"Visible messages, oldest first.","type":"array","items":{"type":"object","required":["id","channel","from","to","deliveredTo","subject","receivedAt","snippet","hasHtml","attachmentCount"],"properties":{"id":{"type":"string"},"channel":{"type":"string"},"from":{"type":"string","nullable":true},"to":{"type":"array","items":{"type":"string"},"nullable":true},"deliveredTo":{"type":"string","nullable":true,"description":"The inbox address a received message was delivered to; null for a sent message and for mail received before 2026-12-01."},"subject":{"type":"string","nullable":true},"receivedAt":{"format":"date-time","type":"string"},"snippet":{"type":"string","nullable":true,"description":"The first 200 characters of the text; null when there is none."},"hasHtml":{"type":"boolean"},"attachmentCount":{"type":"integer"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/messages/{messageId}":{"get":{"summary":"Get message","tags":["Threads and messages"],"description":"Returns one message with its text body, attachments, sender authentication results (SPF, DKIM, DMARC) and, for a sent message, its recipients.","parameters":[{"schema":{"type":"string"},"in":"path","name":"messageId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The message. Email fields are null for other channels.","content":{"application/json":{"schema":{"description":"The message. Email fields are null for other channels.","type":"object","required":["id","threadId","inboxId","channel","direction","status","from","to","cc","deliveredTo","subject","messageIdHeader","inReplyTo","references","receivedAt","authentication","text","hasHtml","attachments","recipients","error","costCredited"],"properties":{"id":{"type":"string"},"threadId":{"type":"string"},"inboxId":{"type":"string"},"channel":{"type":"string"},"direction":{"description":"inbound or outbound.","type":"string"},"status":{"type":"string"},"from":{"type":"string","nullable":true},"to":{"type":"array","items":{"type":"string"},"nullable":true},"cc":{"type":"array","items":{"type":"string"},"nullable":true},"deliveredTo":{"type":"string","nullable":true,"description":"The inbox address a received message was delivered to; null for a sent message and for mail received before 2026-12-01."},"subject":{"type":"string","nullable":true},"messageIdHeader":{"type":"string","nullable":true},"inReplyTo":{"type":"string","nullable":true},"references":{"type":"array","items":{"type":"string"},"nullable":true},"receivedAt":{"format":"date-time","type":"string"},"authentication":{"type":"object","required":["spf","dkim","dmarc"],"properties":{"spf":{"type":"string","nullable":true},"dkim":{"type":"string","nullable":true},"dmarc":{"type":"string","nullable":true}}},"text":{"type":"string","nullable":true,"description":"null only when the message has no text."},"hasHtml":{"description":"true when the message has an HTML version. This JSON never carries the HTML: read it through a short-lived link from POST .../messages/{messageId}/view, or in the raw MIME from GET .../messages/{messageId}/raw.","type":"boolean"},"attachments":{"type":"array","items":{"type":"object","required":["id","filename","contentType","size","contentId"],"properties":{"id":{"type":"string"},"filename":{"type":"string","nullable":true},"contentType":{"type":"string","nullable":true},"size":{"description":"Bytes.","type":"integer"},"contentId":{"type":"string","nullable":true}}}},"recipients":{"description":"A sent message's recipients; null for a received one.","type":"array","items":{"type":"object","required":["address","kind","status","bounceType","detail"],"properties":{"address":{"type":"string"},"kind":{"type":"string","enum":["to","cc","bcc"]},"status":{"type":"string","enum":["queued","sent","delivered","bounced","complained","failed"]},"bounceType":{"type":"string","nullable":true},"detail":{"type":"string","nullable":true}}},"nullable":true},"error":{"type":"string","nullable":true,"description":"Why a failed sent message failed; null otherwise."},"costCredited":{"description":"true when the provider rejected a sent message after accepting it and its cost was credited back.","type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v0/orgs/{orgId}/messages/{messageId}":{"get":{"summary":"Get message","tags":["Threads and messages"],"description":"Returns one message with its text body, attachments, sender authentication results (SPF, DKIM, DMARC) and, for a sent message, its recipients.","parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string"},"in":"path","name":"messageId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"The message. Email fields are null for other channels.","content":{"application/json":{"schema":{"description":"The message. Email fields are null for other channels.","type":"object","required":["id","threadId","inboxId","channel","direction","status","from","to","cc","deliveredTo","subject","messageIdHeader","inReplyTo","references","receivedAt","authentication","text","hasHtml","attachments","recipients","error","costCredited"],"properties":{"id":{"type":"string"},"threadId":{"type":"string"},"inboxId":{"type":"string"},"channel":{"type":"string"},"direction":{"description":"inbound or outbound.","type":"string"},"status":{"type":"string"},"from":{"type":"string","nullable":true},"to":{"type":"array","items":{"type":"string"},"nullable":true},"cc":{"type":"array","items":{"type":"string"},"nullable":true},"deliveredTo":{"type":"string","nullable":true,"description":"The inbox address a received message was delivered to; null for a sent message and for mail received before 2026-12-01."},"subject":{"type":"string","nullable":true},"messageIdHeader":{"type":"string","nullable":true},"inReplyTo":{"type":"string","nullable":true},"references":{"type":"array","items":{"type":"string"},"nullable":true},"receivedAt":{"format":"date-time","type":"string"},"authentication":{"type":"object","required":["spf","dkim","dmarc"],"properties":{"spf":{"type":"string","nullable":true},"dkim":{"type":"string","nullable":true},"dmarc":{"type":"string","nullable":true}}},"text":{"type":"string","nullable":true,"description":"null only when the message has no text."},"hasHtml":{"description":"true when the message has an HTML version. This JSON never carries the HTML: read it through a short-lived link from POST .../messages/{messageId}/view, or in the raw MIME from GET .../messages/{messageId}/raw.","type":"boolean"},"attachments":{"type":"array","items":{"type":"object","required":["id","filename","contentType","size","contentId"],"properties":{"id":{"type":"string"},"filename":{"type":"string","nullable":true},"contentType":{"type":"string","nullable":true},"size":{"description":"Bytes.","type":"integer"},"contentId":{"type":"string","nullable":true}}}},"recipients":{"description":"A sent message's recipients; null for a received one.","type":"array","items":{"type":"object","required":["address","kind","status","bounceType","detail"],"properties":{"address":{"type":"string"},"kind":{"type":"string","enum":["to","cc","bcc"]},"status":{"type":"string","enum":["queued","sent","delivered","bounced","complained","failed"]},"bounceType":{"type":"string","nullable":true},"detail":{"type":"string","nullable":true}}},"nullable":true},"error":{"type":"string","nullable":true,"description":"Why a failed sent message failed; null otherwise."},"costCredited":{"description":"true when the provider rejected a sent message after accepting it and its cost was credited back.","type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/messages/{messageId}/raw":{"get":{"summary":"Raw MIME","tags":["Threads and messages"],"description":"Streams the message exactly as it was received or sent, as message/rfc822.","parameters":[{"schema":{"type":"string"},"in":"path","name":"messageId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The raw message.","content":{"message/rfc822":{"schema":{"format":"binary","type":"string"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v0/orgs/{orgId}/messages/{messageId}/raw":{"get":{"summary":"Raw MIME","tags":["Threads and messages"],"description":"Streams the message exactly as it was received or sent, as message/rfc822.","parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string"},"in":"path","name":"messageId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"The raw message.","content":{"message/rfc822":{"schema":{"format":"binary","type":"string"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/attachments/{attachmentId}":{"get":{"summary":"Attachment","tags":["Threads and messages"],"description":"Streams one message attachment with its stored content type and file name.","parameters":[{"schema":{"type":"string"},"in":"path","name":"attachmentId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The attachment, with its stored content type.","content":{"*/*":{"schema":{"format":"binary","type":"string"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v0/orgs/{orgId}/attachments/{attachmentId}":{"get":{"summary":"Attachment","tags":["Threads and messages"],"description":"Streams one message attachment with its stored content type and file name.","parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string"},"in":"path","name":"attachmentId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"The attachment, with its stored content type.","content":{"*/*":{"schema":{"format":"binary","type":"string"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/events":{"get":{"summary":"Read events","tags":["Events"],"description":"The org's event feed, in feed order. `since` should be a `nextCursor` from this feed, or an event id read from this feed; a webhook's `evt_` id is not covered by the settling delay and may skip a late-committing event. Ignore event types you don't recognise: new ones (most recently draft.submitted, draft.sent and draft.rejected) are added without a version change.","parameters":[{"schema":{"minimum":1,"maximum":100,"default":25,"type":"integer"},"in":"query","name":"limit","required":false},{"schema":{"anyOf":[{"type":"string","enum":["asc"]},{"type":"string","enum":["desc"]}]},"in":"query","name":"order","required":false},{"schema":{"type":"string"},"in":"query","name":"since","required":false},{"schema":{"type":"string"},"in":"query","name":"before","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"A page of events.","content":{"application/json":{"schema":{"description":"A page of events.","type":"object","required":["data","nextCursor"],"properties":{"data":{"type":"array","items":{"type":"object","required":["id","type","created_at","createdAt","data"],"properties":{"id":{"description":"evt_…","type":"string"},"type":{"type":"string"},"created_at":{"format":"date-time","description":"Deprecated; removed on or after 2026-12-21; use createdAt (the same value).","type":"string"},"createdAt":{"format":"date-time","description":"When the event happened.","type":"string"},"data":{"description":"The event's payload, as the webhook carries it."}}}},"nextCursor":{"type":"string","nullable":true,"description":"The next page's cursor; null on the last page."}}}}}},"400":{"description":"since with order=desc, or before with order=asc; or since or before names no event in this organization's feed (read again without it).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"description":"The query string failed schema validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}}},"/v0/orgs/{orgId}/events":{"get":{"summary":"Read events","tags":["Events"],"description":"The org's event feed, in feed order. `since` should be a `nextCursor` from this feed, or an event id read from this feed; a webhook's `evt_` id is not covered by the settling delay and may skip a late-committing event. Ignore event types you don't recognise: new ones (most recently draft.submitted, draft.sent and draft.rejected) are added without a version change.","parameters":[{"schema":{"minimum":1,"maximum":100,"default":25,"type":"integer"},"in":"query","name":"limit","required":false},{"schema":{"anyOf":[{"type":"string","enum":["asc"]},{"type":"string","enum":["desc"]}]},"in":"query","name":"order","required":false},{"schema":{"type":"string"},"in":"query","name":"since","required":false},{"schema":{"type":"string"},"in":"query","name":"before","required":false},{"schema":{"type":"string"},"in":"path","name":"orgId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"A page of events.","content":{"application/json":{"schema":{"description":"A page of events.","type":"object","required":["data","nextCursor"],"properties":{"data":{"type":"array","items":{"type":"object","required":["id","type","created_at","createdAt","data"],"properties":{"id":{"description":"evt_…","type":"string"},"type":{"type":"string"},"created_at":{"format":"date-time","description":"Deprecated; removed on or after 2026-12-21; use createdAt (the same value).","type":"string"},"createdAt":{"format":"date-time","description":"When the event happened.","type":"string"},"data":{"description":"The event's payload, as the webhook carries it."}}}},"nextCursor":{"type":"string","nullable":true,"description":"The next page's cursor; null on the last page."}}}}}},"400":{"description":"since with order=desc, or before with order=asc; or since or before names no event in this organization's feed (read again without it).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"description":"The query string failed schema validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs/{orgId}/threads/{threadId}/read":{"post":{"summary":"Mark thread read","tags":["Threads and messages"],"description":"Marks the thread read for the signed-in person, as of now. Sign-in token only; other members' unread state is unchanged.","parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string"},"in":"path","name":"threadId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"204":{"description":"The thread was marked."},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Not found. The thread is unknown, of the wrong kind, in another organization or has no visible message; or an organization the caller is not a member of.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs/{orgId}/threads/{threadId}/unread":{"post":{"summary":"Mark thread unread","tags":["Threads and messages"],"description":"Marks the thread unread for the signed-in person: every message in it counts as unread again. Sign-in token only; other members' unread state is unchanged.","parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string"},"in":"path","name":"threadId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"204":{"description":"The thread was marked."},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Not found. The thread is unknown, of the wrong kind, in another organization or has no visible message; or an organization the caller is not a member of.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/messages/{messageId}/view":{"post":{"summary":"Message view link","tags":["Threads and messages"],"description":"Returns a short-lived link (it expires in 300 seconds) to the message's HTML, served with remote images blocked unless remoteImages is true. Answers 409 when the message has no HTML version.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["remoteImages"],"properties":{"remoteImages":{"type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"messageId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"A signed link to the formatted view, valid for 300 seconds.","content":{"application/json":{"schema":{"description":"A signed link to the formatted view, valid for 300 seconds.","type":"object","required":["url","expiresAt","blockedRedirect"],"properties":{"url":{"type":"string"},"expiresAt":{"format":"date-time","type":"string"},"blockedRedirect":{"type":"string","nullable":true,"description":"The redirect the served copy blocked (a meta refresh's URL), or null."}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"$ref":"#/components/responses/ValidationFailed"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs/{orgId}/messages/{messageId}/view":{"post":{"summary":"Message view link","tags":["Threads and messages"],"description":"Returns a short-lived link (it expires in 300 seconds) to the message's HTML, served with remote images blocked unless remoteImages is true. Answers 409 when the message has no HTML version.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["remoteImages"],"properties":{"remoteImages":{"type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string"},"in":"path","name":"messageId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"A signed link to the formatted view, valid for 300 seconds.","content":{"application/json":{"schema":{"description":"A signed link to the formatted view, valid for 300 seconds.","type":"object","required":["url","expiresAt","blockedRedirect"],"properties":{"url":{"type":"string"},"expiresAt":{"format":"date-time","type":"string"},"blockedRedirect":{"type":"string","nullable":true,"description":"The redirect the served copy blocked (a meta refresh's URL), or null."}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"$ref":"#/components/responses/ValidationFailed"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/view/{token}":{"get":{"summary":"Message as HTML","tags":["Threads and messages"],"description":"Serves the message's HTML, formatted for reading. No API key needed: the signed token in the path, from the message's view link, is the credential.","parameters":[{"schema":{"type":"string"},"in":"path","name":"token","required":true}],"responses":{"200":{"description":"The message's HTML.","content":{"text/html":{"schema":{"type":"string"}}}},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/view/{token}/att/{attachmentId}":{"get":{"summary":"Viewed attachment","tags":["Threads and messages"],"description":"Serves one attachment of the message a view link names. The signed token is the credential and reaches only that message's attachments. Raster images are shown inline; anything else downloads.","parameters":[{"schema":{"type":"string"},"in":"path","name":"token","required":true},{"schema":{"type":"string"},"in":"path","name":"attachmentId","required":true}],"responses":{"200":{"description":"The attachment, with its stored content type.","content":{"*/*":{"schema":{"format":"binary","type":"string"}}}},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs/{orgId}/drafts/{draftId}/view":{"post":{"summary":"Draft view link","tags":["Drafts"],"description":"A short-lived link to a draft's HTML, served like a message's formatted view. Answers 409 when the draft has no HTML version. Sign-in token only.","requestBody":{"required":true,"content":{"application/json":{"schema":{"additionalProperties":false,"type":"object","required":["remoteImages"],"properties":{"remoteImages":{"type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string"},"in":"path","name":"draftId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"A signed link to the formatted view, valid for 300 seconds.","content":{"application/json":{"schema":{"description":"A signed link to the formatted view, valid for 300 seconds.","type":"object","required":["url","expiresAt","blockedRedirect"],"properties":{"url":{"type":"string"},"expiresAt":{"format":"date-time","type":"string"},"blockedRedirect":{"type":"string","nullable":true,"description":"The redirect the served copy blocked (a meta refresh's URL), or null."}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"$ref":"#/components/responses/ValidationFailed"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/draft-view/{token}":{"get":{"summary":"Draft as HTML","tags":["Drafts"],"description":"Serves the draft's HTML, formatted for reading. No API key needed: the signed token in the path, from the draft's view link, is the credential.","parameters":[{"schema":{"type":"string"},"in":"path","name":"token","required":true}],"responses":{"200":{"description":"The draft's HTML.","content":{"text/html":{"schema":{"type":"string"}}}},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/inboxes/{inboxId}/messages":{"post":{"summary":"Send message","tags":["Sending"],"description":"Send a new message from this inbox; it starts a new thread. Optional replyTo (addresses) and headers (custom X- headers) go into the message. Needs an Idempotency-Key header. Answers 202 once the message is queued. On an inbox that requires approval, an API key's or a member's request is held as a draft for an owner or admin instead: 202 {status: \"pending_approval\", draftId}.","requestBody":{"required":true,"content":{"application/json":{"schema":{"additionalProperties":false,"allOf":[{"anyOf":[{"required":["to"],"properties":{"to":{"type":"array","minItems":1}}},{"required":["cc"],"properties":{"cc":{"type":"array","minItems":1}}},{"required":["bcc"],"properties":{"bcc":{"type":"array","minItems":1}}}]},{"anyOf":[{"required":["text"]},{"required":["html"]}]}],"type":"object","properties":{"to":{"maxItems":50,"type":"array","items":{"maxLength":320,"type":"string","example":"a@example.com"}},"cc":{"maxItems":50,"type":"array","items":{"maxLength":320,"type":"string","example":"a@example.com"}},"bcc":{"maxItems":50,"type":"array","items":{"maxLength":320,"type":"string","example":"a@example.com"}},"subject":{"maxLength":998,"pattern":"^[^\\r\\n]*$","type":"string"},"text":{"type":"string"},"html":{"type":"string"},"attachments":{"maxItems":100,"type":"array","items":{"additionalProperties":false,"type":"object","required":["filename","contentType","contentBase64"],"properties":{"filename":{"minLength":1,"maxLength":255,"pattern":"^[^\\r\\n]*$","type":"string"},"contentType":{"maxLength":255,"pattern":"^[A-Za-z0-9!#$&^_.+-]+/[A-Za-z0-9!#$&^_.+-]+$","type":"string"},"contentBase64":{"type":"string"}}}},"replyTo":{"description":"1 to 5 addresses that replies should go to. They are not recipients.","type":"array","items":{"type":"string"}},"headers":{"description":"Up to 20 custom headers; each name starts with X-. X-SES-*, X-MailCraft-* and X-Mailer are refused. Each value is 1 to 997 printable ASCII characters with at least one non-space; names and values total at most 8 KiB.","type":"object","additionalProperties":{"type":"string"}}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"inboxId","required":true},{"in":"header","name":"Idempotency-Key","required":true,"description":"Your key for this send. Reuse it when you retry and the same request gets the same answer; the same key with a different request is a 422. Values starting with \"draft:\" are reserved.","schema":{"type":"string","minLength":1,"maxLength":255}}],"security":[{"bearerAuth":[]}],"responses":{"202":{"description":"Accepted. The message is queued: {id, threadId, status: \"queued\", recipients}. Or, for an API key or a member on an inbox that requires approval, it is held as a draft for an owner or admin: {status: \"pending_approval\", draftId}. A retry with the same Idempotency-Key and the same request gets the same answer.","content":{"application/json":{"schema":{"anyOf":[{"type":"object","required":["id","threadId","status","recipients"],"properties":{"id":{"description":"The message's id.","type":"string"},"threadId":{"type":"string"},"status":{"type":"string","enum":["queued"]},"recipients":{"type":"array","items":{"type":"object","required":["address","kind","status","bounceType","detail"],"properties":{"address":{"type":"string"},"kind":{"type":"string","enum":["to","cc","bcc"]},"status":{"type":"string","enum":["queued","sent","delivered","bounced","complained","failed"]},"bounceType":{"type":"string","nullable":true},"detail":{"type":"string","nullable":true}}}}}},{"type":"object","required":["status","draftId"],"properties":{"status":{"type":"string","enum":["pending_approval"]},"draftId":{"type":"string"}}}]}}}},"400":{"$ref":"#/components/responses/IdempotencyKeyMissing"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/TooManyRequests"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs/{orgId}/inboxes/{inboxId}/messages":{"post":{"summary":"Send message","tags":["Sending"],"description":"Send a new message from this inbox; it starts a new thread. Optional replyTo (addresses) and headers (custom X- headers) go into the message. Needs an Idempotency-Key header. Answers 202 once the message is queued. On an inbox that requires approval, an API key's or a member's request is held as a draft for an owner or admin instead: 202 {status: \"pending_approval\", draftId}.","requestBody":{"required":true,"content":{"application/json":{"schema":{"additionalProperties":false,"allOf":[{"anyOf":[{"required":["to"],"properties":{"to":{"type":"array","minItems":1}}},{"required":["cc"],"properties":{"cc":{"type":"array","minItems":1}}},{"required":["bcc"],"properties":{"bcc":{"type":"array","minItems":1}}}]},{"anyOf":[{"required":["text"]},{"required":["html"]}]}],"type":"object","properties":{"to":{"maxItems":50,"type":"array","items":{"maxLength":320,"type":"string","example":"a@example.com"}},"cc":{"maxItems":50,"type":"array","items":{"maxLength":320,"type":"string","example":"a@example.com"}},"bcc":{"maxItems":50,"type":"array","items":{"maxLength":320,"type":"string","example":"a@example.com"}},"subject":{"maxLength":998,"pattern":"^[^\\r\\n]*$","type":"string"},"text":{"type":"string"},"html":{"type":"string"},"attachments":{"maxItems":100,"type":"array","items":{"additionalProperties":false,"type":"object","required":["filename","contentType","contentBase64"],"properties":{"filename":{"minLength":1,"maxLength":255,"pattern":"^[^\\r\\n]*$","type":"string"},"contentType":{"maxLength":255,"pattern":"^[A-Za-z0-9!#$&^_.+-]+/[A-Za-z0-9!#$&^_.+-]+$","type":"string"},"contentBase64":{"type":"string"}}}},"replyTo":{"description":"1 to 5 addresses that replies should go to. They are not recipients.","type":"array","items":{"type":"string"}},"headers":{"description":"Up to 20 custom headers; each name starts with X-. X-SES-*, X-MailCraft-* and X-Mailer are refused. Each value is 1 to 997 printable ASCII characters with at least one non-space; names and values total at most 8 KiB.","type":"object","additionalProperties":{"type":"string"}}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string"},"in":"path","name":"inboxId","required":true},{"in":"header","name":"Idempotency-Key","required":true,"description":"Your key for this send. Reuse it when you retry and the same request gets the same answer; the same key with a different request is a 422. Values starting with \"draft:\" are reserved.","schema":{"type":"string","minLength":1,"maxLength":255}}],"security":[{"zitadelAuth":[]}],"responses":{"202":{"description":"Accepted. The message is queued: {id, threadId, status: \"queued\", recipients}. Or, for an API key or a member on an inbox that requires approval, it is held as a draft for an owner or admin: {status: \"pending_approval\", draftId}. A retry with the same Idempotency-Key and the same request gets the same answer.","content":{"application/json":{"schema":{"anyOf":[{"type":"object","required":["id","threadId","status","recipients"],"properties":{"id":{"description":"The message's id.","type":"string"},"threadId":{"type":"string"},"status":{"type":"string","enum":["queued"]},"recipients":{"type":"array","items":{"type":"object","required":["address","kind","status","bounceType","detail"],"properties":{"address":{"type":"string"},"kind":{"type":"string","enum":["to","cc","bcc"]},"status":{"type":"string","enum":["queued","sent","delivered","bounced","complained","failed"]},"bounceType":{"type":"string","nullable":true},"detail":{"type":"string","nullable":true}}}}}},{"type":"object","required":["status","draftId"],"properties":{"status":{"type":"string","enum":["pending_approval"]},"draftId":{"type":"string"}}}]}}}},"400":{"$ref":"#/components/responses/IdempotencyKeyMissing"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/TooManyRequests"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/messages/{messageId}/reply":{"post":{"summary":"Reply","tags":["Sending"],"description":"Reply to a message in one of your inboxes, from that inbox; it joins the message's thread. Optional replyTo (addresses) and headers (custom X- headers) go into the message. Needs an Idempotency-Key header. On an inbox that requires approval, an API key's or a member's request is held as a draft for an owner or admin instead: 202 {status: \"pending_approval\", draftId}.","requestBody":{"required":true,"content":{"application/json":{"schema":{"additionalProperties":false,"allOf":[{"anyOf":[{"required":["text"]},{"required":["html"]}]}],"type":"object","properties":{"to":{"maxItems":50,"type":"array","items":{"maxLength":320,"type":"string","example":"a@example.com"}},"cc":{"maxItems":50,"type":"array","items":{"maxLength":320,"type":"string","example":"a@example.com"}},"bcc":{"maxItems":50,"type":"array","items":{"maxLength":320,"type":"string","example":"a@example.com"}},"subject":{"maxLength":998,"pattern":"^[^\\r\\n]*$","type":"string"},"text":{"type":"string"},"html":{"type":"string"},"attachments":{"maxItems":100,"type":"array","items":{"additionalProperties":false,"type":"object","required":["filename","contentType","contentBase64"],"properties":{"filename":{"minLength":1,"maxLength":255,"pattern":"^[^\\r\\n]*$","type":"string"},"contentType":{"maxLength":255,"pattern":"^[A-Za-z0-9!#$&^_.+-]+/[A-Za-z0-9!#$&^_.+-]+$","type":"string"},"contentBase64":{"type":"string"}}}},"replyTo":{"description":"1 to 5 addresses that replies should go to. They are not recipients.","type":"array","items":{"type":"string"}},"headers":{"description":"Up to 20 custom headers; each name starts with X-. X-SES-*, X-MailCraft-* and X-Mailer are refused. Each value is 1 to 997 printable ASCII characters with at least one non-space; names and values total at most 8 KiB.","type":"object","additionalProperties":{"type":"string"}},"replyAll":{"description":"Also copy the original's other To and Cc, minus this inbox and anyone already in to, then your cc, each once.","type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"messageId","required":true},{"in":"header","name":"Idempotency-Key","required":true,"description":"Your key for this send. Reuse it when you retry and the same request gets the same answer; the same key with a different request is a 422. Values starting with \"draft:\" are reserved.","schema":{"type":"string","minLength":1,"maxLength":255}}],"security":[{"bearerAuth":[]}],"responses":{"202":{"description":"Accepted. The message is queued: {id, threadId, status: \"queued\", recipients}. Or, for an API key or a member on an inbox that requires approval, it is held as a draft for an owner or admin: {status: \"pending_approval\", draftId}. A retry with the same Idempotency-Key and the same request gets the same answer.","content":{"application/json":{"schema":{"anyOf":[{"type":"object","required":["id","threadId","status","recipients"],"properties":{"id":{"description":"The message's id.","type":"string"},"threadId":{"type":"string"},"status":{"type":"string","enum":["queued"]},"recipients":{"type":"array","items":{"type":"object","required":["address","kind","status","bounceType","detail"],"properties":{"address":{"type":"string"},"kind":{"type":"string","enum":["to","cc","bcc"]},"status":{"type":"string","enum":["queued","sent","delivered","bounced","complained","failed"]},"bounceType":{"type":"string","nullable":true},"detail":{"type":"string","nullable":true}}}}}},{"type":"object","required":["status","draftId"],"properties":{"status":{"type":"string","enum":["pending_approval"]},"draftId":{"type":"string"}}}]}}}},"400":{"$ref":"#/components/responses/IdempotencyKeyMissing"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/TooManyRequests"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs/{orgId}/messages/{messageId}/reply":{"post":{"summary":"Reply","tags":["Sending"],"description":"Reply to a message in one of your inboxes, from that inbox; it joins the message's thread. Optional replyTo (addresses) and headers (custom X- headers) go into the message. Needs an Idempotency-Key header. On an inbox that requires approval, an API key's or a member's request is held as a draft for an owner or admin instead: 202 {status: \"pending_approval\", draftId}.","requestBody":{"required":true,"content":{"application/json":{"schema":{"additionalProperties":false,"allOf":[{"anyOf":[{"required":["text"]},{"required":["html"]}]}],"type":"object","properties":{"to":{"maxItems":50,"type":"array","items":{"maxLength":320,"type":"string","example":"a@example.com"}},"cc":{"maxItems":50,"type":"array","items":{"maxLength":320,"type":"string","example":"a@example.com"}},"bcc":{"maxItems":50,"type":"array","items":{"maxLength":320,"type":"string","example":"a@example.com"}},"subject":{"maxLength":998,"pattern":"^[^\\r\\n]*$","type":"string"},"text":{"type":"string"},"html":{"type":"string"},"attachments":{"maxItems":100,"type":"array","items":{"additionalProperties":false,"type":"object","required":["filename","contentType","contentBase64"],"properties":{"filename":{"minLength":1,"maxLength":255,"pattern":"^[^\\r\\n]*$","type":"string"},"contentType":{"maxLength":255,"pattern":"^[A-Za-z0-9!#$&^_.+-]+/[A-Za-z0-9!#$&^_.+-]+$","type":"string"},"contentBase64":{"type":"string"}}}},"replyTo":{"description":"1 to 5 addresses that replies should go to. They are not recipients.","type":"array","items":{"type":"string"}},"headers":{"description":"Up to 20 custom headers; each name starts with X-. X-SES-*, X-MailCraft-* and X-Mailer are refused. Each value is 1 to 997 printable ASCII characters with at least one non-space; names and values total at most 8 KiB.","type":"object","additionalProperties":{"type":"string"}},"replyAll":{"description":"Also copy the original's other To and Cc, minus this inbox and anyone already in to, then your cc, each once.","type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string"},"in":"path","name":"messageId","required":true},{"in":"header","name":"Idempotency-Key","required":true,"description":"Your key for this send. Reuse it when you retry and the same request gets the same answer; the same key with a different request is a 422. Values starting with \"draft:\" are reserved.","schema":{"type":"string","minLength":1,"maxLength":255}}],"security":[{"zitadelAuth":[]}],"responses":{"202":{"description":"Accepted. The message is queued: {id, threadId, status: \"queued\", recipients}. Or, for an API key or a member on an inbox that requires approval, it is held as a draft for an owner or admin: {status: \"pending_approval\", draftId}. A retry with the same Idempotency-Key and the same request gets the same answer.","content":{"application/json":{"schema":{"anyOf":[{"type":"object","required":["id","threadId","status","recipients"],"properties":{"id":{"description":"The message's id.","type":"string"},"threadId":{"type":"string"},"status":{"type":"string","enum":["queued"]},"recipients":{"type":"array","items":{"type":"object","required":["address","kind","status","bounceType","detail"],"properties":{"address":{"type":"string"},"kind":{"type":"string","enum":["to","cc","bcc"]},"status":{"type":"string","enum":["queued","sent","delivered","bounced","complained","failed"]},"bounceType":{"type":"string","nullable":true},"detail":{"type":"string","nullable":true}}}}}},{"type":"object","required":["status","draftId"],"properties":{"status":{"type":"string","enum":["pending_approval"]},"draftId":{"type":"string"}}}]}}}},"400":{"$ref":"#/components/responses/IdempotencyKeyMissing"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/TooManyRequests"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/messages/{messageId}/forward":{"post":{"summary":"Forward","tags":["Sending"],"description":"Forward a message in one of your inboxes, from that inbox, to new recipients, with an optional note (text or html) above the original. The recipient gets a new conversation; here it starts a new thread. The original's attachments go with it unless includeAttachments is false (a message you sent carries its text but not its attachments). Optional replyTo and headers as on send. Needs an Idempotency-Key header. On an inbox that requires approval, an API key's or a member's request is held as a draft for an owner or admin instead: 202 {status: \"pending_approval\", draftId}; the draft holds the whole composed message, so each body part must fit a draft's 1 MiB.","requestBody":{"required":true,"content":{"application/json":{"schema":{"additionalProperties":false,"allOf":[{"anyOf":[{"required":["to"],"properties":{"to":{"type":"array","minItems":1}}},{"required":["cc"],"properties":{"cc":{"type":"array","minItems":1}}},{"required":["bcc"],"properties":{"bcc":{"type":"array","minItems":1}}}]}],"type":"object","properties":{"to":{"maxItems":50,"type":"array","items":{"maxLength":320,"type":"string","example":"a@example.com"}},"cc":{"maxItems":50,"type":"array","items":{"maxLength":320,"type":"string","example":"a@example.com"}},"bcc":{"maxItems":50,"type":"array","items":{"maxLength":320,"type":"string","example":"a@example.com"}},"subject":{"maxLength":998,"pattern":"^[^\\r\\n]*$","type":"string"},"text":{"type":"string"},"html":{"type":"string"},"attachments":{"maxItems":100,"type":"array","items":{"additionalProperties":false,"type":"object","required":["filename","contentType","contentBase64"],"properties":{"filename":{"minLength":1,"maxLength":255,"pattern":"^[^\\r\\n]*$","type":"string"},"contentType":{"maxLength":255,"pattern":"^[A-Za-z0-9!#$&^_.+-]+/[A-Za-z0-9!#$&^_.+-]+$","type":"string"},"contentBase64":{"type":"string"}}}},"replyTo":{"description":"1 to 5 addresses that replies should go to. They are not recipients.","type":"array","items":{"type":"string"}},"headers":{"description":"Up to 20 custom headers; each name starts with X-. X-SES-*, X-MailCraft-* and X-Mailer are refused. Each value is 1 to 997 printable ASCII characters with at least one non-space; names and values total at most 8 KiB.","type":"object","additionalProperties":{"type":"string"}},"includeAttachments":{"description":"Re-attach the original's attachments (received mail only). Default true.","type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"messageId","required":true},{"in":"header","name":"Idempotency-Key","required":true,"description":"Your key for this send. Reuse it when you retry and the same request gets the same answer; the same key with a different request is a 422. Values starting with \"draft:\" are reserved.","schema":{"type":"string","minLength":1,"maxLength":255}}],"security":[{"bearerAuth":[]}],"responses":{"202":{"description":"Accepted. The message is queued: {id, threadId, status: \"queued\", recipients}. Or, for an API key or a member on an inbox that requires approval, it is held as a draft for an owner or admin: {status: \"pending_approval\", draftId}. A retry with the same Idempotency-Key and the same request gets the same answer.","content":{"application/json":{"schema":{"anyOf":[{"type":"object","required":["id","threadId","status","recipients"],"properties":{"id":{"description":"The message's id.","type":"string"},"threadId":{"type":"string"},"status":{"type":"string","enum":["queued"]},"recipients":{"type":"array","items":{"type":"object","required":["address","kind","status","bounceType","detail"],"properties":{"address":{"type":"string"},"kind":{"type":"string","enum":["to","cc","bcc"]},"status":{"type":"string","enum":["queued","sent","delivered","bounced","complained","failed"]},"bounceType":{"type":"string","nullable":true},"detail":{"type":"string","nullable":true}}}}}},{"type":"object","required":["status","draftId"],"properties":{"status":{"type":"string","enum":["pending_approval"]},"draftId":{"type":"string"}}}]}}}},"400":{"$ref":"#/components/responses/IdempotencyKeyMissing"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/TooManyRequests"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs/{orgId}/messages/{messageId}/forward":{"post":{"summary":"Forward","tags":["Sending"],"description":"Forward a message in one of your inboxes, from that inbox, to new recipients, with an optional note (text or html) above the original. The recipient gets a new conversation; here it starts a new thread. The original's attachments go with it unless includeAttachments is false (a message you sent carries its text but not its attachments). Optional replyTo and headers as on send. Needs an Idempotency-Key header. On an inbox that requires approval, an API key's or a member's request is held as a draft for an owner or admin instead: 202 {status: \"pending_approval\", draftId}; the draft holds the whole composed message, so each body part must fit a draft's 1 MiB.","requestBody":{"required":true,"content":{"application/json":{"schema":{"additionalProperties":false,"allOf":[{"anyOf":[{"required":["to"],"properties":{"to":{"type":"array","minItems":1}}},{"required":["cc"],"properties":{"cc":{"type":"array","minItems":1}}},{"required":["bcc"],"properties":{"bcc":{"type":"array","minItems":1}}}]}],"type":"object","properties":{"to":{"maxItems":50,"type":"array","items":{"maxLength":320,"type":"string","example":"a@example.com"}},"cc":{"maxItems":50,"type":"array","items":{"maxLength":320,"type":"string","example":"a@example.com"}},"bcc":{"maxItems":50,"type":"array","items":{"maxLength":320,"type":"string","example":"a@example.com"}},"subject":{"maxLength":998,"pattern":"^[^\\r\\n]*$","type":"string"},"text":{"type":"string"},"html":{"type":"string"},"attachments":{"maxItems":100,"type":"array","items":{"additionalProperties":false,"type":"object","required":["filename","contentType","contentBase64"],"properties":{"filename":{"minLength":1,"maxLength":255,"pattern":"^[^\\r\\n]*$","type":"string"},"contentType":{"maxLength":255,"pattern":"^[A-Za-z0-9!#$&^_.+-]+/[A-Za-z0-9!#$&^_.+-]+$","type":"string"},"contentBase64":{"type":"string"}}}},"replyTo":{"description":"1 to 5 addresses that replies should go to. They are not recipients.","type":"array","items":{"type":"string"}},"headers":{"description":"Up to 20 custom headers; each name starts with X-. X-SES-*, X-MailCraft-* and X-Mailer are refused. Each value is 1 to 997 printable ASCII characters with at least one non-space; names and values total at most 8 KiB.","type":"object","additionalProperties":{"type":"string"}},"includeAttachments":{"description":"Re-attach the original's attachments (received mail only). Default true.","type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string"},"in":"path","name":"messageId","required":true},{"in":"header","name":"Idempotency-Key","required":true,"description":"Your key for this send. Reuse it when you retry and the same request gets the same answer; the same key with a different request is a 422. Values starting with \"draft:\" are reserved.","schema":{"type":"string","minLength":1,"maxLength":255}}],"security":[{"zitadelAuth":[]}],"responses":{"202":{"description":"Accepted. The message is queued: {id, threadId, status: \"queued\", recipients}. Or, for an API key or a member on an inbox that requires approval, it is held as a draft for an owner or admin: {status: \"pending_approval\", draftId}. A retry with the same Idempotency-Key and the same request gets the same answer.","content":{"application/json":{"schema":{"anyOf":[{"type":"object","required":["id","threadId","status","recipients"],"properties":{"id":{"description":"The message's id.","type":"string"},"threadId":{"type":"string"},"status":{"type":"string","enum":["queued"]},"recipients":{"type":"array","items":{"type":"object","required":["address","kind","status","bounceType","detail"],"properties":{"address":{"type":"string"},"kind":{"type":"string","enum":["to","cc","bcc"]},"status":{"type":"string","enum":["queued","sent","delivered","bounced","complained","failed"]},"bounceType":{"type":"string","nullable":true},"detail":{"type":"string","nullable":true}}}}}},{"type":"object","required":["status","draftId"],"properties":{"status":{"type":"string","enum":["pending_approval"]},"draftId":{"type":"string"}}}]}}}},"400":{"$ref":"#/components/responses/IdempotencyKeyMissing"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/TooManyRequests"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/inboxes/{inboxId}/drafts":{"post":{"summary":"Create draft","tags":["Drafts"],"description":"Save a draft in this inbox. Its body takes the send body's fields, all optional, replyTo and headers, plus replyToMessageId for a reply. An API key's draft is visible to the whole organization; a person's only to them while it is open (owners and admins also see it once submitted). Answers 201 with the draft.","requestBody":{"required":true,"content":{"application/json":{"schema":{"additionalProperties":false,"type":"object","properties":{"to":{"maxItems":50,"type":"array","items":{"maxLength":320,"type":"string","example":"a@example.com"}},"cc":{"maxItems":50,"type":"array","items":{"maxLength":320,"type":"string","example":"a@example.com"}},"bcc":{"maxItems":50,"type":"array","items":{"maxLength":320,"type":"string","example":"a@example.com"}},"subject":{"maxLength":998,"pattern":"^[^\\r\\n]*$","type":"string"},"text":{"type":"string"},"html":{"type":"string"},"attachments":{"maxItems":100,"type":"array","items":{"additionalProperties":false,"type":"object","required":["filename","contentType","contentBase64"],"properties":{"filename":{"minLength":1,"maxLength":255,"pattern":"^[^\\r\\n]*$","type":"string"},"contentType":{"maxLength":255,"pattern":"^[A-Za-z0-9!#$&^_.+-]+/[A-Za-z0-9!#$&^_.+-]+$","type":"string"},"contentBase64":{"type":"string"}}}},"replyTo":{"description":"1 to 5 addresses that replies should go to. They are not recipients.","type":"array","items":{"type":"string"}},"headers":{"description":"Up to 20 custom headers; each name starts with X-. X-SES-*, X-MailCraft-* and X-Mailer are refused. Each value is 1 to 997 printable ASCII characters with at least one non-space; names and values total at most 8 KiB.","type":"object","additionalProperties":{"type":"string"}},"replyToMessageId":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"inboxId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"201":{"description":"The draft.","content":{"application/json":{"schema":{"description":"The draft.","type":"object","required":["id","inboxId","inboxAddress","fromAddress","channel","status","authorKind","authorName","to","cc","bcc","subject","replyTo","headers","submittedAt","version","createdAt","updatedAt","replyToMessageId","createdAsReply","text","html","attachments","authorApiKeyId","authorUserId","editedByReviewer","reviewNote","reviewedBy","reviewedAt","messageId","closedAt"],"properties":{"id":{"type":"string"},"inboxId":{"type":"string"},"inboxAddress":{"type":"string"},"fromAddress":{"description":"The address a send of this draft goes from: for a reply, the inbox address the original used; otherwise the inbox's address.","type":"string"},"channel":{"type":"string"},"status":{"type":"string","enum":["open","sent","rejected"]},"authorKind":{"type":"string","enum":["agent","person"]},"authorName":{"type":"string","nullable":true},"to":{"type":"array","items":{"type":"string"}},"cc":{"type":"array","items":{"type":"string"}},"bcc":{"type":"array","items":{"type":"string"}},"subject":{"type":"string","nullable":true},"replyTo":{"type":"array","items":{"type":"string"},"nullable":true},"headers":{"type":"object","nullable":true,"additionalProperties":{"type":"string"}},"submittedAt":{"type":"string","nullable":true,"format":"date-time","description":"When it was submitted for approval; null while it is not."},"version":{"description":"Give it back to update, send or reject the draft.","type":"integer"},"createdAt":{"format":"date-time","type":"string"},"updatedAt":{"format":"date-time","type":"string"},"replyToMessageId":{"type":"string","nullable":true},"createdAsReply":{"type":"boolean"},"text":{"type":"string","nullable":true},"html":{"type":"string","nullable":true},"attachments":{"type":"array","items":{"type":"object","required":["id","filename","contentType","size"],"properties":{"id":{"type":"string"},"filename":{"type":"string"},"contentType":{"type":"string"},"size":{"description":"Bytes.","type":"integer"}}}},"authorApiKeyId":{"type":"string","nullable":true,"description":"The API key that wrote it (key_…)."},"authorUserId":{"type":"string","nullable":true,"description":"The member who wrote it (usr_…)."},"editedByReviewer":{"type":"boolean"},"reviewNote":{"type":"string","nullable":true},"reviewedBy":{"type":"string","nullable":true,"description":"The member who approved or rejected it (usr_…)."},"reviewedAt":{"type":"string","nullable":true,"format":"date-time"},"messageId":{"type":"string","nullable":true,"description":"The sent message's id, once sent."},"closedAt":{"type":"string","nullable":true,"format":"date-time"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"$ref":"#/components/responses/ValidationFailed"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs/{orgId}/inboxes/{inboxId}/drafts":{"post":{"summary":"Create draft","tags":["Drafts"],"description":"Save a draft in this inbox. Its body takes the send body's fields, all optional, replyTo and headers, plus replyToMessageId for a reply. An API key's draft is visible to the whole organization; a person's only to them while it is open (owners and admins also see it once submitted). Answers 201 with the draft.","requestBody":{"required":true,"content":{"application/json":{"schema":{"additionalProperties":false,"type":"object","properties":{"to":{"maxItems":50,"type":"array","items":{"maxLength":320,"type":"string","example":"a@example.com"}},"cc":{"maxItems":50,"type":"array","items":{"maxLength":320,"type":"string","example":"a@example.com"}},"bcc":{"maxItems":50,"type":"array","items":{"maxLength":320,"type":"string","example":"a@example.com"}},"subject":{"maxLength":998,"pattern":"^[^\\r\\n]*$","type":"string"},"text":{"type":"string"},"html":{"type":"string"},"attachments":{"maxItems":100,"type":"array","items":{"additionalProperties":false,"type":"object","required":["filename","contentType","contentBase64"],"properties":{"filename":{"minLength":1,"maxLength":255,"pattern":"^[^\\r\\n]*$","type":"string"},"contentType":{"maxLength":255,"pattern":"^[A-Za-z0-9!#$&^_.+-]+/[A-Za-z0-9!#$&^_.+-]+$","type":"string"},"contentBase64":{"type":"string"}}}},"replyTo":{"description":"1 to 5 addresses that replies should go to. They are not recipients.","type":"array","items":{"type":"string"}},"headers":{"description":"Up to 20 custom headers; each name starts with X-. X-SES-*, X-MailCraft-* and X-Mailer are refused. Each value is 1 to 997 printable ASCII characters with at least one non-space; names and values total at most 8 KiB.","type":"object","additionalProperties":{"type":"string"}},"replyToMessageId":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string"},"in":"path","name":"inboxId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"201":{"description":"The draft.","content":{"application/json":{"schema":{"description":"The draft.","type":"object","required":["id","inboxId","inboxAddress","fromAddress","channel","status","authorKind","authorName","to","cc","bcc","subject","replyTo","headers","submittedAt","version","createdAt","updatedAt","replyToMessageId","createdAsReply","text","html","attachments","authorApiKeyId","authorUserId","editedByReviewer","reviewNote","reviewedBy","reviewedAt","messageId","closedAt"],"properties":{"id":{"type":"string"},"inboxId":{"type":"string"},"inboxAddress":{"type":"string"},"fromAddress":{"description":"The address a send of this draft goes from: for a reply, the inbox address the original used; otherwise the inbox's address.","type":"string"},"channel":{"type":"string"},"status":{"type":"string","enum":["open","sent","rejected"]},"authorKind":{"type":"string","enum":["agent","person"]},"authorName":{"type":"string","nullable":true},"to":{"type":"array","items":{"type":"string"}},"cc":{"type":"array","items":{"type":"string"}},"bcc":{"type":"array","items":{"type":"string"}},"subject":{"type":"string","nullable":true},"replyTo":{"type":"array","items":{"type":"string"},"nullable":true},"headers":{"type":"object","nullable":true,"additionalProperties":{"type":"string"}},"submittedAt":{"type":"string","nullable":true,"format":"date-time","description":"When it was submitted for approval; null while it is not."},"version":{"description":"Give it back to update, send or reject the draft.","type":"integer"},"createdAt":{"format":"date-time","type":"string"},"updatedAt":{"format":"date-time","type":"string"},"replyToMessageId":{"type":"string","nullable":true},"createdAsReply":{"type":"boolean"},"text":{"type":"string","nullable":true},"html":{"type":"string","nullable":true},"attachments":{"type":"array","items":{"type":"object","required":["id","filename","contentType","size"],"properties":{"id":{"type":"string"},"filename":{"type":"string"},"contentType":{"type":"string"},"size":{"description":"Bytes.","type":"integer"}}}},"authorApiKeyId":{"type":"string","nullable":true,"description":"The API key that wrote it (key_…)."},"authorUserId":{"type":"string","nullable":true,"description":"The member who wrote it (usr_…)."},"editedByReviewer":{"type":"boolean"},"reviewNote":{"type":"string","nullable":true},"reviewedBy":{"type":"string","nullable":true,"description":"The member who approved or rejected it (usr_…)."},"reviewedAt":{"type":"string","nullable":true,"format":"date-time"},"messageId":{"type":"string","nullable":true,"description":"The sent message's id, once sent."},"closedAt":{"type":"string","nullable":true,"format":"date-time"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"$ref":"#/components/responses/ValidationFailed"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/drafts":{"get":{"summary":"List drafts","tags":["Drafts"],"description":"Drafts you can see, newest first: an API key sees agents' drafts; a person sees those and their own; an owner or admin also sees members' submitted drafts. awaiting=true lists drafts waiting for approval, oldest first.","parameters":[{"schema":{"type":"string"},"in":"query","name":"inbox","required":false},{"schema":{"anyOf":[{"type":"string","enum":["open"]},{"type":"string","enum":["sent"]},{"type":"string","enum":["rejected"]}]},"in":"query","name":"status","required":false},{"schema":{"type":"boolean"},"in":"query","name":"awaiting","required":false},{"schema":{"type":"boolean"},"in":"query","name":"mine","required":false},{"schema":{"minimum":1,"maximum":100,"default":25,"type":"integer"},"in":"query","name":"limit","required":false},{"schema":{"type":"string"},"in":"query","name":"cursor","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"A page of drafts.","content":{"application/json":{"schema":{"description":"A page of drafts.","type":"object","required":["data","nextCursor"],"properties":{"data":{"type":"array","items":{"type":"object","required":["id","inboxId","inboxAddress","fromAddress","channel","status","authorKind","authorName","to","cc","bcc","subject","replyTo","headers","submittedAt","version","createdAt","updatedAt"],"properties":{"id":{"type":"string"},"inboxId":{"type":"string"},"inboxAddress":{"type":"string"},"fromAddress":{"description":"The address a send of this draft goes from: for a reply, the inbox address the original used; otherwise the inbox's address.","type":"string"},"channel":{"type":"string"},"status":{"type":"string","enum":["open","sent","rejected"]},"authorKind":{"type":"string","enum":["agent","person"]},"authorName":{"type":"string","nullable":true},"to":{"type":"array","items":{"type":"string"}},"cc":{"type":"array","items":{"type":"string"}},"bcc":{"type":"array","items":{"type":"string"}},"subject":{"type":"string","nullable":true},"replyTo":{"type":"array","items":{"type":"string"},"nullable":true},"headers":{"type":"object","nullable":true,"additionalProperties":{"type":"string"}},"submittedAt":{"type":"string","nullable":true,"format":"date-time","description":"When it was submitted for approval; null while it is not."},"version":{"description":"Give it back to update, send or reject the draft.","type":"integer"},"createdAt":{"format":"date-time","type":"string"},"updatedAt":{"format":"date-time","type":"string"}}}},"nextCursor":{"type":"string","nullable":true,"description":"The next page's cursor; null on the last page."}}}}}},"400":{"description":"Invalid cursor or mine. This cursor isn't valid for this list (read again without it), or mine=true came with an API key.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"description":"No such inbox: inbox names one that is unknown or not in this organization (or, at /v0/orgs/{orgId}/…, no such organization).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"422":{"description":"The query string failed schema validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}}},"/v0/orgs/{orgId}/drafts":{"get":{"summary":"List drafts","tags":["Drafts"],"description":"Drafts you can see, newest first: an API key sees agents' drafts; a person sees those and their own; an owner or admin also sees members' submitted drafts. awaiting=true lists drafts waiting for approval, oldest first.","parameters":[{"schema":{"type":"string"},"in":"query","name":"inbox","required":false},{"schema":{"anyOf":[{"type":"string","enum":["open"]},{"type":"string","enum":["sent"]},{"type":"string","enum":["rejected"]}]},"in":"query","name":"status","required":false},{"schema":{"type":"boolean"},"in":"query","name":"awaiting","required":false},{"schema":{"type":"boolean"},"in":"query","name":"mine","required":false},{"schema":{"minimum":1,"maximum":100,"default":25,"type":"integer"},"in":"query","name":"limit","required":false},{"schema":{"type":"string"},"in":"query","name":"cursor","required":false},{"schema":{"type":"string"},"in":"path","name":"orgId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"A page of drafts.","content":{"application/json":{"schema":{"description":"A page of drafts.","type":"object","required":["data","nextCursor"],"properties":{"data":{"type":"array","items":{"type":"object","required":["id","inboxId","inboxAddress","fromAddress","channel","status","authorKind","authorName","to","cc","bcc","subject","replyTo","headers","submittedAt","version","createdAt","updatedAt"],"properties":{"id":{"type":"string"},"inboxId":{"type":"string"},"inboxAddress":{"type":"string"},"fromAddress":{"description":"The address a send of this draft goes from: for a reply, the inbox address the original used; otherwise the inbox's address.","type":"string"},"channel":{"type":"string"},"status":{"type":"string","enum":["open","sent","rejected"]},"authorKind":{"type":"string","enum":["agent","person"]},"authorName":{"type":"string","nullable":true},"to":{"type":"array","items":{"type":"string"}},"cc":{"type":"array","items":{"type":"string"}},"bcc":{"type":"array","items":{"type":"string"}},"subject":{"type":"string","nullable":true},"replyTo":{"type":"array","items":{"type":"string"},"nullable":true},"headers":{"type":"object","nullable":true,"additionalProperties":{"type":"string"}},"submittedAt":{"type":"string","nullable":true,"format":"date-time","description":"When it was submitted for approval; null while it is not."},"version":{"description":"Give it back to update, send or reject the draft.","type":"integer"},"createdAt":{"format":"date-time","type":"string"},"updatedAt":{"format":"date-time","type":"string"}}}},"nextCursor":{"type":"string","nullable":true,"description":"The next page's cursor; null on the last page."}}}}}},"400":{"description":"Invalid cursor or mine. This cursor isn't valid for this list (read again without it), or mine=true came with an API key.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"No such inbox: inbox names one that is unknown or not in this organization (or, at /v0/orgs/{orgId}/…, no such organization).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"422":{"description":"The query string failed schema validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/drafts/{draftId}":{"get":{"summary":"Get draft","tags":["Drafts"],"description":"One draft: its fields, attachments (metadata), author, status, review and, once sent, its message id.","parameters":[{"schema":{"type":"string"},"in":"path","name":"draftId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The draft.","content":{"application/json":{"schema":{"description":"The draft.","type":"object","required":["id","inboxId","inboxAddress","fromAddress","channel","status","authorKind","authorName","to","cc","bcc","subject","replyTo","headers","submittedAt","version","createdAt","updatedAt","replyToMessageId","createdAsReply","text","html","attachments","authorApiKeyId","authorUserId","editedByReviewer","reviewNote","reviewedBy","reviewedAt","messageId","closedAt"],"properties":{"id":{"type":"string"},"inboxId":{"type":"string"},"inboxAddress":{"type":"string"},"fromAddress":{"description":"The address a send of this draft goes from: for a reply, the inbox address the original used; otherwise the inbox's address.","type":"string"},"channel":{"type":"string"},"status":{"type":"string","enum":["open","sent","rejected"]},"authorKind":{"type":"string","enum":["agent","person"]},"authorName":{"type":"string","nullable":true},"to":{"type":"array","items":{"type":"string"}},"cc":{"type":"array","items":{"type":"string"}},"bcc":{"type":"array","items":{"type":"string"}},"subject":{"type":"string","nullable":true},"replyTo":{"type":"array","items":{"type":"string"},"nullable":true},"headers":{"type":"object","nullable":true,"additionalProperties":{"type":"string"}},"submittedAt":{"type":"string","nullable":true,"format":"date-time","description":"When it was submitted for approval; null while it is not."},"version":{"description":"Give it back to update, send or reject the draft.","type":"integer"},"createdAt":{"format":"date-time","type":"string"},"updatedAt":{"format":"date-time","type":"string"},"replyToMessageId":{"type":"string","nullable":true},"createdAsReply":{"type":"boolean"},"text":{"type":"string","nullable":true},"html":{"type":"string","nullable":true},"attachments":{"type":"array","items":{"type":"object","required":["id","filename","contentType","size"],"properties":{"id":{"type":"string"},"filename":{"type":"string"},"contentType":{"type":"string"},"size":{"description":"Bytes.","type":"integer"}}}},"authorApiKeyId":{"type":"string","nullable":true,"description":"The API key that wrote it (key_…)."},"authorUserId":{"type":"string","nullable":true,"description":"The member who wrote it (usr_…)."},"editedByReviewer":{"type":"boolean"},"reviewNote":{"type":"string","nullable":true},"reviewedBy":{"type":"string","nullable":true,"description":"The member who approved or rejected it (usr_…)."},"reviewedAt":{"type":"string","nullable":true,"format":"date-time"},"messageId":{"type":"string","nullable":true,"description":"The sent message's id, once sent."},"closedAt":{"type":"string","nullable":true,"format":"date-time"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"summary":"Update a draft","tags":["Drafts"],"description":"Update a draft. Give the version you read; a stale one is 409. Only its author edits an open draft; once it waits for approval only an owner or admin can, which marks it edited. attachments replaces the list: pass {id} to keep one. replyTo and headers replace the stored value; null clears.","requestBody":{"required":true,"content":{"application/json":{"schema":{"additionalProperties":false,"type":"object","required":["version"],"properties":{"version":{"minimum":1,"type":"integer"},"to":{"maxItems":50,"type":"array","items":{"maxLength":320,"type":"string","example":"a@example.com"}},"cc":{"maxItems":50,"type":"array","items":{"maxLength":320,"type":"string","example":"a@example.com"}},"bcc":{"maxItems":50,"type":"array","items":{"maxLength":320,"type":"string","example":"a@example.com"}},"subject":{"type":"string","nullable":true,"maxLength":998,"pattern":"^[^\\r\\n]*$"},"text":{"type":"string","nullable":true},"html":{"type":"string","nullable":true},"attachments":{"maxItems":100,"type":"array","items":{"anyOf":[{"additionalProperties":false,"type":"object","required":["id"],"properties":{"id":{"type":"string"}}},{"additionalProperties":false,"type":"object","required":["filename","contentType","contentBase64"],"properties":{"filename":{"minLength":1,"maxLength":255,"pattern":"^[^\\r\\n]*$","type":"string"},"contentType":{"maxLength":255,"pattern":"^[A-Za-z0-9!#$&^_.+-]+/[A-Za-z0-9!#$&^_.+-]+$","type":"string"},"contentBase64":{"type":"string"}}}]}},"replyTo":{"type":"array","nullable":true,"items":{"type":"string"},"description":"1 to 5 addresses that replies should go to. They are not recipients. null or [] clears."},"headers":{"type":"object","nullable":true,"additionalProperties":{"type":"string"},"description":"Up to 20 custom headers; each name starts with X-. X-SES-*, X-MailCraft-* and X-Mailer are refused. Each value is 1 to 997 printable ASCII characters with at least one non-space; names and values total at most 8 KiB. null or {} clears."}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"draftId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The updated draft.","content":{"application/json":{"schema":{"description":"The updated draft.","type":"object","required":["id","inboxId","inboxAddress","fromAddress","channel","status","authorKind","authorName","to","cc","bcc","subject","replyTo","headers","submittedAt","version","createdAt","updatedAt","replyToMessageId","createdAsReply","text","html","attachments","authorApiKeyId","authorUserId","editedByReviewer","reviewNote","reviewedBy","reviewedAt","messageId","closedAt"],"properties":{"id":{"type":"string"},"inboxId":{"type":"string"},"inboxAddress":{"type":"string"},"fromAddress":{"description":"The address a send of this draft goes from: for a reply, the inbox address the original used; otherwise the inbox's address.","type":"string"},"channel":{"type":"string"},"status":{"type":"string","enum":["open","sent","rejected"]},"authorKind":{"type":"string","enum":["agent","person"]},"authorName":{"type":"string","nullable":true},"to":{"type":"array","items":{"type":"string"}},"cc":{"type":"array","items":{"type":"string"}},"bcc":{"type":"array","items":{"type":"string"}},"subject":{"type":"string","nullable":true},"replyTo":{"type":"array","items":{"type":"string"},"nullable":true},"headers":{"type":"object","nullable":true,"additionalProperties":{"type":"string"}},"submittedAt":{"type":"string","nullable":true,"format":"date-time","description":"When it was submitted for approval; null while it is not."},"version":{"description":"Give it back to update, send or reject the draft.","type":"integer"},"createdAt":{"format":"date-time","type":"string"},"updatedAt":{"format":"date-time","type":"string"},"replyToMessageId":{"type":"string","nullable":true},"createdAsReply":{"type":"boolean"},"text":{"type":"string","nullable":true},"html":{"type":"string","nullable":true},"attachments":{"type":"array","items":{"type":"object","required":["id","filename","contentType","size"],"properties":{"id":{"type":"string"},"filename":{"type":"string"},"contentType":{"type":"string"},"size":{"description":"Bytes.","type":"integer"}}}},"authorApiKeyId":{"type":"string","nullable":true,"description":"The API key that wrote it (key_…)."},"authorUserId":{"type":"string","nullable":true,"description":"The member who wrote it (usr_…)."},"editedByReviewer":{"type":"boolean"},"reviewNote":{"type":"string","nullable":true},"reviewedBy":{"type":"string","nullable":true,"description":"The member who approved or rejected it (usr_…)."},"reviewedAt":{"type":"string","nullable":true,"format":"date-time"},"messageId":{"type":"string","nullable":true,"description":"The sent message's id, once sent."},"closedAt":{"type":"string","nullable":true,"format":"date-time"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Not allowed. Only a draft's author edits or deletes it while it is open; only an owner or admin approves, edits or rejects one waiting for approval; or the member's role is too low, or the organization is suspended.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"The draft changed. The version given is not its current one, or it is no longer open to this (already sent, rejected or waiting for a person); read it again.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"$ref":"#/components/responses/ValidationFailed"}}},"delete":{"summary":"Delete a draft","tags":["Drafts"],"description":"Delete a draft. Its author may; a draft waiting for approval may also be deleted by an owner or admin, a member may delete an agent's draft that is not yet submitted, and any org key may delete an agent's draft. Its attachments are deleted too. Answers 204.","parameters":[{"schema":{"type":"string"},"in":"path","name":"draftId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"The draft was deleted."},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Not allowed. Only a draft's author edits or deletes it while it is open; only an owner or admin approves, edits or rejects one waiting for approval; or the member's role is too low, or the organization is suspended.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"The draft changed. The version given is not its current one, or it is no longer open to this (already sent, rejected or waiting for a person); read it again.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}}},"/v0/orgs/{orgId}/drafts/{draftId}":{"get":{"summary":"Get draft","tags":["Drafts"],"description":"One draft: its fields, attachments (metadata), author, status, review and, once sent, its message id.","parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string"},"in":"path","name":"draftId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"The draft.","content":{"application/json":{"schema":{"description":"The draft.","type":"object","required":["id","inboxId","inboxAddress","fromAddress","channel","status","authorKind","authorName","to","cc","bcc","subject","replyTo","headers","submittedAt","version","createdAt","updatedAt","replyToMessageId","createdAsReply","text","html","attachments","authorApiKeyId","authorUserId","editedByReviewer","reviewNote","reviewedBy","reviewedAt","messageId","closedAt"],"properties":{"id":{"type":"string"},"inboxId":{"type":"string"},"inboxAddress":{"type":"string"},"fromAddress":{"description":"The address a send of this draft goes from: for a reply, the inbox address the original used; otherwise the inbox's address.","type":"string"},"channel":{"type":"string"},"status":{"type":"string","enum":["open","sent","rejected"]},"authorKind":{"type":"string","enum":["agent","person"]},"authorName":{"type":"string","nullable":true},"to":{"type":"array","items":{"type":"string"}},"cc":{"type":"array","items":{"type":"string"}},"bcc":{"type":"array","items":{"type":"string"}},"subject":{"type":"string","nullable":true},"replyTo":{"type":"array","items":{"type":"string"},"nullable":true},"headers":{"type":"object","nullable":true,"additionalProperties":{"type":"string"}},"submittedAt":{"type":"string","nullable":true,"format":"date-time","description":"When it was submitted for approval; null while it is not."},"version":{"description":"Give it back to update, send or reject the draft.","type":"integer"},"createdAt":{"format":"date-time","type":"string"},"updatedAt":{"format":"date-time","type":"string"},"replyToMessageId":{"type":"string","nullable":true},"createdAsReply":{"type":"boolean"},"text":{"type":"string","nullable":true},"html":{"type":"string","nullable":true},"attachments":{"type":"array","items":{"type":"object","required":["id","filename","contentType","size"],"properties":{"id":{"type":"string"},"filename":{"type":"string"},"contentType":{"type":"string"},"size":{"description":"Bytes.","type":"integer"}}}},"authorApiKeyId":{"type":"string","nullable":true,"description":"The API key that wrote it (key_…)."},"authorUserId":{"type":"string","nullable":true,"description":"The member who wrote it (usr_…)."},"editedByReviewer":{"type":"boolean"},"reviewNote":{"type":"string","nullable":true},"reviewedBy":{"type":"string","nullable":true,"description":"The member who approved or rejected it (usr_…)."},"reviewedAt":{"type":"string","nullable":true,"format":"date-time"},"messageId":{"type":"string","nullable":true,"description":"The sent message's id, once sent."},"closedAt":{"type":"string","nullable":true,"format":"date-time"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}},"patch":{"summary":"Update a draft","tags":["Drafts"],"description":"Update a draft. Give the version you read; a stale one is 409. Only its author edits an open draft; once it waits for approval only an owner or admin can, which marks it edited. attachments replaces the list: pass {id} to keep one. replyTo and headers replace the stored value; null clears.","requestBody":{"required":true,"content":{"application/json":{"schema":{"additionalProperties":false,"type":"object","required":["version"],"properties":{"version":{"minimum":1,"type":"integer"},"to":{"maxItems":50,"type":"array","items":{"maxLength":320,"type":"string","example":"a@example.com"}},"cc":{"maxItems":50,"type":"array","items":{"maxLength":320,"type":"string","example":"a@example.com"}},"bcc":{"maxItems":50,"type":"array","items":{"maxLength":320,"type":"string","example":"a@example.com"}},"subject":{"type":"string","nullable":true,"maxLength":998,"pattern":"^[^\\r\\n]*$"},"text":{"type":"string","nullable":true},"html":{"type":"string","nullable":true},"attachments":{"maxItems":100,"type":"array","items":{"anyOf":[{"additionalProperties":false,"type":"object","required":["id"],"properties":{"id":{"type":"string"}}},{"additionalProperties":false,"type":"object","required":["filename","contentType","contentBase64"],"properties":{"filename":{"minLength":1,"maxLength":255,"pattern":"^[^\\r\\n]*$","type":"string"},"contentType":{"maxLength":255,"pattern":"^[A-Za-z0-9!#$&^_.+-]+/[A-Za-z0-9!#$&^_.+-]+$","type":"string"},"contentBase64":{"type":"string"}}}]}},"replyTo":{"type":"array","nullable":true,"items":{"type":"string"},"description":"1 to 5 addresses that replies should go to. They are not recipients. null or [] clears."},"headers":{"type":"object","nullable":true,"additionalProperties":{"type":"string"},"description":"Up to 20 custom headers; each name starts with X-. X-SES-*, X-MailCraft-* and X-Mailer are refused. Each value is 1 to 997 printable ASCII characters with at least one non-space; names and values total at most 8 KiB. null or {} clears."}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string"},"in":"path","name":"draftId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"The updated draft.","content":{"application/json":{"schema":{"description":"The updated draft.","type":"object","required":["id","inboxId","inboxAddress","fromAddress","channel","status","authorKind","authorName","to","cc","bcc","subject","replyTo","headers","submittedAt","version","createdAt","updatedAt","replyToMessageId","createdAsReply","text","html","attachments","authorApiKeyId","authorUserId","editedByReviewer","reviewNote","reviewedBy","reviewedAt","messageId","closedAt"],"properties":{"id":{"type":"string"},"inboxId":{"type":"string"},"inboxAddress":{"type":"string"},"fromAddress":{"description":"The address a send of this draft goes from: for a reply, the inbox address the original used; otherwise the inbox's address.","type":"string"},"channel":{"type":"string"},"status":{"type":"string","enum":["open","sent","rejected"]},"authorKind":{"type":"string","enum":["agent","person"]},"authorName":{"type":"string","nullable":true},"to":{"type":"array","items":{"type":"string"}},"cc":{"type":"array","items":{"type":"string"}},"bcc":{"type":"array","items":{"type":"string"}},"subject":{"type":"string","nullable":true},"replyTo":{"type":"array","items":{"type":"string"},"nullable":true},"headers":{"type":"object","nullable":true,"additionalProperties":{"type":"string"}},"submittedAt":{"type":"string","nullable":true,"format":"date-time","description":"When it was submitted for approval; null while it is not."},"version":{"description":"Give it back to update, send or reject the draft.","type":"integer"},"createdAt":{"format":"date-time","type":"string"},"updatedAt":{"format":"date-time","type":"string"},"replyToMessageId":{"type":"string","nullable":true},"createdAsReply":{"type":"boolean"},"text":{"type":"string","nullable":true},"html":{"type":"string","nullable":true},"attachments":{"type":"array","items":{"type":"object","required":["id","filename","contentType","size"],"properties":{"id":{"type":"string"},"filename":{"type":"string"},"contentType":{"type":"string"},"size":{"description":"Bytes.","type":"integer"}}}},"authorApiKeyId":{"type":"string","nullable":true,"description":"The API key that wrote it (key_…)."},"authorUserId":{"type":"string","nullable":true,"description":"The member who wrote it (usr_…)."},"editedByReviewer":{"type":"boolean"},"reviewNote":{"type":"string","nullable":true},"reviewedBy":{"type":"string","nullable":true,"description":"The member who approved or rejected it (usr_…)."},"reviewedAt":{"type":"string","nullable":true,"format":"date-time"},"messageId":{"type":"string","nullable":true,"description":"The sent message's id, once sent."},"closedAt":{"type":"string","nullable":true,"format":"date-time"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Not allowed. Only a draft's author edits or deletes it while it is open; only an owner or admin approves, edits or rejects one waiting for approval; or the member's role is too low, or the organization is suspended.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"The draft changed. The version given is not its current one, or it is no longer open to this (already sent, rejected or waiting for a person); read it again.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"$ref":"#/components/responses/ValidationFailed"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}},"delete":{"summary":"Delete a draft","tags":["Drafts"],"description":"Delete a draft. Its author may; a draft waiting for approval may also be deleted by an owner or admin, a member may delete an agent's draft that is not yet submitted, and any org key may delete an agent's draft. Its attachments are deleted too. Answers 204.","parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string"},"in":"path","name":"draftId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"204":{"description":"The draft was deleted."},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Not allowed. Only a draft's author edits or deletes it while it is open; only an owner or admin approves, edits or rejects one waiting for approval; or the member's role is too low, or the organization is suspended.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"The draft changed. The version given is not its current one, or it is no longer open to this (already sent, rejected or waiting for a person); read it again.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs/{orgId}/drafts/{draftId}/attachments/{attachmentId}":{"get":{"summary":"Draft attachment","tags":["Drafts"],"description":"Download one of a draft's attachments. Sign-in token only: the API-key family has no route for this.","parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string"},"in":"path","name":"draftId","required":true},{"schema":{"type":"string"},"in":"path","name":"attachmentId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"The attachment, with its stored content type.","content":{"*/*":{"schema":{"format":"binary","type":"string"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/drafts/{draftId}/send":{"post":{"summary":"Send draft","tags":["Drafts"],"description":"Send a draft through the same path as a direct send, once: give the version you read and an Idempotency-Key. An owner's or admin's send approves a waiting draft. An API key or a member on an inbox that requires approval submits it instead (202 pending_approval); a member sending someone else's waiting draft gets 403. Sending answers 503 while sending is not yet available. A draft sends once whatever the Idempotency-Key: the same caller sending an already-sent draft again at the same version, even with a new key, gets 202 with the original message and no second mail; anyone else gets 409.","requestBody":{"required":true,"content":{"application/json":{"schema":{"additionalProperties":false,"type":"object","required":["version"],"properties":{"version":{"minimum":1,"type":"integer"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"draftId","required":true},{"in":"header","name":"Idempotency-Key","required":true,"description":"Required, but a draft sends once whatever its value: the draft itself makes the send idempotent.","schema":{"type":"string","minLength":1,"maxLength":255}}],"security":[{"bearerAuth":[]}],"responses":{"202":{"description":"Accepted. The draft's message is queued: {id, threadId, status: \"queued\", recipients}. Or, for an API key or a member on an inbox that requires approval, the draft is submitted for an owner or admin: {status: \"pending_approval\", draftId}. A draft sends once: the same caller repeating the send at the same version gets the same answer.","content":{"application/json":{"schema":{"anyOf":[{"type":"object","required":["id","threadId","status","recipients"],"properties":{"id":{"description":"The message's id.","type":"string"},"threadId":{"type":"string"},"status":{"type":"string","enum":["queued"]},"recipients":{"type":"array","items":{"type":"object","required":["address","kind","status","bounceType","detail"],"properties":{"address":{"type":"string"},"kind":{"type":"string","enum":["to","cc","bcc"]},"status":{"type":"string","enum":["queued","sent","delivered","bounced","complained","failed"]},"bounceType":{"type":"string","nullable":true},"detail":{"type":"string","nullable":true}}}}}},{"type":"object","required":["status","draftId"],"properties":{"status":{"type":"string","enum":["pending_approval"]},"draftId":{"type":"string"}}}]}}}},"400":{"$ref":"#/components/responses/IdempotencyKeyMissing"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"description":"Not allowed. Only a draft's author edits or deletes it while it is open; only an owner or admin approves, edits or rejects one waiting for approval; or the member's role is too low, or the organization is suspended.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"The draft changed or was sent. The version given is not its current one, it was already sent by another caller or rejected, or the message it replies to is gone.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/TooManyRequests"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs/{orgId}/drafts/{draftId}/send":{"post":{"summary":"Send draft","tags":["Drafts"],"description":"Send a draft through the same path as a direct send, once: give the version you read and an Idempotency-Key. An owner's or admin's send approves a waiting draft. An API key or a member on an inbox that requires approval submits it instead (202 pending_approval); a member sending someone else's waiting draft gets 403. Sending answers 503 while sending is not yet available. A draft sends once whatever the Idempotency-Key: the same caller sending an already-sent draft again at the same version, even with a new key, gets 202 with the original message and no second mail; anyone else gets 409.","requestBody":{"required":true,"content":{"application/json":{"schema":{"additionalProperties":false,"type":"object","required":["version"],"properties":{"version":{"minimum":1,"type":"integer"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string"},"in":"path","name":"draftId","required":true},{"in":"header","name":"Idempotency-Key","required":true,"description":"Required, but a draft sends once whatever its value: the draft itself makes the send idempotent.","schema":{"type":"string","minLength":1,"maxLength":255}}],"security":[{"zitadelAuth":[]}],"responses":{"202":{"description":"Accepted. The draft's message is queued: {id, threadId, status: \"queued\", recipients}. Or, for an API key or a member on an inbox that requires approval, the draft is submitted for an owner or admin: {status: \"pending_approval\", draftId}. A draft sends once: the same caller repeating the send at the same version gets the same answer.","content":{"application/json":{"schema":{"anyOf":[{"type":"object","required":["id","threadId","status","recipients"],"properties":{"id":{"description":"The message's id.","type":"string"},"threadId":{"type":"string"},"status":{"type":"string","enum":["queued"]},"recipients":{"type":"array","items":{"type":"object","required":["address","kind","status","bounceType","detail"],"properties":{"address":{"type":"string"},"kind":{"type":"string","enum":["to","cc","bcc"]},"status":{"type":"string","enum":["queued","sent","delivered","bounced","complained","failed"]},"bounceType":{"type":"string","nullable":true},"detail":{"type":"string","nullable":true}}}}}},{"type":"object","required":["status","draftId"],"properties":{"status":{"type":"string","enum":["pending_approval"]},"draftId":{"type":"string"}}}]}}}},"400":{"$ref":"#/components/responses/IdempotencyKeyMissing"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"description":"Not allowed. Only a draft's author edits or deletes it while it is open; only an owner or admin approves, edits or rejects one waiting for approval; or the member's role is too low, or the organization is suspended.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"The draft changed or was sent. The version given is not its current one, it was already sent by another caller or rejected, or the message it replies to is gone.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/TooManyRequests"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v0/orgs/{orgId}/drafts/{draftId}/reject":{"post":{"summary":"Reject draft","tags":["Drafts"],"description":"Reject a draft that waits for approval, with an optional note the author reads. Only an owner or admin can. Final: the author writes a new draft.","requestBody":{"required":true,"content":{"application/json":{"schema":{"additionalProperties":false,"type":"object","required":["version"],"properties":{"version":{"minimum":1,"type":"integer"},"note":{"maxLength":2000,"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string"},"in":"path","name":"draftId","required":true}],"security":[{"zitadelAuth":[]}],"responses":{"200":{"description":"The rejected draft.","content":{"application/json":{"schema":{"description":"The rejected draft.","type":"object","required":["id","inboxId","inboxAddress","fromAddress","channel","status","authorKind","authorName","to","cc","bcc","subject","replyTo","headers","submittedAt","version","createdAt","updatedAt","replyToMessageId","createdAsReply","text","html","attachments","authorApiKeyId","authorUserId","editedByReviewer","reviewNote","reviewedBy","reviewedAt","messageId","closedAt"],"properties":{"id":{"type":"string"},"inboxId":{"type":"string"},"inboxAddress":{"type":"string"},"fromAddress":{"description":"The address a send of this draft goes from: for a reply, the inbox address the original used; otherwise the inbox's address.","type":"string"},"channel":{"type":"string"},"status":{"type":"string","enum":["open","sent","rejected"]},"authorKind":{"type":"string","enum":["agent","person"]},"authorName":{"type":"string","nullable":true},"to":{"type":"array","items":{"type":"string"}},"cc":{"type":"array","items":{"type":"string"}},"bcc":{"type":"array","items":{"type":"string"}},"subject":{"type":"string","nullable":true},"replyTo":{"type":"array","items":{"type":"string"},"nullable":true},"headers":{"type":"object","nullable":true,"additionalProperties":{"type":"string"}},"submittedAt":{"type":"string","nullable":true,"format":"date-time","description":"When it was submitted for approval; null while it is not."},"version":{"description":"Give it back to update, send or reject the draft.","type":"integer"},"createdAt":{"format":"date-time","type":"string"},"updatedAt":{"format":"date-time","type":"string"},"replyToMessageId":{"type":"string","nullable":true},"createdAsReply":{"type":"boolean"},"text":{"type":"string","nullable":true},"html":{"type":"string","nullable":true},"attachments":{"type":"array","items":{"type":"object","required":["id","filename","contentType","size"],"properties":{"id":{"type":"string"},"filename":{"type":"string"},"contentType":{"type":"string"},"size":{"description":"Bytes.","type":"integer"}}}},"authorApiKeyId":{"type":"string","nullable":true,"description":"The API key that wrote it (key_…)."},"authorUserId":{"type":"string","nullable":true,"description":"The member who wrote it (usr_…)."},"editedByReviewer":{"type":"boolean"},"reviewNote":{"type":"string","nullable":true},"reviewedBy":{"type":"string","nullable":true,"description":"The member who approved or rejected it (usr_…)."},"reviewedAt":{"type":"string","nullable":true,"format":"date-time"},"messageId":{"type":"string","nullable":true,"description":"The sent message's id, once sent."},"closedAt":{"type":"string","nullable":true,"format":"date-time"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Not allowed. Only a draft's author edits or deletes it while it is open; only an owner or admin approves, edits or rejects one waiting for approval; or the member's role is too low, or the organization is suspended.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"The draft changed. The version given is not its current one, or it is no longer open to this (already sent, rejected or waiting for a person); read it again.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"$ref":"#/components/responses/ValidationFailed"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}}},"servers":[{"url":"https://api.mailcraft.ntconnect.com"}],"tags":[{"name":"Inboxes"},{"name":"Threads and messages"},{"name":"Sending"},{"name":"Drafts"},{"name":"Events"},{"name":"Webhooks"},{"name":"Suppressions"},{"name":"Organizations"},{"name":"Members"},{"name":"API keys"},{"name":"Billing and usage"},{"name":"Status"},{"name":"Account"}]}