{"openapi":"3.1.0","info":{"title":"LiteMX API","version":"0.1.0","description":"Backend API for LiteMX domain, mailbox, alias, message, draft, sending, retention, audit, and MCP operations."},"servers":[{"url":"https://litemx-api-worker.litemx.workers.dev"}],"security":[{"bearerAuth":[]}],"tags":[{"name":"System"},{"name":"Domains"},{"name":"Mailboxes"},{"name":"Aliases"},{"name":"Catchalls"},{"name":"Tokens"},{"name":"Messages"},{"name":"Threads"},{"name":"Drafts"},{"name":"Sending"},{"name":"Inbound"},{"name":"Audit"},{"name":"Retention"},{"name":"MCP"}],"paths":{"/openapi.json":{"get":{"tags":["System"],"operationId":"getOpenApi","summary":"Read this OpenAPI document.","responses":{"200":{"description":"OK.","content":{"application/json":{"schema":{"type":"object","properties":{},"required":[],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"}},"security":[]}},"/api/health":{"get":{"tags":["System"],"operationId":"getHealth","summary":"Read Worker health.","responses":{"200":{"description":"Worker health.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Health"}}}}},"security":[]}},"/api/bootstrap":{"get":{"tags":["System"],"operationId":"bootstrapAccount","summary":"Ensure the founder account exists.","responses":{"200":{"description":"OK.","content":{"application/json":{"schema":{"type":"object","properties":{},"required":[],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"}}}},"/mcp":{"get":{"tags":["MCP"],"operationId":"getMcpStatus","summary":"Read MCP transport status.","responses":{"200":{"description":"OK.","content":{"application/json":{"schema":{"type":"object","properties":{},"required":[],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"}},"security":[]},"post":{"tags":["MCP"],"operationId":"callMcp","summary":"Call the LiteMX Streamable HTTP MCP endpoint.","responses":{"200":{"description":"OK.","content":{"application/json":{"schema":{"type":"object","properties":{},"required":[],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"jsonrpc":{"type":"string","examples":["2.0"]},"id":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"null"}]},"method":{"type":"string"},"params":{"type":"object","additionalProperties":true}},"required":[],"additionalProperties":false}}}}}},"/api/domains":{"get":{"tags":["Domains"],"operationId":"listDomains","summary":"List registered domains.","responses":{"200":{"description":"OK.","content":{"application/json":{"schema":{"type":"object","properties":{},"required":[],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50}}]},"post":{"tags":["Domains"],"operationId":"createDomain","summary":"Register a LiteMX domain.","responses":{"201":{"description":"Domain created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DomainCreateResponse"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"domain":{"type":"string"}},"required":["domain"],"additionalProperties":false}}}}}},"/api/domains/{domain}/status":{"get":{"tags":["Domains"],"operationId":"getDomainStatus","summary":"Read domain setup and readiness.","responses":{"200":{"description":"Domain status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DomainStatusResponse"}}}}},"parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/domains/{domain}/dns-plan":{"get":{"tags":["Domains"],"operationId":"getDomainDnsPlan","summary":"Read the DNS-provider-agnostic mail setup plan for a domain.","responses":{"200":{"description":"Domain DNS plan.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DomainDnsPlanResponse"}}}}},"parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/domains/{domain}/readiness":{"put":{"tags":["Domains"],"operationId":"updateDomainReadiness","summary":"Record provider receive/send readiness. Ready states require validated provider metadata; Cloudflare setup remains a supported legacy source.","responses":{"200":{"description":"Domain readiness updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DomainSetupResponse"}}}}},"parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"emailRoutingStatus":{"type":"string","enum":["pending","ready","failed","disabled"]},"emailSendingStatus":{"type":"string","enum":["pending","ready","failed","disabled"]},"cloudflareZoneId":{"type":"string"},"readinessSource":{"type":"string","enum":["provider-verification","dns-provider-verification","cloudflare-setup"]},"confirmReady":{"type":"boolean"},"confirmProviderReady":{"type":"boolean"}},"required":[],"additionalProperties":false}}}}}},"/api/mailboxes":{"get":{"tags":["Mailboxes"],"operationId":"listMailboxes","summary":"List mailboxes.","responses":{"200":{"description":"Mailboxes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MailboxListResponse"}}}}},"parameters":[{"name":"domain","in":"query","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50}}]},"post":{"tags":["Mailboxes"],"operationId":"createMailbox","summary":"Create a mailbox.","responses":{"201":{"description":"Mailbox created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MailboxCreateResponse"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"address":{"type":"string"},"displayName":{"type":"string"}},"required":["address"],"additionalProperties":false}}}}}},"/api/mailboxes/{mailbox}":{"get":{"tags":["Mailboxes"],"operationId":"readMailbox","summary":"Read a mailbox by id or address.","responses":{"200":{"description":"Mailbox.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MailboxResponse"}}}}},"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"string"}}]},"delete":{"tags":["Mailboxes"],"operationId":"deleteMailbox","summary":"Disable a mailbox while retaining audit and message history.","responses":{"200":{"description":"Mailbox disabled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MailboxDeleteResponse"}}}}},"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/mailboxes/{mailbox}/retention":{"get":{"tags":["Mailboxes"],"operationId":"getMailboxRetention","summary":"Read mailbox retention settings.","responses":{"200":{"description":"OK.","content":{"application/json":{"schema":{"type":"object","properties":{},"required":[],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"string"}}]},"put":{"tags":["Mailboxes"],"operationId":"updateMailboxRetention","summary":"Update mailbox content retention days.","responses":{"200":{"description":"OK.","content":{"application/json":{"schema":{"type":"object","properties":{},"required":[],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"retentionDays":{"type":"integer","minimum":1,"maximum":3650}},"required":["retentionDays"],"additionalProperties":false}}}}}},"/api/aliases":{"get":{"tags":["Aliases"],"operationId":"listAliases","summary":"List aliases.","responses":{"200":{"description":"Aliases.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AliasListResponse"}}}}},"parameters":[{"name":"domain","in":"query","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50}}]},"post":{"tags":["Aliases"],"operationId":"createAlias","summary":"Create an alias to a mailbox.","responses":{"201":{"description":"Alias created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AliasCreateResponse"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"aliasAddress":{"type":"string"},"targetMailbox":{"type":"string"}},"required":["aliasAddress","targetMailbox"],"additionalProperties":false}}}}}},"/api/aliases/{alias}":{"delete":{"tags":["Aliases"],"operationId":"deleteAlias","summary":"Delete an alias by id or address.","responses":{"200":{"description":"Alias deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AliasDeleteResponse"}}}}},"parameters":[{"name":"alias","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/catchalls/{domain}":{"get":{"tags":["Catchalls"],"operationId":"getCatchall","summary":"Read a domain catchall route.","responses":{"200":{"description":"Catchall.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatchallResponse"}}}}},"parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"string"}}]},"put":{"tags":["Catchalls"],"operationId":"setCatchall","summary":"Create or update a domain catchall route.","responses":{"200":{"description":"Catchall updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatchallResponse"}}}}},"parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"targetMailbox":{"type":"string"}},"required":["targetMailbox"],"additionalProperties":false}}}}}},"/api/tokens":{"get":{"tags":["Tokens"],"operationId":"listTokens","summary":"List scoped API/MCP token metadata.","responses":{"200":{"description":"Tokens.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenListResponse"}}}}},"parameters":[{"name":"includeRevoked","in":"query","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50}}]},"post":{"tags":["Tokens"],"operationId":"createToken","summary":"Create a scoped API/MCP token.","responses":{"201":{"description":"Token created. The raw token is only returned once.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenCreateResponse"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"actorName":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"mailboxIds":{"type":"array","items":{"type":"string"}},"mailboxes":{"type":"array","items":{"type":"string"}}},"required":["name","scopes"],"additionalProperties":false}}}}}},"/api/tokens/{id}":{"delete":{"tags":["Tokens"],"operationId":"revokeToken","summary":"Revoke a scoped API/MCP token.","responses":{"200":{"description":"Token revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenRevokeResponse"}}}}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/messages":{"get":{"tags":["Messages"],"operationId":"listMessages","summary":"List message summaries.","responses":{"200":{"description":"Messages.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageListResponse"}}}}},"parameters":[{"name":"mailbox","in":"query","required":false,"schema":{"type":"string"}},{"name":"direction","in":"query","required":false,"schema":{"type":"string","enum":["inbound","outbound"]}},{"name":"ingestionSource","in":"query","required":false,"schema":{"type":"string","enum":["provider","simulated"]}},{"name":"receivedAfter","in":"query","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50}}]}},"/api/messages/search":{"get":{"tags":["Messages"],"operationId":"searchMessages","summary":"Search messages.","responses":{"200":{"description":"Search results.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageSearchResponse"}}}}},"parameters":[{"name":"q","in":"query","required":true,"schema":{"type":"string"}},{"name":"mailbox","in":"query","required":false,"schema":{"type":"string"}},{"name":"direction","in":"query","required":false,"schema":{"type":"string","enum":["inbound","outbound"]}},{"name":"ingestionSource","in":"query","required":false,"schema":{"type":"string","enum":["provider","simulated"]}},{"name":"receivedAfter","in":"query","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50}}]}},"/api/messages/{id}":{"get":{"tags":["Messages"],"operationId":"readMessage","summary":"Read one message body and attachment metadata.","responses":{"200":{"description":"Message.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}}}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/messages/{id}/reply":{"post":{"tags":["Messages"],"operationId":"replyToMessage","summary":"Send a reply to one message.","responses":{"201":{"description":"Message sent.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}}},"409":{"$ref":"#/components/responses/Error"},"502":{"description":"Provider send failed after the attempt was recorded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}}}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string"},"body":{"type":"string"},"html":{"type":"string"}},"required":[],"additionalProperties":false}}}}}},"/api/threads":{"get":{"tags":["Threads"],"operationId":"listThreads","summary":"List message threads.","responses":{"200":{"description":"Threads.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ThreadListResponse"}}}}},"parameters":[{"name":"mailbox","in":"query","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50}}]}},"/api/threads/{id}":{"get":{"tags":["Threads"],"operationId":"readThread","summary":"Read a thread.","responses":{"200":{"description":"Thread.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ThreadResponse"}}}}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/threads/{id}/reply":{"post":{"tags":["Threads"],"operationId":"replyToThread","summary":"Send a reply in a thread.","responses":{"201":{"description":"Message sent.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}}},"409":{"$ref":"#/components/responses/Error"},"502":{"description":"Provider send failed after the attempt was recorded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}}}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string"},"body":{"type":"string"},"html":{"type":"string"}},"required":[],"additionalProperties":false}}}}}},"/api/threads/{id}/drafts":{"post":{"tags":["Threads"],"operationId":"createThreadReplyDraft","summary":"Create a reply draft in a thread.","responses":{"201":{"description":"Draft created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DraftResponse"}}}}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string"},"body":{"type":"string"},"html":{"type":"string"}},"required":[],"additionalProperties":false}}}}}},"/api/drafts":{"get":{"tags":["Drafts"],"operationId":"listDrafts","summary":"List drafts.","responses":{"200":{"description":"Drafts.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DraftListResponse"}}}}},"parameters":[{"name":"mailbox","in":"query","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50}}]},"post":{"tags":["Drafts"],"operationId":"createDraft","summary":"Create a draft.","responses":{"201":{"description":"Draft created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DraftResponse"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"mailbox":{"type":"string"},"to":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"cc":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"bcc":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"subject":{"type":"string"},"text":{"type":"string"},"body":{"type":"string"},"html":{"type":"string"},"threadId":{"type":"string"},"inReplyTo":{"type":"string"},"references":{"type":"string"}},"required":["mailbox","to","subject"],"additionalProperties":false}}}}}},"/api/drafts/{id}":{"get":{"tags":["Drafts"],"operationId":"readDraft","summary":"Read a draft.","responses":{"200":{"description":"Draft.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DraftResponse"}}}}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/drafts/{id}/send":{"post":{"tags":["Drafts"],"operationId":"sendDraft","summary":"Send a draft.","responses":{"201":{"description":"Message sent.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}}},"409":{"$ref":"#/components/responses/Error"},"502":{"description":"Provider send failed after the attempt was recorded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}}}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/send":{"post":{"tags":["Sending"],"operationId":"sendMessage","summary":"Send a new outbound message from a mailbox.","responses":{"201":{"description":"Message sent.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}}},"409":{"$ref":"#/components/responses/Error"},"502":{"description":"Provider send failed after the attempt was recorded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"from":{"type":"string"},"to":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"cc":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"bcc":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"subject":{"type":"string"},"text":{"type":"string"},"html":{"type":"string"}},"required":["from","to","subject"],"additionalProperties":false}}}}}},"/api/inbound/simulate":{"post":{"tags":["Inbound"],"operationId":"simulateInbound","summary":"Simulate an inbound message for CLI smoke tests. Requires the admin token.","responses":{"201":{"description":"Inbound message stored.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InboundSimulateResponse"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"},"subject":{"type":"string"},"text":{"type":"string"},"raw":{"type":"string"}},"required":["from","to"],"additionalProperties":false}}}}}},"/api/inbound/ses":{"post":{"tags":["Inbound"],"operationId":"ingestSesInbound","summary":"Ingest AWS SES inbound notifications from SES, SNS, SQS, or S3 event payloads. Requires the admin token.","responses":{"200":{"description":"SES inbound notification processed without new stored messages.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SesInboundResponse"}}}},"201":{"description":"SES inbound message stored.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SesInboundResponse"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}},"/api/audit":{"get":{"tags":["Audit"],"operationId":"listAuditEvents","summary":"List audit events.","responses":{"200":{"description":"Audit events.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditListResponse"}}}}},"parameters":[{"name":"mailbox","in":"query","required":false,"schema":{"type":"string"}},{"name":"action","in":"query","required":false,"schema":{"type":"string"}},{"name":"resourceType","in":"query","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50}}]}},"/api/retention/run":{"post":{"tags":["Retention"],"operationId":"runRetention","summary":"Run retention cleanup immediately. Requires the admin token.","responses":{"200":{"description":"Retention cleanup summary.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RetentionResponse"}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Use the founder admin token or a scoped LiteMX API token."}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"},"nextAction":{"type":"string"},"details":{"type":"object","additionalProperties":true}},"required":[],"additionalProperties":false},"Health":{"type":"object","properties":{"service":{"type":"string"},"version":{"type":"string"},"status":{"type":"string"},"time":{"type":"string","format":"date-time"}},"required":[],"additionalProperties":false},"Domain":{"type":"object","properties":{"id":{"type":"string"},"domain":{"type":"string"},"status":{"type":"string"},"setupMode":{"type":"string"},"cloudflareZoneId":{"type":["string","null"]},"inboundEnabled":{"type":"boolean"},"outboundEnabled":{"type":"boolean"},"emailRoutingStatus":{"type":"string"},"emailSendingStatus":{"type":"string"},"emailRoutingCheckedAt":{"type":["string","null"],"format":"date-time"},"emailSendingCheckedAt":{"type":["string","null"],"format":"date-time"},"providerReadiness":{"type":"object","additionalProperties":true,"description":"Provider-agnostic inbound/outbound readiness. Legacy Cloudflare fields remain available for compatibility."},"createdAt":{"type":"string","format":"date-time"}},"required":[],"additionalProperties":false},"Mailbox":{"type":"object","properties":{"id":{"type":"string"},"domainId":{"type":"string"},"address":{"type":"string"},"localPart":{"type":"string"},"displayName":{"type":["string","null"]},"status":{"type":"string"},"retentionDays":{"type":"integer"},"inboundEnabled":{"type":"boolean"},"outboundEnabled":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"}},"required":[],"additionalProperties":false},"Alias":{"type":"object","properties":{"id":{"type":"string"},"domainId":{"type":"string"},"aliasAddress":{"type":"string"},"targetMailboxId":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}},"required":[],"additionalProperties":false},"Catchall":{"type":"object","properties":{"id":{"type":"string"},"domain":{"type":"string"},"domainId":{"type":"string"},"targetMailboxId":{"type":"string"},"enabled":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"}},"required":[],"additionalProperties":false},"ApiToken":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"tokenPrefix":{"type":"string"},"actorType":{"type":"string"},"actorName":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"mailboxIds":{"type":"array","items":{"type":"string"}},"expiresAt":{"type":["string","null"],"format":"date-time"},"lastUsedAt":{"type":["string","null"],"format":"date-time"},"revokedAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":[],"additionalProperties":false},"Draft":{"type":"object","properties":{"id":{"type":"string"},"mailboxId":{"type":"string"},"threadId":{"type":["string","null"]},"from":{"type":"string"},"to":{"type":"array","items":{"type":"string"}},"cc":{"type":"array","items":{"type":"string"}},"bcc":{"type":"array","items":{"type":"string"}},"subject":{"type":"string"},"status":{"type":"string"},"text":{"type":"string"},"html":{"type":["string","null"]},"sentMessageId":{"type":["string","null"]},"providerError":{"type":["string","null"]},"sentAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":[],"additionalProperties":false},"MessageSummary":{"type":"object","properties":{"id":{"type":"string"},"mailboxId":{"type":"string"},"threadId":{"type":"string"},"direction":{"type":"string","enum":["inbound","outbound"]},"ingestionSource":{"type":["string","null"],"enum":["provider","simulated",null]},"status":{"type":"string"},"from":{"type":"string"},"to":{"type":"string"},"subject":{"type":"string"},"preview":{"type":"string"},"hasAttachments":{"type":"boolean"},"attachmentCount":{"type":"integer"},"receivedAt":{"type":["string","null"],"format":"date-time"},"sentAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"}},"required":[],"additionalProperties":false},"Message":{"allOf":[{"type":"object","properties":{"id":{"type":"string"},"mailboxId":{"type":"string"},"threadId":{"type":"string"},"direction":{"type":"string","enum":["inbound","outbound"]},"ingestionSource":{"type":["string","null"],"enum":["provider","simulated",null]},"status":{"type":"string"},"from":{"type":"string"},"to":{"type":"string"},"subject":{"type":"string"},"preview":{"type":"string"},"hasAttachments":{"type":"boolean"},"attachmentCount":{"type":"integer"},"receivedAt":{"type":["string","null"],"format":"date-time"},"sentAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"}},"required":[],"additionalProperties":false},{"type":"object","properties":{"to":{"type":"array","items":{"type":"string"}},"cc":{"type":"array","items":{"type":"string"}},"bcc":{"type":"array","items":{"type":"string"}},"replyTo":{"type":"array","items":{"type":"string"}},"text":{"type":["string","null"]},"html":{"type":["string","null"]},"rawR2Key":{"type":["string","null"]},"messageIdHeader":{"type":["string","null"]},"inReplyToHeader":{"type":["string","null"]},"referencesHeader":{"type":["string","null"]},"attachments":{"type":"array","items":{"$ref":"#/components/schemas/Attachment"}},"providerMessageId":{"type":["string","null"]},"providerError":{"type":["string","null"]}},"required":[],"additionalProperties":false}]},"Attachment":{"type":"object","properties":{"id":{"type":"string"},"filename":{"type":"string"},"contentType":{"type":"string"},"sizeBytes":{"type":"integer"},"r2Key":{"type":"string"},"contentDisposition":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}},"required":[],"additionalProperties":false},"ThreadSummary":{"type":"object","properties":{"id":{"type":"string"},"mailboxId":{"type":"string"},"messageCount":{"type":"integer"},"lastDirection":{"type":"string"},"lastStatus":{"type":"string"},"from":{"type":"string"},"to":{"type":"string"},"subject":{"type":"string"},"preview":{"type":"string"},"lastMessageAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":[],"additionalProperties":false},"Thread":{"type":"object","properties":{"id":{"type":"string"},"mailboxId":{"type":["string","null"]},"messageCount":{"type":"integer"},"subject":{"type":"string"},"preview":{"type":["string","null"]},"lastMessageAt":{"type":["string","null"],"format":"date-time"},"messages":{"type":"array","items":{"$ref":"#/components/schemas/MessageSummary"}}},"required":[],"additionalProperties":false},"AuditEvent":{"type":"object","properties":{"id":{"type":"string"},"actorType":{"type":"string"},"actorId":{"type":["string","null"]},"mailboxId":{"type":["string","null"]},"action":{"type":"string"},"resourceType":{"type":"string"},"resourceId":{"type":["string","null"]},"metadata":{"type":"object","additionalProperties":true},"createdAt":{"type":"string","format":"date-time"}},"required":[],"additionalProperties":false},"RetentionSummary":{"type":"object","properties":{"contentMessagesDeleted":{"type":"integer"},"r2ObjectsDeleted":{"type":"integer"},"metadataMessagesDeleted":{"type":"integer"},"auditEventsDeleted":{"type":"integer"}},"required":[],"additionalProperties":false},"DomainCreateResponse":{"type":"object","properties":{"domain":{"$ref":"#/components/schemas/Domain"},"created":{"type":"boolean"},"setup":{"type":"object","additionalProperties":true}},"required":[],"additionalProperties":false},"DomainStatusResponse":{"type":"object","properties":{"domain":{"$ref":"#/components/schemas/Domain"},"readiness":{"type":"object","additionalProperties":true},"resources":{"type":"object","additionalProperties":true},"setup":{"type":"object","additionalProperties":true}},"required":[],"additionalProperties":false},"DomainDnsPlanResponse":{"type":"object","properties":{"domain":{"type":"string"},"provider":{"type":"object","additionalProperties":true},"dnsHost":{"type":"string"},"instructions":{"type":"array","items":{"type":"string"}},"records":{"type":"array","items":{"type":"object","additionalProperties":true}},"commands":{"type":"object","additionalProperties":true},"nextActions":{"type":"array","items":{"type":"string"}}},"required":[],"additionalProperties":false},"DomainSetupResponse":{"type":"object","properties":{"domain":{"$ref":"#/components/schemas/Domain"},"setup":{"type":"object","additionalProperties":true}},"required":[],"additionalProperties":false},"MailboxResponse":{"type":"object","properties":{"mailbox":{"$ref":"#/components/schemas/Mailbox"}},"required":[],"additionalProperties":false},"MailboxListResponse":{"type":"object","properties":{"mailboxes":{"type":"array","items":{"$ref":"#/components/schemas/Mailbox"}}},"required":[],"additionalProperties":false},"MailboxCreateResponse":{"type":"object","properties":{"mailbox":{"$ref":"#/components/schemas/Mailbox"},"created":{"type":"boolean"}},"required":[],"additionalProperties":false},"MailboxDeleteResponse":{"type":"object","properties":{"mailbox":{"$ref":"#/components/schemas/Mailbox"},"deleted":{"type":"boolean"}},"required":[],"additionalProperties":false},"AliasListResponse":{"type":"object","properties":{"aliases":{"type":"array","items":{"$ref":"#/components/schemas/Alias"}}},"required":[],"additionalProperties":false},"AliasCreateResponse":{"type":"object","properties":{"alias":{"$ref":"#/components/schemas/Alias"},"created":{"type":"boolean"}},"required":[],"additionalProperties":false},"AliasDeleteResponse":{"type":"object","properties":{"alias":{"$ref":"#/components/schemas/Alias"},"deleted":{"type":"boolean"}},"required":[],"additionalProperties":false},"CatchallResponse":{"type":"object","properties":{"catchall":{"oneOf":[{"$ref":"#/components/schemas/Catchall"},{"type":"null"}]}},"required":[],"additionalProperties":false},"TokenCreateResponse":{"type":"object","properties":{"token":{"type":"object","additionalProperties":true}},"required":[],"additionalProperties":false},"TokenListResponse":{"type":"object","properties":{"tokens":{"type":"array","items":{"$ref":"#/components/schemas/ApiToken"}}},"required":[],"additionalProperties":false},"TokenRevokeResponse":{"type":"object","properties":{"token":{"$ref":"#/components/schemas/ApiToken"},"revoked":{"type":"boolean"}},"required":[],"additionalProperties":false},"MessageListResponse":{"type":"object","properties":{"messages":{"type":"array","items":{"$ref":"#/components/schemas/MessageSummary"}}},"required":[],"additionalProperties":false},"MessageSearchResponse":{"type":"object","properties":{"messages":{"type":"array","items":{"$ref":"#/components/schemas/MessageSummary"}},"query":{"type":"string"}},"required":[],"additionalProperties":false},"MessageResponse":{"type":"object","properties":{"message":{"$ref":"#/components/schemas/Message"}},"required":[],"additionalProperties":false},"ThreadListResponse":{"type":"object","properties":{"threads":{"type":"array","items":{"$ref":"#/components/schemas/ThreadSummary"}}},"required":[],"additionalProperties":false},"ThreadResponse":{"type":"object","properties":{"thread":{"$ref":"#/components/schemas/Thread"}},"required":[],"additionalProperties":false},"DraftListResponse":{"type":"object","properties":{"drafts":{"type":"array","items":{"$ref":"#/components/schemas/Draft"}}},"required":[],"additionalProperties":false},"DraftResponse":{"type":"object","properties":{"draft":{"$ref":"#/components/schemas/Draft"}},"required":[],"additionalProperties":false},"InboundSimulateResponse":{"type":"object","properties":{"message":{"$ref":"#/components/schemas/Message"},"routeType":{"type":"string","enum":["mailbox","alias","catchall"]}},"required":[],"additionalProperties":false},"SesInboundResponse":{"type":"object","properties":{"sesInbound":{"type":"object","properties":{"received":{"type":"integer"},"stored":{"type":"integer"},"duplicates":{"type":"integer"},"rejected":{"type":"integer"},"failed":{"type":"integer"},"items":{"type":"array","items":{"type":"object","additionalProperties":true}}},"required":[],"additionalProperties":false}},"required":[],"additionalProperties":false},"AuditListResponse":{"type":"object","properties":{"events":{"type":"array","items":{"$ref":"#/components/schemas/AuditEvent"}}},"required":[],"additionalProperties":false},"RetentionResponse":{"type":"object","properties":{"retention":{"$ref":"#/components/schemas/RetentionSummary"}},"required":[],"additionalProperties":false}},"responses":{"Error":{"description":"Error response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}