{"openapi":"3.1.0","info":{"title":"TrekMail API","version":"1.0.0","description":"TrekMail public API for managing domains, mailboxes, White Label accounts, invites, forwarding, and email messages.\n\n## Authentication\n\nTwo token types:\n- **Ops tokens** (`tm_live_` prefix): For account, White Label, domain, mailbox, and infrastructure management.\n- **Message tokens** (`tm_msg_` prefix): For reading and sending email. Pro\/Agency plans only.\n\n## Rate Limits\n\n| Tier | Limit | Scope |\n|------|-------|-------|\n| Ops API | 60 requests\/min | Per token |\n| White Label member writes | 20 requests\/min | Per token |\n| Message read | 30 requests\/min | Per token |\n| Message send | 5 requests\/min | Per token |\n| Message send daily | 100\/day | Per mailbox |\n| Destructive (delete confirm) | 10\/day | Per token |\n| Destructive account-wide | 50\/day | Per account |\n| Destructive cooldown | 10 seconds | Between confirms |\n| Migration write | 10 requests\/min | Per token |\n| Migration concurrent | 20 server-wide | Global limit |\n| Mailbox app password create | 60 requests\/hour | Per account |\n| Mailbox app password rotate | 30 requests\/hour | Per account |\n\nWhen rate-limited, the API returns `429` with a `Retry-After` header (seconds).\n\n## Idempotency\n\nOperations that list the `Idempotency-Key` parameter require that header (max 255 characters). This includes White Label `POST`, `PUT`, `PATCH`, and `DELETE` writes. Keys are scoped per token and expire after 24 hours."},"servers":[{"url":"\/api\/v1"}],"security":[{"bearerAuth":[]}],"paths":{"\/mailboxes:client-auth-mode":{"post":{"operationId":"setMailboxesClientAuthMode","summary":"Choose what mail apps sign in with on many mailboxes","description":"Requires mailboxes:write and Idempotency-Key. Member tokens and connectors additionally need mailboxes:password:set, or return 403 scope_blocked_by_membership. Provide exactly one of mailbox_ids, domain_id or all: true, using the same selection rules as POST \/mailboxes:login-access. Selection is narrowed to the token's account, domain and mailbox constraints. At most 1000 mailboxes may match; larger selections return 422 selection_too_large before any changes. Shared, trashed or deleting mailboxes are skipped and counted; platform system mailboxes are skipped when requiring app passwords. Paused and sign-in-suspended mailboxes are updated. Already matching mailboxes are counted as matched but not updated. app_password_only requires app passwords in mail apps (including classic webmail) and signs out open mail-app sessions; password_or_app_password also accepts the mailbox password. TrekMail webmail keeps using the mailbox password. Suspended accounts are refused with 403. Returns 404 while app passwords are not enabled on the platform. Bulk requests are additionally throttled to 10 per minute.","tags":["Mailboxes"],"parameters":[{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"mode":{"type":"string","enum":["password_or_app_password","app_password_only"]},"mailbox_ids":{"type":"array","minItems":1,"maxItems":1000,"items":{"type":"integer"},"description":"Explicit mailbox IDs; duplicates are counted once. Every named mailbox must be accessible to the token, or the call returns 404."},"domain_id":{"type":"integer","description":"A domain on this account. An unknown or foreign-account domain returns 422 validation_error. Restricted tokens only match their allowed mailboxes."},"all":{"type":"boolean","description":"true selects all mailboxes accessible to the token. false does not count as a selector."}},"required":["mode"],"oneOf":[{"required":["mailbox_ids"],"not":{"anyOf":[{"required":["domain_id"]},{"required":["all"],"properties":{"all":{"const":true}}}]}},{"required":["domain_id"],"not":{"anyOf":[{"required":["mailbox_ids"]},{"required":["all"],"properties":{"all":{"const":true}}}]}},{"required":["all"],"properties":{"all":{"const":true}},"not":{"anyOf":[{"required":["mailbox_ids"]},{"required":["domain_id"]}]}}]}}}},"responses":{"200":{"description":"Bulk mode applied","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"client_auth_mode":{"type":"string","enum":["password_or_app_password","app_password_only"]},"matched":{"type":"integer","minimum":0},"updated":{"type":"integer","minimum":0},"skipped":{"type":"integer","minimum":0}},"required":["client_auth_mode","matched","updated","skipped"]}},"required":["data"]}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"description":"insufficient_scope; scope_blocked_by_membership without mailboxes:password:set; forbidden for a suspended account","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"404":{"description":"not_found: app passwords are disabled, or one or more explicit mailbox IDs are inaccessible or missing","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"409":{"description":"idempotency_mismatch or conflict on a concurrent request using the same key","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"description":"validation_error; invalid_selection for zero or multiple selectors; selection_too_large above 1000 matched mailboxes; missing_idempotency_key; invalid_idempotency_key","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"$ref":"#\/components\/responses\/TooManyRequests"}}}},"\/account":{"get":{"operationId":"getAccount","summary":"Get account details","description":"Requires account:read. Returns the account plan, limits, features and usage. For a domain-constrained caller, usage counts only its own domains and their mailboxes, and client_limit is added. Includes new_mailbox_client_auth_mode only when mail_app_passwords.enabled and mail_app_passwords.apply_new_mailbox_default are both true; otherwise that field is omitted and GET \/account remains available.","tags":["Account"],"responses":{"200":{"description":"Account details","content":{"application\/json":{"schema":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":["string","null"]},"email":{"type":["string","null"],"format":"email"},"plan":{"type":"string"},"effective_plan_slug":{"type":["string","null"]},"subscription_status":{"type":["string","null"]},"limits":{"type":"object","properties":{"max_domains":{"type":"integer"},"max_mailboxes_per_domain":{"type":"integer"},"max_storage_mb":{"type":"integer","description":"Total storage in MB. For a caller confined to domains that share a client storage limit, that limit."},"max_aliases_per_mailbox":{"type":"integer"}}},"features":{"type":"object","properties":{"aliases":{"type":"boolean"},"forwarding":{"type":"boolean"},"platform_smtp":{"type":"boolean"},"sending":{"type":"boolean"}}},"usage":{"type":"object","properties":{"domains":{"type":"integer"},"mailboxes":{"type":"integer"}}},"client_limit":{"anyOf":[{"$ref":"#\/components\/schemas\/ClientLimitSummary"},{"type":"null"}],"description":"Domain-constrained callers only: the client storage limit all of their domains are under, or null. Also null when that limit covers a domain outside the caller's reach; limits.max_storage_mb is then the account's. The account owner and unconstrained keys do not get this field."},"safety_limits":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"new_mailbox_client_auth_mode":{"type":"string","enum":["password_or_app_password","app_password_only"],"description":"Mail-app sign-in mode for NEW mailboxes; existing mailboxes keep their own setting. Shown by GET \/account and writable via PATCH \/account only when mail_app_passwords.enabled AND mail_app_passwords.apply_new_mailbox_default are both true; omitted from GET otherwise."}},"required":["id","name","email","plan","effective_plan_slug","subscription_status","limits","features","usage","safety_limits","created_at"]}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/InsufficientScope"}}},"patch":{"operationId":"updateAccount","summary":"Set the account default for new mailboxes","description":"Requires mailboxes:write and Idempotency-Key. Only the account owner may change new_mailbox_client_auth_mode; every account member token or member-authorised connector is refused with 403 scope_blocked_by_membership regardless of role. Affects mailboxes created from now on; existing mailboxes keep their own setting. Returns 404 unless mail_app_passwords.enabled and mail_app_passwords.apply_new_mailbox_default are both true. This is the only writable account field.","tags":["Account"],"parameters":[{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"new_mailbox_client_auth_mode":{"type":"string","enum":["password_or_app_password","app_password_only"],"description":"Mail-app sign-in mode for NEW mailboxes; existing mailboxes keep their own setting. Shown by GET \/account and writable via PATCH \/account only when mail_app_passwords.enabled AND mail_app_passwords.apply_new_mailbox_default are both true; omitted from GET otherwise."}},"required":["new_mailbox_client_auth_mode"]}}}},"responses":{"200":{"description":"New-mailbox default set","content":{"application\/json":{"schema":{"type":"object","properties":{"id":{"type":"integer"},"new_mailbox_client_auth_mode":{"type":"string","enum":["password_or_app_password","app_password_only"]},"message":{"type":"string"}},"required":["id","new_mailbox_client_auth_mode","message"]}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"description":"insufficient_scope; scope_blocked_by_membership for any account member token or connector","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"404":{"description":"not_found: app passwords or the platform default for new mailboxes are disabled","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"409":{"description":"idempotency_mismatch or conflict on a concurrent request using the same key","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"description":"validation_error; missing_idempotency_key; invalid_idempotency_key","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/sending-limits":{"get":{"operationId":"getSendingLimits","summary":"The account's sending allowance today","description":"Plan allowances after trial or first-payment safety caps (`causes`), each domain still in its first-week warm-up with the dates its allowance steps up, what the first payment would change (`after_payment`), and today's account-wide usage. In the first 24 hours after the account's first payment, `causes` includes `new_payer` and `full_limits_at` says when the plan's full limits apply. A token restricted to some domains gets `account: null` and only its own domains. Requires `account:read`.","tags":["Account"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Sending allowance","content":{"application\/json":{"schema":{"type":"object","properties":{"plan":{"type":"string"},"causes":{"type":"array","items":{"type":"string","enum":["trial","unpaid","new_payer"]}},"resets_at":{"type":"string","format":"date-time"},"account":{"type":["object","null"],"properties":{"daily_limit":{"type":"integer"},"used_today":{"type":["integer","null"]},"remaining_today":{"type":["integer","null"]},"forwarded_today":{"type":["integer","null"],"description":"Forwarded messages, which spend the same daily allowance."},"smtp_hourly_limit":{"type":"integer"}}},"per_mailbox_daily_limit":{"type":"integer"},"recipients_per_message":{"type":"integer"},"full_limits_at":{"type":["string","null"],"format":"date-time","description":"In the first 24 hours after the account's first payment (cause `new_payer`): when the plan's full limits apply. Null otherwise."},"after_payment":{"type":["object","null"],"properties":{"per_mailbox_daily_limit":{"type":"integer"},"account_daily_limit":{"type":"integer"},"recipients_per_message":{"type":"integer"},"first_hours":{"type":["object","null"],"description":"The limits for the first hours after that payment, before the figures above apply.","properties":{"hours":{"type":"integer"},"per_mailbox_daily_limit":{"type":"integer"},"account_daily_limit":{"type":"integer"},"recipients_per_message":{"type":"integer"}}}}},"domains_warming_up":{"type":"array","items":{"type":"object","properties":{"domain_id":{"type":"integer"},"domain":{"type":"string"},"day":{"type":"integer"},"percent":{"type":"integer"},"per_mailbox_daily_limit":{"type":"integer"},"domain_daily_limit":{"type":"integer"},"used_today":{"type":["integer","null"]},"steps":{"type":"array","items":{"type":"object","properties":{"starts_at":{"type":"string","format":"date-time"},"percent":{"type":"integer"},"per_mailbox_daily_limit":{"type":"integer"},"domain_daily_limit":{"type":"integer"}}}}}}}}}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/InsufficientScope"}}}},"\/domains":{"get":{"operationId":"listDomains","summary":"List domains","tags":["Domains"],"parameters":[{"name":"status","in":"query","schema":{"type":"string"}},{"name":"search","in":"query","schema":{"type":"string"}},{"name":"page","in":"query","schema":{"type":"integer","default":1}},{"name":"per_page","in":"query","schema":{"type":"integer","default":50,"maximum":100}}],"responses":{"200":{"description":"Paginated list of domains","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Domain"}}}}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"}}}},"\/domains\/{domain}":{"get":{"operationId":"getDomain","summary":"Get a domain","tags":["Domains"],"parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Domain details","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Domain"}}}},"404":{"$ref":"#\/components\/responses\/NotFound"}}}},"\/domains\/{domain}\/dns-requirements":{"get":{"operationId":"getDnsRequirements","summary":"Get DNS requirements for a domain","tags":["DNS"],"parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"DNS requirements and checks","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/DnsRequirements"}}}},"404":{"$ref":"#\/components\/responses\/NotFound"}}}},"\/domains\/{domain}\/dns-recheck":{"post":{"operationId":"recheckDns","summary":"Trigger a DNS recheck","tags":["DNS"],"parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"202":{"description":"DNS check queued","content":{"application\/json":{"schema":{"type":"object","properties":{"check_id":{"type":"integer"},"status":{"type":"string","enum":["queued"]},"created_at":{"type":"string","format":"date-time"}}}}}},"404":{"$ref":"#\/components\/responses\/NotFound"}}}},"\/domains\/{domain}\/matching-addresses":{"get":{"operationId":"getDomainMatchingAddresses","summary":"Get domain-alias settings for a domain","description":"Returns whether mail to a local part on this alias domain is delivered to the same local part on a primary domain. Requires `domains:read` and applies the caller's domain constraints.","tags":["Domains"],"parameters":[{"$ref":"#\/components\/parameters\/DomainId"}],"responses":{"200":{"description":"Domain-alias settings","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/DomainMatchingAddresses"}}}},"404":{"$ref":"#\/components\/responses\/NotFound"}}},"put":{"operationId":"setDomainMatchingAddresses","summary":"Connect a domain alias to a primary domain","description":"Receive-only in v1. Mail to `name@alias-domain` is delivered to `name@primary-domain` only when the primary address can receive mail. Exact addresses on the alias domain keep priority. Requires Starter or higher for dashboard use; API access remains subject to the account's normal API plan gate.","tags":["Domains"],"parameters":[{"$ref":"#\/components\/parameters\/DomainId"},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["primary_domain_id"],"properties":{"primary_domain_id":{"type":"integer","minimum":1}}}}}},"responses":{"200":{"description":"Domain alias connected","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/DomainMatchingAddresses"}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"409":{"$ref":"#\/components\/responses\/Conflict"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}},"delete":{"operationId":"removeDomainMatchingAddresses","summary":"Turn off a domain alias for a domain","description":"Removes the domain connection. Exact addresses are unchanged. Requires `domains:write`, an idempotency key, and the destructive rate limit.","tags":["Domains"],"parameters":[{"$ref":"#\/components\/parameters\/DomainId"},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"responses":{"200":{"description":"Domain alias turned off","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/DomainMatchingAddresses"}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}}},"\/domains\/{domain}\/forwarding-addresses":{"get":{"operationId":"listDomainForwardingAddresses","summary":"List forwarding addresses for a domain","description":"Returns mailbox-less forwarding addresses, the plan's per-domain limit, and whether delivery is currently active. Pro includes 100 per domain; Agency includes 300. Requires `domains:read`.","tags":["Domains"],"parameters":[{"$ref":"#\/components\/parameters\/DomainId"}],"responses":{"200":{"description":"Forwarding addresses and current delivery state","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ForwardingAddressListResponse"}}}},"404":{"$ref":"#\/components\/responses\/NotFound"}}},"post":{"operationId":"createDomainForwardingAddress","summary":"Create a forwarding address","description":"Creates a mailbox-less forwarding address. Delivery is live on Pro and Agency; Nano and Starter may retain saved inactive rules. Requires `domains:write` and an idempotency key.","tags":["Domains"],"parameters":[{"$ref":"#\/components\/parameters\/DomainId"},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["local_part","recipients"],"properties":{"local_part":{"type":"string","maxLength":64,"examples":["sales"]},"recipients":{"type":"array","minItems":1,"maxItems":15,"description":"Addresses on other domains, or mailboxes (and their receiving aliases) on this domain, which makes a team address. Any other address on this domain is refused with forwarding.code `recipient_on_same_domain`.","items":{"type":"string","format":"email","maxLength":255}},"is_active":{"type":"boolean","default":true}}}}}},"responses":{"201":{"description":"Forwarding address created","content":{"application\/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#\/components\/schemas\/ForwardingAddress"}}}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}}},"\/domains\/{domain}\/forwarding-addresses\/{forwardingAddress}":{"patch":{"operationId":"updateDomainForwardingAddress","summary":"Update or pause a forwarding address","description":"Replaces recipients, pauses the address, resumes it, or combines those changes. Requires `domains:write`.","tags":["Domains"],"parameters":[{"$ref":"#\/components\/parameters\/DomainId"},{"name":"forwardingAddress","in":"path","required":true,"schema":{"type":"integer","minimum":1}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","minProperties":1,"properties":{"recipients":{"type":"array","minItems":1,"maxItems":15,"description":"Replaces the recipients entirely. Addresses on other domains, or mailboxes (and their receiving aliases) on this domain; any other address on this domain is refused with forwarding.code `recipient_on_same_domain`.","items":{"type":"string","format":"email","maxLength":255}},"is_active":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Forwarding address updated","content":{"application\/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#\/components\/schemas\/ForwardingAddress"}}}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}},"delete":{"operationId":"deleteDomainForwardingAddress","summary":"Delete a forwarding address","description":"Permanently removes the address so future mail to it bounces. Requires `domains:write` and an idempotency key.","tags":["Domains"],"parameters":[{"$ref":"#\/components\/parameters\/DomainId"},{"name":"forwardingAddress","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"responses":{"200":{"description":"Forwarding address deleted","content":{"application\/json":{"schema":{"type":"object","required":["deleted"],"properties":{"deleted":{"type":"boolean","const":true}}}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"}}}},"\/domains\/{domain}\/forwarding-addresses\/{forwardingAddress}\/log":{"get":{"operationId":"getDomainForwardingAddressLog","summary":"Get recent delivery history for a forwarding address","description":"Returns recent forwarding outcomes newest first. Pro retains 7 days and Agency retains 30 days. Requires `domains:read`.","tags":["Domains"],"parameters":[{"$ref":"#\/components\/parameters\/DomainId"},{"name":"forwardingAddress","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200,"default":100}}],"responses":{"200":{"description":"Recent delivery history","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ForwardingAddressLogResponse"}}}},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}}},"\/domains\/{domain}\/mail-hosting":{"patch":{"operationId":"updateDomainMailHosting","summary":"Set whether TrekMail hosts the domain's incoming mail","description":"Dashboard\/Ops API. Requires `domains:write`. Switching a domain to `external` stops its mailboxes receiving, so the request is refused until you resend it with `confirm_mailboxes_stop_receiving: true`. A domain that still has a catch-all or forwarding addresses must have those removed first.","tags":["Domains"],"parameters":[{"$ref":"#\/components\/parameters\/DomainId"},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["mail_hosting"],"properties":{"mail_hosting":{"type":"string","enum":["trekmail","external"]},"confirm_mailboxes_stop_receiving":{"type":"boolean","default":false}}}}}},"responses":{"200":{"description":"Updated domain","content":{"application\/json":{"schema":{"type":"object","properties":{"domain":{"$ref":"#\/components\/schemas\/Domain"}}}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}}},"\/domains\/{domain}\/spam-metrics":{"get":{"operationId":"getSpamMetrics","summary":"Get daily spam metrics","description":"Returns daily spam protection metrics for a domain, including inbound count, spam caught, spam rejected, and clean emails per day. Zero-filled for days without data.","tags":["Spam Protection"],"parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"integer"},"description":"Domain ID"},{"name":"days","in":"query","schema":{"type":"integer","minimum":1,"maximum":90,"default":30},"description":"Number of days to look back (default 30, max 90)"}],"responses":{"200":{"description":"Daily spam metrics","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string","format":"date"},"inbound":{"type":"integer"},"spam":{"type":"integer"},"rejected":{"type":"integer"},"clean":{"type":"integer"}}}}}}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"404":{"$ref":"#\/components\/responses\/NotFound"}}}},"\/domains\/{domain}\/spam-metrics\/summary":{"get":{"operationId":"getSpamSummary","summary":"Get spam protection summary","description":"Returns aggregated spam protection stats for a domain over the specified period. Includes total inbound, spam rate, protection status, and top triggered filter rules.","tags":["Spam Protection"],"parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"integer"},"description":"Domain ID"},{"name":"days","in":"query","schema":{"type":"integer","minimum":1,"maximum":90,"default":30},"description":"Number of days to look back (default 30, max 90)"}],"responses":{"200":{"description":"Spam protection summary","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"period_days":{"type":"integer"},"inbound_total":{"type":"integer"},"clean":{"type":"integer"},"spam_detected":{"type":"integer"},"spam_rejected":{"type":"integer"},"virus_detected":{"type":"integer"},"spam_rate":{"type":"number"},"false_positives_released":{"type":"integer"},"user_reported_spam":{"type":"integer"},"status":{"type":"string","enum":["no_data","excellent","good","moderate","high_spam"]},"top_symbols":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"hits":{"type":"integer"}}}}}}}}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"404":{"$ref":"#\/components\/responses\/NotFound"}}}},"\/dns-checks\/{check}":{"get":{"operationId":"getDnsCheck","summary":"Get DNS check status","tags":["DNS"],"parameters":[{"name":"check","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"DNS check details","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/DnsCheck"}}}},"404":{"$ref":"#\/components\/responses\/NotFound"}}}},"\/mailboxes":{"get":{"operationId":"listMailboxes","summary":"List mailboxes","tags":["Mailboxes"],"parameters":[{"name":"domain_id","in":"query","schema":{"type":"integer"}},{"name":"search","in":"query","schema":{"type":"string"}},{"name":"page","in":"query","schema":{"type":"integer","default":1}},{"name":"per_page","in":"query","schema":{"type":"integer","default":50,"maximum":100}}],"responses":{"200":{"description":"Paginated list of mailboxes","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Mailbox"}}}}}}}}},"post":{"operationId":"createMailbox","summary":"Create a mailbox","tags":["Mailboxes"],"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["domain_id","local_part","password_mode"],"properties":{"domain_id":{"type":"integer"},"local_part":{"type":"string","pattern":"^(?!.*_archived_[0-9]{8}_[0-9]{6}(?:_[0-9]+_[0-9]+)?$)[a-z0-9_][a-z0-9_-]*(?:\\.[a-z0-9_-]+)*$","maxLength":64},"display_name":{"type":"string","maxLength":255},"password_mode":{"type":"string","enum":["generated_one_time"]},"client_auth_mode":{"type":"string","enum":["password_or_app_password","app_password_only"],"description":"What mail apps may sign in with on the new mailbox (see Mailbox.client_auth_mode). Omit it for the default: the account's setting for new mailboxes where the platform applies it, otherwise password_or_app_password. With app_password_only, the generated one_time_password signs in to webmail only (not classic webmail, which signs in over IMAP like a mail app), and mail apps need an app password: pass create_app_password to get the first one in this response, or create one later with POST \/mailboxes\/{mailbox}\/app-passwords. Applied only while app passwords are enabled on the platform."},"create_app_password":{"type":"boolean","default":false,"description":"true also issues the new mailbox's first app password and returns it once as app_password, so a mail app can be set up without a second call. It is named \"Created with the mailbox\" and no \"new app password\" email is sent for it. Off by default: without it the response is unchanged. Ignored while app passwords are not enabled on the platform."},"storage_allocation_mb":{"type":"integer","minimum":1,"nullable":true,"description":"Optional dedicated storage allocation in megabytes. Omit (or pass null) for shared account pool. Validated against the live pool minus existing dedicated allocations and pending dedicated invites."}}}}}},"responses":{"201":{"description":"Mailbox created","content":{"application\/json":{"schema":{"allOf":[{"$ref":"#\/components\/schemas\/Mailbox"},{"type":"object","properties":{"one_time_password":{"type":"string"},"app_password":{"description":"Present only when create_app_password was true and app passwords are enabled: the mailbox's first app password with its secret in password, which appears in this response only (an exact retry with the same Idempotency-Key replays this response). Null when it could not be issued; _app_password_warning then says how to create one.","oneOf":[{"allOf":[{"$ref":"#\/components\/schemas\/MailboxAppPassword"},{"type":"object","properties":{"password":{"type":"string","pattern":"^[a-z]{16}$"}}}]},{"type":"null"}]},"_app_password_warning":{"type":"string","description":"Only when app_password is null: why, and the POST \/mailboxes\/{mailbox}\/app-passwords call that creates one."}}}]}}}},"409":{"$ref":"#\/components\/responses\/Conflict"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}}},"\/mailboxes\/{mailbox}":{"get":{"operationId":"getMailbox","summary":"Get a mailbox","tags":["Mailboxes"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"Mailbox details","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Mailbox"}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"}}},"patch":{"operationId":"updateMailbox","summary":"Update write-safe mailbox fields","description":"Updates a display name and\/or the conversation-view preference. conversation_view applies only to regular mailboxes; shared mailboxes use the preference of the regular member mailbox opening them. Changes to conversation_view become visible after webmail reload.","tags":["Mailboxes"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"display_name":{"type":["string","null"],"maxLength":255},"conversation_view":{"type":"boolean","description":"Whether webmail groups related messages into conversations for this regular mailbox."},"drive_access":{"type":"string","enum":["full","attachments_only","disabled"],"description":"How much of Drive the mailbox's own user reaches in webmail. `full` is everything; `attachments_only` removes Drive but still sends over-threshold files as a download link; `disabled` also refuses those. Storage is pooled across the account, so this bounds how much of it one person can fill with files. Not applicable to shared mailboxes. Returns 422 drive_access_not_applicable for a shared mailbox."}}}}}},"responses":{"200":{"description":"Mailbox updated","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Mailbox"}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"description":"Validation error, including conversation_view on a shared mailbox","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/mailboxes\/invites":{"post":{"operationId":"createInvite","summary":"Create a mailbox invite","tags":["Invites"],"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["domain_id","local_part","recipient_email"],"properties":{"domain_id":{"type":"integer"},"local_part":{"type":"string","pattern":"^(?!.*_archived_[0-9]{8}_[0-9]{6}(?:_[0-9]+_[0-9]+)?$)[a-z0-9_][a-z0-9_-]*(?:\\.[a-z0-9_-]+)*$","maxLength":64},"recipient_email":{"type":"string","format":"email","maxLength":255},"expires_in_hours":{"type":"integer","minimum":1,"maximum":720},"storage_allocation_mb":{"type":"integer","minimum":1,"nullable":true,"description":"Optional dedicated storage allocation in megabytes. Omit for shared account pool. Pending dedicated invites count against the available pool until they are redeemed or expire \u2014 the new mailbox inherits this allocation when the recipient redeems."}}}}}},"responses":{"201":{"description":"Invite created","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MailboxInvite"}}}},"422":{"$ref":"#\/components\/responses\/ValidationError"}}}},"\/mailboxes\/invites:bulk":{"post":{"operationId":"bulkCreateInvites","summary":"Bulk create mailbox invites","tags":["Invites"],"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["domain_id","items"],"properties":{"domain_id":{"type":"integer"},"items":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"object","required":["local_part","recipient_email"],"properties":{"local_part":{"type":"string","maxLength":64,"pattern":"^(?!.*_archived_[0-9]{8}_[0-9]{6}(?:_[0-9]+_[0-9]+)?$)[a-z0-9_][a-z0-9_-]*(?:\\.[a-z0-9_-]+)*$"},"recipient_email":{"type":"string","format":"email"},"storage_allocation_mb":{"type":"integer","minimum":1,"nullable":true,"description":"Optional dedicated allocation in MB for this recipient. Each dedicated item is checked against the remaining pool when it is created; items that no longer fit fail individually with reason storage_pool_exceeded."}}}},"expires_in_hours":{"type":"integer","minimum":1,"maximum":720}}}}}},"responses":{"200":{"description":"All invites created","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BulkInviteResult"}}}},"207":{"description":"Partial success","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BulkInviteResult"}}}},"403":{"description":"Account standing prohibits invitation creation","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"description":"Every invitation row failed validation or a business rule","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BulkInviteResult"}}}}}}},"\/mailboxes:bulk":{"post":{"operationId":"bulkCreateMailboxes","summary":"Bulk create mailboxes","description":"Create up to 100 mailboxes in a single request. Each item specifies a domain, local part, and password. Returns per-item results with created\/failed status.","tags":["Mailboxes"],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["items"],"properties":{"items":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"object","required":["domain_id","local_part","password"],"properties":{"domain_id":{"type":"integer"},"local_part":{"type":"string","maxLength":64,"pattern":"^(?!.*_archived_[0-9]{8}_[0-9]{6}(?:_[0-9]+_[0-9]+)?$)[a-z0-9_][a-z0-9_-]*(?:\\.[a-z0-9_-]+)*$"},"password":{"type":"string","minLength":12},"storage_allocation_mb":{"type":"integer","minimum":1,"nullable":true,"description":"Optional dedicated allocation in MB. Each dedicated item is checked against the remaining pool when it is created; items that no longer fit fail individually with reason storage_pool_exceeded."}}}},"create_app_password":{"type":"boolean","default":false,"description":"As for POST \/mailboxes: true also issues each created mailbox's first app password and returns it once in that row's app_password (null for a row where it could not be issued). Off by default; ignored while app passwords are not enabled."}}}}}},"responses":{"200":{"description":"All mailboxes created","content":{"application\/json":{"schema":{"type":"object","properties":{"counts":{"type":"object","properties":{"created":{"type":"integer"},"failed":{"type":"integer"}}},"results":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"},"status":{"type":"string","enum":["created","failed"]},"reason":{"type":"string","nullable":true,"description":"Machine-readable failure code for this row; null when it succeeded."},"mailbox_id":{"type":"integer"},"error":{"type":"string"},"app_password":{"description":"Only with create_app_password: the created mailbox's first app password, as in POST \/mailboxes, or null.","oneOf":[{"allOf":[{"$ref":"#\/components\/schemas\/MailboxAppPassword"},{"type":"object","properties":{"password":{"type":"string","pattern":"^[a-z]{16}$"}}}]},{"type":"null"}]}}}}}}}}},"207":{"description":"Partial success \u2014 some created, some failed"},"422":{"description":"All failed \u2014 validation or business logic error"}}}},"\/mailboxes:drive-access":{"post":{"operationId":"setMailboxesDriveAccess","summary":"Set Drive access on many mailboxes","description":"Applies one Drive access level to many mailboxes. Provide exactly one selector: an explicit mailbox_ids list, a domain_id (every mailbox on that domain \u2014 the usual choice when one domain is one customer), or all. Shared mailboxes are skipped and counted. Mailboxes already on the requested level are matched but not updated, so the call is safe to repeat. Nothing is deleted: files already stored stay until they are removed.","tags":["Mailboxes"],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["drive_access"],"properties":{"drive_access":{"type":"string","enum":["full","attachments_only","disabled"],"description":"How much of Drive the mailbox's own user reaches in webmail. `full` is everything; `attachments_only` removes Drive but still sends over-threshold files as a download link; `disabled` also refuses those. Storage is pooled across the account, so this bounds how much of it one person can fill with files. Not applicable to shared mailboxes."},"mailbox_ids":{"type":"array","minItems":1,"maxItems":1000,"items":{"type":"integer","minimum":1}},"domain_id":{"type":"integer","minimum":1},"all":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Levels applied","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"drive_access":{"type":"string","enum":["full","attachments_only","disabled"]},"matched":{"type":"integer"},"updated":{"type":"integer"},"skipped_shared":{"type":"integer"}}}}}}}},"404":{"description":"One or more named mailboxes were not found"},"422":{"description":"invalid_selection \u2014 provide exactly one selector"}}}},"\/mailboxes\/{mailbox}\/storage":{"patch":{"operationId":"updateMailboxStorage","summary":"Set a mailbox's storage: shared or a fixed size","description":"Requires mailboxes:write and Idempotency-Key. Moves an active or paused mailbox between shared storage (null) and a fixed size in MB, with the same checks as the dashboard's Edit storage. A fixed size must fit in the account pool (422 storage_pool_exceeded, as POST \/mailboxes) and, in a domain under a client storage limit, in that limit (422 client_storage_limit_exceeded). There a mailbox may also not be cut below what it already stores (422 client_storage_below_usage); raising it, or moving it to shared storage, is always allowed. A mailbox in Recently deleted or being deleted is 422 mailbox_unavailable. Returns the mailbox wrapped in data.","tags":["Mailboxes"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MailboxStorageUpdate"}}}},"responses":{"200":{"description":"Mailbox storage changed","content":{"application\/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#\/components\/schemas\/Mailbox"}}}}}},"403":{"$ref":"#\/components\/responses\/InsufficientScope"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"description":"validation_error, storage_pool_exceeded, client_storage_limit_exceeded (details.limit_mb, allocated_mb, available_mb, requested_mb), client_storage_below_usage (details.used_mb) or mailbox_unavailable","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/mailboxes\/{mailbox}\/password":{"post":{"operationId":"changeMailboxPassword","summary":"Set a new mailbox password","description":"Requires mailboxes:write and Idempotency-Key. A token that acts for an account member (or a connector a member authorised) also needs that member's role to allow setting mailbox passwords, or the call returns 403 scope_blocked_by_membership. Sets the mailbox password: the one webmail signs in with, and the one mail apps sign in with while the mailbox's client_auth_mode accepts it. Every message token (tm_msg_) of the mailbox is revoked. While app passwords are enabled on the platform, this reset automatically revokes every app password of the mailbox (reason mailbox_password_reset), even when mail-server synchronization is pending, and returns app_passwords_revoked. Mail apps need new app passwords afterwards. The mailbox user's own password change in webmail alone offers opt-in revocation (reason mailbox_password_changed). The new password is saved at once; when the mail server has not confirmed it yet, the response is 202 and synchronization retries automatically. A paused mailbox can be given a new password; a mailbox being deleted cannot.","tags":["Mailboxes"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["password"],"properties":{"password":{"type":"string","minLength":12,"description":"At least 12 characters with an upper-case letter, a lower-case letter and a digit, and at most 72 bytes. A password that appears in a known data breach is refused."}}}}}},"responses":{"200":{"description":"Password changed and confirmed by the mail server","content":{"application\/json":{"schema":{"type":"object","required":["status","sync_pending","message"],"properties":{"status":{"type":"string","const":"updated"},"sync_pending":{"type":"boolean","const":false},"message":{"type":"string"},"app_passwords_revoked":{"type":"integer","minimum":0,"description":"How many app passwords this call revoked. Present while app passwords are enabled on the platform."}}}}}},"202":{"description":"Password saved; mail-server synchronization is pending and retries automatically","content":{"application\/json":{"schema":{"type":"object","required":["status","sync_pending","message"],"properties":{"status":{"type":"string","const":"update_pending"},"sync_pending":{"type":"boolean","const":true},"message":{"type":"string"},"app_passwords_revoked":{"type":"integer","minimum":0,"description":"How many app passwords this call revoked. Present while app passwords are enabled on the platform."}}}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"409":{"description":"conflict: another password change for this mailbox is in progress; retry shortly","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"description":"validation_error, or mailbox_unavailable for a mailbox that is being deleted","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/mailboxes\/{mailbox}\/note":{"patch":{"operationId":"updateMailboxNote","summary":"Set or clear a mailbox note","description":"Requires mailboxes:write. Sets the mailbox's private note, the same note the dashboard edits, for the account's own records (who uses the mailbox, for example). It is returned as note on the mailbox and matched by the search filter of GET \/mailboxes. Surrounding whitespace is trimmed; null or an empty string clears it.","tags":["Mailboxes"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["note"],"properties":{"note":{"type":["string","null"],"maxLength":120}}}}}},"responses":{"200":{"description":"Note saved","content":{"application\/json":{"schema":{"type":"object","required":["note"],"properties":{"note":{"type":["string","null"]}}}}}},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}}},"\/mailboxes\/{mailbox}:pause":{"post":{"operationId":"pauseMailbox","summary":"Pause a mailbox","description":"Requires mailboxes:write and Idempotency-Key. Pauses an active mailbox: its status becomes disabled, it stops receiving mail, and mail apps can no longer sign in to it. Mail already in the mailbox is kept. To stop only sign-in while mail keeps arriving, use :suspend-login instead.","tags":["Mailboxes"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"responses":{"200":{"description":"Mailbox paused","content":{"application\/json":{"schema":{"type":"object","required":["status","message"],"properties":{"status":{"type":"string","const":"paused"},"message":{"type":"string"}}}}}},"404":{"$ref":"#\/components\/responses\/NotFound"},"409":{"description":"conflict: the mailbox is already paused","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"description":"mailbox_unavailable: only an active mailbox can be paused","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/mailboxes\/{mailbox}:resume":{"post":{"operationId":"resumeMailbox","summary":"Resume a paused mailbox","description":"Requires mailboxes:write and Idempotency-Key. Returns a paused mailbox to active: it receives mail again and mail apps can sign in again, unless sign-in is suspended separately (:suspend-login).","tags":["Mailboxes"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"responses":{"200":{"description":"Mailbox resumed","content":{"application\/json":{"schema":{"type":"object","required":["status","message"],"properties":{"status":{"type":"string","const":"resumed"},"message":{"type":"string"}}}}}},"404":{"$ref":"#\/components\/responses\/NotFound"},"409":{"description":"conflict: the mailbox is already active","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"description":"mailbox_unavailable: only a paused mailbox can be resumed","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/mailboxes\/{mailbox}:suspend-login":{"post":{"operationId":"suspendMailboxLogin","summary":"Suspend sign-in for a mailbox","description":"Stops anyone signing in to this mailbox while its mail keeps arriving. Webmail, IMAP, SMTP and Drive device passwords are refused, open webmail sessions are ended, the mailbox's app passwords are revoked, and outstanding password-reset links stop working \u2014 but the mailbox stays active, so incoming mail is still delivered and waiting when sign-in is restored. Use this for a client who has not paid; `:pause` is the harsher one and stops delivery too. Shared mailboxes are refused: their members are suspended individually, and that follows them into any shared mailbox they open.","tags":["Mailboxes"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application\/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","maxLength":255,"description":"Why sign-in was suspended, e.g. \"unpaid invoice 42\". Shown to the account holder in the dashboard, never to the suspended user."}}}}}},"responses":{"200":{"description":"Sign-in suspended; delivery continues"},"404":{"description":"Mailbox not found"},"409":{"description":"Sign-in is already suspended"},"422":{"description":"mailbox_unavailable \u2014 shared, paused or trashed mailbox"}}}},"\/mailboxes\/{mailbox}:resume-login":{"post":{"operationId":"resumeMailboxLogin","summary":"Restore sign-in for a mailbox","description":"Lifts a sign-in suspension. Drive device passwords and app passwords revoked by the suspension are not restored: new ones are created from webmail, and app passwords also from the dashboard or POST \/mailboxes\/{mailbox}\/app-passwords.","tags":["Mailboxes"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Sign-in restored"},"404":{"description":"Mailbox not found"},"409":{"description":"Sign-in is not suspended"}}}},"\/mailboxes\/{mailbox}\/app-passwords":{"get":{"operationId":"listMailboxAppPasswords","summary":"List a mailbox's app passwords","description":"Requires mailboxes:read. App passwords are what mail apps (IMAP, SMTP on ports 465 and 587, ManageSieve, CalDAV\/CardDAV) sign in with instead of the mailbox password; an app password never opens webmail, though classic webmail signs in over IMAP like a mail app and accepts one. Lists the app passwords of this mailbox, active ones first and newest first, without their secrets, which are shown only once. Revoked app passwords stay in the list, with revoked_at and revoked_reason, for 90 days. Returns 404 while app passwords are not enabled on the platform.","tags":["Mailboxes"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"App passwords of the mailbox, without secrets","content":{"application\/json":{"schema":{"type":"object","required":["mailbox_id","client_auth_mode","limit","active_count","data"],"properties":{"mailbox_id":{"type":"integer"},"client_auth_mode":{"type":"string","enum":["password_or_app_password","app_password_only"],"description":"What mail apps may sign in with on this mailbox; see Mailbox.client_auth_mode."},"limit":{"type":"integer","minimum":1,"description":"How many active app passwords the mailbox may hold (25)."},"active_count":{"type":"integer","minimum":0},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/MailboxAppPassword"}}}}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"description":"Mailbox not found, or app passwords are not enabled on the platform","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}},"post":{"operationId":"createMailboxAppPassword","summary":"Create an app password","description":"Requires mailboxes:write and Idempotency-Key. A token that acts for an account member (or a connector a member authorised) also needs that member's role to allow setting mailbox passwords, or the call returns 403 scope_blocked_by_membership. Creates an app password for one mail app or device and returns its secret once, in data.password. It signs in to IMAP, SMTP (465 and 587), ManageSieve and CalDAV\/CardDAV whatever the mailbox's client_auth_mode, and never to webmail (classic webmail signs in over IMAP like a mail app, so it accepts one). An idempotent replay returns the stored response without the secret; create another app password if it was lost. The mailbox must be an active regular mailbox whose sign-in is not suspended (422 mailbox_not_eligible) and hold fewer than 25 active app passwords (422 app_password_limit_reached). At most 60 creations per hour per account. Returns 404 while app passwords are not enabled on the platform.","tags":["Mailboxes"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":64,"description":"Which mail app or device it is for, e.g. \"Outlook on the office laptop\". 1 to 64 printable characters; runs of whitespace are collapsed to one space."}}}}}},"responses":{"201":{"description":"App password created; the secret is in data.password and is not shown again","content":{"application\/json":{"schema":{"type":"object","required":["data","message"],"properties":{"data":{"allOf":[{"$ref":"#\/components\/schemas\/MailboxAppPassword"},{"type":"object","properties":{"password":{"type":"string","pattern":"^[a-z]{16}$","description":"The app password, shown only in this response: 16 lowercase letters. Mail apps accept it with or without spaces between the groups of four letters and in any letter case. It is never stored in readable form, so it cannot be shown again: an idempotent replay of this request returns the response without this field."}}}]},"message":{"type":"string"}}}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"description":"Mailbox not found, or app passwords are not enabled on the platform","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"description":"validation_error, invalid_name, mailbox_not_eligible or app_password_limit_reached","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"$ref":"#\/components\/responses\/TooManyRequests"}}}},"\/mailboxes\/{mailbox}\/app-passwords\/{appPassword}:rotate":{"post":{"operationId":"rotateMailboxAppPassword","summary":"Replace the secret of an app password","description":"Requires mailboxes:write and Idempotency-Key. A token that acts for an account member (or a connector a member authorised) also needs that member's role to allow setting mailbox passwords, or the call returns 403 scope_blocked_by_membership. Replaces the secret of an active app password and keeps its name. The old secret stops working at once and the old app password is revoked with reason rotated; the replacement is a new app password with a new id, and replaced_id names the old one. The new secret is returned once, in data.password; an idempotent replay omits it. At most 30 replacements per hour per account. Returns 404 while app passwords are not enabled on the platform.","tags":["Mailboxes"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"name":"appPassword","in":"path","required":true,"description":"App password id, from the list or from the create response.","schema":{"type":"integer","minimum":1}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"responses":{"200":{"description":"Secret replaced; the new one is in data.password and is not shown again","content":{"application\/json":{"schema":{"type":"object","required":["data","replaced_id","message"],"properties":{"data":{"allOf":[{"$ref":"#\/components\/schemas\/MailboxAppPassword"},{"type":"object","properties":{"password":{"type":"string","pattern":"^[a-z]{16}$","description":"The app password, shown only in this response: 16 lowercase letters. Mail apps accept it with or without spaces between the groups of four letters and in any letter case. It is never stored in readable form, so it cannot be shown again: an idempotent replay of this request returns the response without this field."}}}]},"replaced_id":{"type":"integer","description":"Id of the app password this one replaced."},"message":{"type":"string"}}}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"description":"Mailbox or app password not found, or app passwords are not enabled on the platform","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"409":{"description":"conflict: the app password was already revoked","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"description":"mailbox_not_eligible: the mailbox is not an active regular mailbox, or its sign-in is suspended","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"$ref":"#\/components\/responses\/TooManyRequests"}}}},"\/mailboxes\/{mailbox}\/app-passwords\/{appPassword}":{"delete":{"operationId":"revokeMailboxAppPassword","summary":"Revoke an app password","description":"Requires mailboxes:write and Idempotency-Key. A token that acts for an account member (or a connector a member authorised) also needs that member's role to allow setting mailbox passwords, or the call returns 403 scope_blocked_by_membership. Revokes an app password: it stops working at once and mail apps signed in with it are disconnected. It stays in the list as revoked, with reason revoked. Returns 404 while app passwords are not enabled on the platform.","tags":["Mailboxes"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"name":"appPassword","in":"path","required":true,"description":"App password id, from the list or from the create response.","schema":{"type":"integer","minimum":1}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"responses":{"200":{"description":"App password revoked","content":{"application\/json":{"schema":{"type":"object","required":["status","data"],"properties":{"status":{"type":"string","const":"revoked"},"data":{"$ref":"#\/components\/schemas\/MailboxAppPassword"}}}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"description":"Mailbox or app password not found, or app passwords are not enabled on the platform","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"409":{"description":"conflict: the app password was already revoked","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/mailboxes\/{mailbox}:client-auth-mode":{"post":{"operationId":"setMailboxClientAuthMode","summary":"Choose what mail apps sign in with","description":"Requires mailboxes:write and Idempotency-Key. A token that acts for an account member (or a connector a member authorised) also needs that member's role to allow setting mailbox passwords, or the call returns 403 scope_blocked_by_membership. Sets what mail apps (IMAP, SMTP, ManageSieve, CalDAV\/CardDAV) may sign in with. app_password_only: mail apps need an app password, and sessions opened with the mailbox password are signed out; a mail app that tries the mailbox password is refused with \"Sign-in failed. This mailbox accepts app passwords only: create one in webmail under Settings > App passwords.\" password_or_app_password: the mailbox password works in mail apps again, next to app passwords. Webmail always signs in with the mailbox password (plus the two-factor code when two-factor authentication is on), and an app password never opens it. Classic webmail signs in over IMAP like a mail app, so an app_password_only mailbox signs in to it with an app password. Neither mode affects the Message API, migrations into the mailbox or mail rules. A member opens a shared mailbox in a mail app with its own sign-in, so the member mailbox's own mode applies there. Setting the current mode again changes nothing and returns 200. Returns 404 while app passwords are not enabled on the platform.","tags":["Mailboxes"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["mode"],"properties":{"mode":{"type":"string","enum":["password_or_app_password","app_password_only"]}}}}}},"responses":{"200":{"description":"Mode set","content":{"application\/json":{"schema":{"type":"object","required":["mailbox_id","client_auth_mode","message"],"properties":{"mailbox_id":{"type":"integer"},"client_auth_mode":{"type":"string","enum":["password_or_app_password","app_password_only"]},"message":{"type":"string"}}}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"description":"Mailbox not found, or app passwords are not enabled on the platform","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"description":"validation_error; mailbox_not_eligible for a shared mailbox, which has no sign-in of its own; system_mailbox_protected for a mailbox the platform itself signs in to, which must keep accepting its mailbox password","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/mailboxes:login-access":{"post":{"operationId":"setMailboxesLoginAccess","summary":"Suspend or restore sign-in on many mailboxes","description":"Suspends or restores sign-in across many mailboxes, leaving delivery alone in both directions. Provide exactly one selector: an explicit mailbox_ids list, a domain_id (every mailbox on that domain \u2014 the usual choice when one domain is one customer), or all. Shared, paused and trashed mailboxes are skipped and counted. Mailboxes already in the requested state are matched but not updated, so the call is safe to repeat.","tags":["Mailboxes"],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["login_suspended"],"properties":{"login_suspended":{"type":"boolean","description":"true suspends sign-in, false restores it. Mail is delivered either way."},"reason":{"type":"string","maxLength":255,"description":"Recorded on each mailbox for the account holder; ignored when restoring."},"mailbox_ids":{"type":"array","minItems":1,"maxItems":1000,"items":{"type":"integer","minimum":1}},"domain_id":{"type":"integer","minimum":1},"all":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Applied","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"login_suspended":{"type":"boolean"},"matched":{"type":"integer"},"updated":{"type":"integer"},"skipped":{"type":"integer"}}}}}}}},"404":{"description":"One or more named mailboxes were not found"},"422":{"description":"invalid_selection \u2014 provide exactly one selector"}}}},"\/mailboxes\/{mailbox}\/client-setup":{"get":{"operationId":"getMailClientSetup","summary":"Get external mail-client connection settings","description":"Returns password-free IMAP and SMTP settings, actual outgoing-mail readiness, localized three-step guides for the same five apps shown in Apps & devices, and any native shared-mailbox folders delegated to this regular mailbox. Custom SMTP provider credentials, mailbox passwords and app passwords are never exposed; external clients always authenticate and submit through the public TrekMail endpoints with the regular member mailbox's own sign-in: its mailbox password or one of its app passwords, as authentication.password_source and authentication.accepted_passwords say.","tags":["Mailboxes"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"name":"lang","in":"query","required":false,"description":"Language for guided setup copy. Accept-Language is used when omitted.","schema":{"type":"string","enum":["en","es","fr","de","pt","it","nl","ru","zh","ja","ko","ar","he"]}}],"responses":{"200":{"description":"Password-free client settings, readiness, and delegated shared-mailbox folders","content":{"application\/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#\/components\/schemas\/MailClientSetup"}}}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}}},"\/mailboxes\/{mailbox}\/members":{"get":{"operationId":"listSharedMailboxMembers","summary":"List members of a shared mailbox","description":"Requires mailboxes:read. A delegated dashboard role also needs shared_mailboxes:read. Lists only members whose mailboxes are reachable within the caller's domain and mailbox limits. can_read opens the shared inbox in webmail and, when enabled, a shared IMAP folder. can_send allows sending as the team address. Send-only members have no shared inbox or folder; they send from their own webmail or mail app. The Message API does not support delegated sending yet.","tags":["Mailboxes"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"Members and shared-mailbox identity","content":{"application\/json":{"schema":{"type":"object","required":["data","shared_mailbox"],"properties":{"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/SharedMailboxMember"}},"shared_mailbox":{"type":"object","required":["id","email"],"properties":{"id":{"type":"integer"},"email":{"type":"string","format":"email"}}}}}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"}}},"post":{"operationId":"addSharedMailboxMember","summary":"Add a member to a shared mailbox","description":"Requires mailboxes:write and Idempotency-Key. A delegated dashboard role also needs shared_mailboxes:write, and both the shared and member mailbox must be reachable within the caller's domain and mailbox limits. can_read and can_send both default to true. Send-only access (can_read=false, can_send=true) requires the send-only feature to be enabled and another active reader to remain. At least one permission is required. Native IMAP access is granted only to readers, without a shared password.","tags":["Mailboxes"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["member_mailbox_id"],"properties":{"member_mailbox_id":{"type":"integer","minimum":1},"can_send":{"type":"boolean","default":true},"can_read":{"type":"boolean","default":true}}}}}},"responses":{"201":{"description":"Member added","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/SharedMailboxMember"}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"409":{"description":"Mailbox is already a member","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"description":"Invalid input or access refused: no_access_left (use Remove to revoke all access), send_only_disabled (Read cannot be disabled yet), last_reader (give someone else Read first).","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"503":{"description":"Native permissions could not be synchronized; retryable native_access_sync_failed, no membership saved.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/mailboxes\/{mailbox}\/members\/{member}":{"patch":{"operationId":"updateSharedMailboxMember","summary":"Update a shared-mailbox member","description":"Requires mailboxes:write. A delegated dashboard role also needs shared_mailboxes:write, and both mailboxes must be reachable within the caller's domain and mailbox limits. Update can_read, can_send or the personal custom_label. Omitted fields keep their current values. Both permissions cannot be false; disabling Read requires the send-only feature and another active reader. A native mail-server synchronization failure returns a retryable 503 and saves no permission change.","tags":["Mailboxes"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"name":"member","in":"path","required":true,"description":"Membership id, not the member mailbox id.","schema":{"type":"integer","minimum":1}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"can_send":{"type":"boolean"},"custom_label":{"type":["string","null"],"maxLength":120},"can_read":{"type":"boolean"}},"anyOf":[{"required":["can_read"]},{"required":["can_send"]},{"required":["custom_label"]}]}}}},"responses":{"200":{"description":"Member updated","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/SharedMailboxMember"}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"description":"Invalid input or access refused: no_access_left (use Remove to revoke all access), send_only_disabled (Read cannot be disabled yet), last_reader (give someone else Read first).","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"503":{"description":"Native mail-server permissions could not be synchronized; retryable and no change was saved","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}},"delete":{"operationId":"removeSharedMailboxMember","summary":"Remove a member from a shared mailbox","description":"Requires mailboxes:write and Idempotency-Key. A delegated dashboard role also needs shared_mailboxes:write, and both mailboxes must be reachable within the caller's domain and mailbox limits. Revokes read and send access without deleting the personal mailbox. The last active reader cannot be removed (last_reader when send-only members remain; last_member for the legacy case). A native mail-server synchronization failure returns a retryable 503 and keeps the membership.","tags":["Mailboxes"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"name":"member","in":"path","required":true,"description":"Membership id, not the member mailbox id.","schema":{"type":"integer","minimum":1}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"responses":{"200":{"description":"Member removed","content":{"application\/json":{"schema":{"type":"object","required":["deleted"],"properties":{"deleted":{"type":"boolean","const":true}}}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"},"503":{"description":"Native mail-server permissions could not be revoked; retryable and the membership was kept","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/shared-mailboxes":{"post":{"operationId":"createSharedMailbox","summary":"Create a shared mailbox","description":"Requires mailboxes:create and Idempotency-Key. Creates a team inbox with at least one regular member mailbox. No shared-mailbox password is accepted or returned; members use their own credentials in Webmail and delegated native IMAP access. If the local mailbox commits but mail-server provisioning is deferred, the API returns a retryable 503; retry the exact request with the same Idempotency-Key.","tags":["Mailboxes"],"parameters":[{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["domain_id","local_part","display_name","member_mailbox_ids"],"properties":{"domain_id":{"type":"integer","minimum":1},"local_part":{"type":"string","maxLength":64,"pattern":"^(?!.*_archived_[0-9]{8}_[0-9]{6}(?:_[0-9]+_[0-9]+)?$)[a-z0-9_][a-z0-9_-]*(?:\\.[a-z0-9_-]+)*$"},"display_name":{"type":"string","maxLength":255},"member_mailbox_ids":{"type":"array","minItems":1,"items":{"type":"integer","minimum":1}},"storage_shared":{"type":"boolean","default":true},"storage_mb":{"type":["integer","null"],"minimum":1,"description":"Required when storage_shared is false."}}}}}},"responses":{"201":{"description":"Shared mailbox created","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Mailbox"}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"},"503":{"description":"The shared mailbox was committed but mail-server provisioning is pending; retry the exact request with the same Idempotency-Key","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/mailboxes\/{mailbox}\/convert-to-shared":{"post":{"operationId":"convertMailboxToShared","summary":"Convert a regular mailbox to shared","description":"Requires mailboxes:write and Idempotency-Key. Rotates the backend credential, ends direct Webmail sessions and 2FA bypasses, revokes the mailbox's app passwords, assigns at least one member, and provisions delegated native access when enabled. If backend password synchronization is not confirmed immediately, returns 202 with durable automatic retry state instead of reporting success.","tags":["Mailboxes"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["member_mailbox_ids"],"properties":{"member_mailbox_ids":{"type":"array","minItems":1,"items":{"type":"integer","minimum":1}}}}}}},"responses":{"200":{"description":"Mailbox converted to shared","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Mailbox"}}}},"202":{"description":"Mailbox is shared with direct login blocked; backend password rotation remains pending and will retry automatically","content":{"application\/json":{"schema":{"type":"object","required":["status","sync_pending","mailbox"],"properties":{"status":{"type":"string","const":"conversion_pending"},"sync_pending":{"type":"boolean","const":true},"mailbox":{"$ref":"#\/components\/schemas\/Mailbox"}}}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}}},"\/mailboxes\/{mailbox}\/convert-to-regular":{"post":{"operationId":"convertSharedMailboxToRegular","summary":"Convert a shared mailbox to regular","description":"Requires mailboxes:write and Idempotency-Key. Revokes every member's Webmail and native access, removes memberships, and sets a new administrator-supplied password for direct sign-in. A native mail-server synchronization failure returns a retryable 503 and leaves the mailbox shared.","tags":["Mailboxes"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["password"],"properties":{"password":{"type":"string","minLength":12,"format":"password","description":"Must include uppercase, lowercase, and a digit. Never returned."}}}}}},"responses":{"200":{"description":"Mailbox converted to regular","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Mailbox"}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"},"503":{"description":"Native mail-server permissions could not be revoked; retryable and the mailbox remains shared","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/mailboxes\/{mailbox}\/apple-mail-profile":{"get":{"operationId":"downloadAppleMailProfile","summary":"Download a password-free Apple Mail profile","description":"Downloads a .mobileconfig profile containing IMAP and SMTP settings but no password. The mailbox must be a regular active mailbox with outgoing mail ready. Apple prompts for the password during installation: an app password when the mailbox accepts app passwords only, otherwise the mailbox password (authentication.password_source in GET \/mailboxes\/{mailbox}\/client-setup says which).","tags":["Mailboxes"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"name":"lang","in":"query","required":false,"description":"Language for profile descriptions. Accept-Language is used when omitted.","schema":{"type":"string","enum":["en","es","fr","de","pt","it","nl","ru","zh","ja","ko","ar","he"]}}],"responses":{"200":{"description":"Apple configuration profile","headers":{"Content-Disposition":{"schema":{"type":"string"},"description":"Attachment filename ending in .mobileconfig"},"Content-Language":{"schema":{"type":"string"}}},"content":{"application\/x-apple-aspen-config":{"schema":{"type":"string","format":"binary"}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"409":{"description":"Outgoing mail is not ready","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"$ref":"#\/components\/responses\/ValidationError"},"429":{"$ref":"#\/components\/responses\/TooManyRequests"}}}},"\/mailboxes\/{mailbox}\/enable-imap":{"post":{"operationId":"enableImapAccess","summary":"Enable IMAP access for a mailbox","description":"Enables IMAP access (Message API) for a mailbox by storing an encrypted copy of its password. This is only needed if a Dovecot master user is not configured \u2014 most deployments use master user auth and do not need this endpoint. Requires the current mailbox password for verification.","tags":["Mailboxes"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["password"],"properties":{"password":{"type":"string","description":"Current mailbox password for verification"}}}}}},"responses":{"200":{"description":"IMAP access enabled (or already enabled)","content":{"application\/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["enabled","already_enabled"]},"message":{"type":"string"}}}}}},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}}},"\/mailboxes\/{mailbox}:delete-intent":{"post":{"operationId":"createDeleteIntent","summary":"Create a delete intent for a mailbox","description":"Initiates a two-step mailbox deletion. Returns risk flags and a confirm URL. The intent expires after the configured TTL (default 10 minutes).","tags":["Delete Intents"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"Delete intent created","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/DeleteIntent"}}}},"404":{"$ref":"#\/components\/responses\/NotFound"},"409":{"$ref":"#\/components\/responses\/Conflict"}}}},"\/delete-intents\/{intent}:confirm":{"post":{"operationId":"confirmDeleteIntent","summary":"Confirm and execute a delete intent","description":"Confirms a pending delete intent. Requires X-Confirm-Delete: true header. Subject to destructive rate limits (10\/token\/day, 50\/account\/day) and 10s cooldown between confirms.","tags":["Delete Intents"],"parameters":[{"name":"intent","in":"path","required":true,"schema":{"type":"integer"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Confirm-Delete","in":"header","required":true,"schema":{"type":"string","enum":["true"]},"description":"Must be set to 'true' to confirm deletion"}],"responses":{"200":{"description":"Delete intent confirmed and executed","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/DeleteIntentResult"}}}},"400":{"description":"Missing X-Confirm-Delete header","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"404":{"$ref":"#\/components\/responses\/NotFound"},"409":{"$ref":"#\/components\/responses\/Conflict"},"410":{"$ref":"#\/components\/responses\/Gone"},"429":{"$ref":"#\/components\/responses\/TooManyRequests"}}}},"\/mailboxes\/{mailbox}:restore":{"post":{"operationId":"restoreMailbox","summary":"Restore a mailbox from Recently deleted","description":"Requires mailboxes:delete and Idempotency-Key. Restores a trashed mailbox (listed by GET \/mailboxes?status=trashed) to active, the inverse of confirming a delete intent while Recently deleted is on. Idempotent: a mailbox that is already active returns 200 unchanged. 422 mailbox_limit_reached when the domain is at its mailbox limit; 422 storage_pool_exceeded when the mailbox's fixed size no longer fits in the account pool or in its client storage limit. 409 conflict when the mailbox is already being permanently deleted or has left the trash. Returns the mailbox wrapped in data.","tags":["Delete Intents"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"responses":{"200":{"description":"Mailbox restored, or already active","content":{"application\/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#\/components\/schemas\/Mailbox"}}}}}},"403":{"$ref":"#\/components\/responses\/InsufficientScope"},"404":{"$ref":"#\/components\/responses\/NotFound"},"409":{"$ref":"#\/components\/responses\/Conflict"},"422":{"description":"mailbox_limit_reached or storage_pool_exceeded","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/mailboxes\/{mailbox}\/forwarding":{"get":{"operationId":"getForwarding","summary":"Get forwarding settings","tags":["Forwarding"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Current forwarding settings","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ForwardingSettings"}}}},"404":{"$ref":"#\/components\/responses\/NotFound"}}},"put":{"operationId":"updateForwarding","summary":"Update forwarding settings","tags":["Forwarding"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["enabled","targets","keep_copy"],"properties":{"enabled":{"type":"boolean"},"targets":{"type":"array","maxItems":1,"items":{"type":"string","format":"email"}},"keep_copy":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Updated forwarding settings","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ForwardingSettings"}}}},"422":{"$ref":"#\/components\/responses\/ValidationError"}}}},"\/mailboxes\/{mailbox}\/rules":{"get":{"operationId":"listMailboxRules","summary":"List filters for a mailbox","description":"Requires mailboxes:rules:read. Rules are returned in delivery order.","tags":["Mail Rules"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"Mailbox filters in priority order","content":{"application\/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/MailRule"}}}}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"}}},"post":{"operationId":"createMailboxRule","summary":"Create a mailbox filter","description":"Requires mailboxes:rules:write, a Pro or Agency plan, and Idempotency-Key. The response reports sync_pending while the generated Sieve script is awaiting reconciliation.","tags":["Mail Rules"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MailRuleRequest"}}}},"responses":{"201":{"description":"Filter created","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MailRuleMutationResponse"}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}}},"\/mailboxes\/{mailbox}\/rules\/{rule}":{"get":{"operationId":"getMailboxRule","summary":"Get a mailbox filter","description":"Requires mailboxes:rules:read.","tags":["Mail Rules"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"name":"rule","in":"path","required":true,"schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"Filter details","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MailRule"}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"}}},"put":{"operationId":"updateMailboxRule","summary":"Replace a mailbox filter","description":"Requires mailboxes:rules:write, a Pro or Agency plan, and Idempotency-Key.","tags":["Mail Rules"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"name":"rule","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MailRuleRequest"}}}},"responses":{"200":{"description":"Filter updated","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MailRuleMutationResponse"}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}},"delete":{"operationId":"deleteMailboxRule","summary":"Delete a mailbox filter","description":"Requires mailboxes:rules:write, a Pro or Agency plan, and Idempotency-Key.","tags":["Mail Rules"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"name":"rule","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"responses":{"200":{"description":"Filter deleted","content":{"application\/json":{"schema":{"type":"object","required":["deleted","sync_pending"],"properties":{"deleted":{"type":"boolean","const":true},"sync_pending":{"type":"boolean"}}}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}}},"\/mailboxes\/{mailbox}\/rules\/reorder":{"patch":{"operationId":"reorderMailboxRules","summary":"Reorder every filter for a mailbox","description":"Requires mailboxes:rules:write and a Pro or Agency plan. order must contain each current filter id exactly once.","tags":["Mail Rules"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["order"],"properties":{"order":{"type":"array","items":{"type":"integer","minimum":1},"uniqueItems":true}}}}}},"responses":{"200":{"description":"Filters reordered","content":{"application\/json":{"schema":{"type":"object","required":["reordered","sync_pending"],"properties":{"reordered":{"type":"boolean","const":true},"sync_pending":{"type":"boolean"}}}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}}},"\/mailboxes\/{mailbox}\/aliases":{"get":{"operationId":"listAliases","summary":"List aliases for a mailbox","tags":["Aliases"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Aliases with primary address and limits","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/MailboxAlias"}},"primary":{"type":"object","properties":{"email":{"type":"string"},"domain":{"type":"string"}}},"limits":{"type":"object","properties":{"used":{"type":"integer"},"max":{"type":"integer"}}}}}}}},"404":{"$ref":"#\/components\/responses\/NotFound"}}},"post":{"operationId":"createAlias","summary":"Create an alias for a mailbox","tags":["Aliases"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["local_part","domain_id"],"properties":{"local_part":{"type":"string","maxLength":64,"pattern":"^[a-z0-9_-]+(?:\\.[a-z0-9_-]+)*$"},"domain_id":{"type":"integer","description":"An active domain on the account, or one still waiting for DNS (pending_dns): the alias is saved now and starts receiving when the domain becomes active."},"can_receive":{"type":"boolean","default":true},"can_send":{"type":"boolean","default":false}}}}}},"responses":{"201":{"description":"Alias created","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MailboxAlias"}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"409":{"description":"Address already in use (`duplicate_address`), or the domain is being cleaned up (`domain_cleanup_in_progress`, retryable) or removed (`domain_deprovisioning_in_progress`)."},"422":{"$ref":"#\/components\/responses\/ValidationError"}}}},"\/mailboxes\/{mailbox}\/aliases\/{alias}":{"patch":{"operationId":"updateAlias","summary":"Update an alias","tags":["Aliases"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer"}},{"name":"alias","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"content":{"application\/json":{"schema":{"type":"object","properties":{"is_active":{"type":"boolean"},"can_receive":{"type":"boolean"},"can_send":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Updated alias","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MailboxAlias"}}}},"404":{"$ref":"#\/components\/responses\/NotFound"}}},"delete":{"operationId":"deleteAlias","summary":"Delete an alias","tags":["Aliases"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer"}},{"name":"alias","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Alias deleted","content":{"application\/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean"}}}}}},"404":{"$ref":"#\/components\/responses\/NotFound"}}}},"\/mailboxes\/{mailbox}\/message-tokens":{"post":{"operationId":"createMessageToken","summary":"Create a mailbox message token","description":"Creates a new message token for the specified mailbox. The plain token is returned only once in the response. Pro\/Agency plans only.","tags":["Message Tokens"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["name","scopes"],"properties":{"name":{"type":"string","maxLength":255},"scopes":{"type":"array","minItems":1,"items":{"type":"string","enum":["messages:read","messages:write","messages:send"]}},"expires_in":{"type":"string","enum":["7d","30d","90d","never"],"default":"never"}}}}}},"responses":{"201":{"description":"Message token created. The token value is returned only once.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MessageTokenCreated"}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}},"get":{"operationId":"listMessageTokens","summary":"List message tokens for a mailbox","tags":["Message Tokens"],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer"}},{"name":"page","in":"query","schema":{"type":"integer","default":1}}],"responses":{"200":{"description":"Paginated list of message tokens","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/MessageToken"}}}}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"}}}},"\/message-tokens\/{token}":{"delete":{"operationId":"revokeMessageToken","summary":"Revoke a message token","tags":["Message Tokens"],"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Token revoked","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MessageToken"}}}},"404":{"$ref":"#\/components\/responses\/NotFound"}}},"patch":{"operationId":"updateMessageToken","summary":"Narrow a message token","description":"Narrows a message token in place: remove scopes, bring its expiry forward, or rename it. A token can never gain scopes or a later expiry this way; create a new token for that. Requires an ops token with `mailboxes:message-tokens:manage`.","tags":["Message Tokens"],"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","minProperties":1,"properties":{"name":{"type":"string","maxLength":255},"scopes":{"type":"array","minItems":1,"description":"The scopes to keep: a subset of the token's current scopes.","items":{"type":"string","enum":["messages:read","messages:write","messages:send"]}},"expires_in":{"type":"string","description":"New expiry from now; must not be later than the current one.","enum":["1h","2h","4h","8h","7d","30d","90d"]}}}}}},"responses":{"200":{"description":"Token narrowed","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MessageToken"}}}},"404":{"$ref":"#\/components\/responses\/NotFound"},"409":{"$ref":"#\/components\/responses\/Conflict"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}}},"\/messages":{"get":{"operationId":"listMessages","summary":"List messages in a mailbox folder","description":"Returns messages from the authenticated mailbox's IMAP folder, sorted newest-first with cursor-based pagination. Requires a message token with `messages:read` scope.","tags":["Messages"],"security":[{"messageTokenAuth":[]}],"parameters":[{"name":"folder","in":"query","description":"IMAP folder path (default: INBOX)","schema":{"type":"string","default":"INBOX","maxLength":255}},{"name":"limit","in":"query","description":"Max messages to return (1-50)","schema":{"type":"integer","default":20,"minimum":1,"maximum":50}},{"name":"before_uid","in":"query","description":"Cursor from the previous page: pagination.next_before_uid. Messages are ordered by date, not UID, so send before_date with it.","schema":{"type":"integer","minimum":1}},{"name":"before_date","in":"query","description":"Cursor from the previous page: pagination.next_before_date (Unix seconds). Send it together with before_uid.","schema":{"type":"integer","minimum":0}},{"name":"since","in":"query","description":"Only return messages since this date (ISO 8601)","schema":{"type":"string","format":"date"}},{"name":"unread_only","in":"query","description":"Only return unread messages","schema":{"type":"boolean","default":false}},{"name":"search","in":"query","description":"Text to find anywhere in the message, headers and body (max 200 chars). A search page can be short or empty while pagination.has_more is true: keep paging.","schema":{"type":"string","maxLength":200}}],"responses":{"200":{"description":"Message list with pagination","content":{"application\/json":{"schema":{"type":"object","properties":{"mailbox":{"type":"string","format":"email"},"folder":{"type":"string"},"messages":{"type":"array","items":{"$ref":"#\/components\/schemas\/MessageSummary"}},"pagination":{"type":"object","properties":{"has_more":{"type":"boolean"},"next_before_uid":{"type":"integer","nullable":true},"next_before_date":{"type":"integer","nullable":true,"description":"Unix seconds; pass as before_date with before_uid for the next page"}}}}}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/ValidationError"},"429":{"$ref":"#\/components\/responses\/TooManyRequests"},"502":{"description":"IMAP connection failed (retryable)","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/messages\/{uid}":{"get":{"operationId":"getMessage","summary":"Get a single message by UID","description":"Returns full message details including body and attachment metadata. Requires a message token with `messages:read` scope.","tags":["Messages"],"security":[{"messageTokenAuth":[]}],"parameters":[{"name":"uid","in":"path","required":true,"description":"IMAP UID of the message","schema":{"type":"integer"}},{"name":"folder","in":"query","description":"IMAP folder path (default: INBOX)","schema":{"type":"string","default":"INBOX","maxLength":255}}],"responses":{"200":{"description":"Full message details","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MessageDetail"}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"413":{"description":"message_too_large: the message is over 100 MiB and the bounded reader cannot render it (an invitation card, a body part over 4 MB). Final, not retryable.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"$ref":"#\/components\/responses\/ValidationError"},"429":{"$ref":"#\/components\/responses\/TooManyRequests"},"502":{"description":"IMAP connection failed (retryable)","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}},"patch":{"operationId":"updateMessageFlags","summary":"Update message flags (mark as read\/unread, star\/unstar)","description":"Sets or removes IMAP flags on a message. Use `seen: true` to mark as read, `seen: false` to mark as unread, `flagged: true\/false` to star\/unstar. At least one flag must be specified. Requires a message token with `messages:read` scope. This operation is idempotent \u2014 no Idempotency-Key required.","tags":["Messages"],"security":[{"messageTokenAuth":[]}],"parameters":[{"name":"uid","in":"path","required":true,"description":"IMAP UID of the message","schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["flags"],"properties":{"folder":{"type":"string","default":"INBOX","maxLength":255,"description":"IMAP folder path (default: INBOX)"},"flags":{"type":"object","description":"Flags to set. At least one flag must be specified.","properties":{"seen":{"type":"boolean","description":"Mark as read (true) or unread (false)"},"flagged":{"type":"boolean","description":"Star (true) or unstar (false)"}}}}}}}},"responses":{"200":{"description":"Flags updated successfully","content":{"application\/json":{"schema":{"type":"object","properties":{"uid":{"type":"integer"},"flags":{"type":"array","items":{"type":"string"},"description":"Current IMAP flags after update (e.g. [\"\\\\Seen\", \"\\\\Flagged\"])"}}}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"},"429":{"$ref":"#\/components\/responses\/TooManyRequests"},"502":{"description":"IMAP connection failed (retryable)","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/messages\/folders":{"get":{"operationId":"listMessageFolders","summary":"List mailbox folders","description":"Returns all IMAP folders for the authenticated mailbox with their hierarchy delimiter and message counts. Nesting is conveyed by `path` split on `delimiter` (e.g. \"Clients\/Acme\/Invoices\" with delimiter \"\/\"). Requires a message token with `messages:read` scope.","tags":["Messages"],"security":[{"messageTokenAuth":[]}],"responses":{"200":{"description":"Folder list","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MessageFolderList"}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"429":{"$ref":"#\/components\/responses\/TooManyRequests"},"502":{"description":"Could not connect to the mailbox"}}},"post":{"operationId":"createMessageFolder","summary":"Create a folder","description":"Creates a new IMAP folder. Reserved names (INBOX, Sent, Drafts, Junk, Trash, Archive, Scheduled) are rejected. Pass `parent` (the raw path of an existing folder) to create a nested subfolder \u2014 e.g. parent=\"Projects\" + name=\"2026\" creates \"Projects\/2026\". Requires a message token with `messages:write` scope.","tags":["Messages"],"security":[{"messageTokenAuth":[]}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/CreateMessageFolderRequest"}}}},"responses":{"201":{"description":"Folder created","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MessageFolderMutationResponse"}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"409":{"description":"folder_exists: the mailbox already has a folder with this name at this level; not retryable, choose another name or use the existing folder","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"$ref":"#\/components\/responses\/ValidationError"},"429":{"$ref":"#\/components\/responses\/TooManyRequests"}}}},"\/messages\/folders\/{path}":{"patch":{"operationId":"renameMessageFolder","summary":"Rename a folder","description":"Renames a custom folder (changes the leaf name). Special folders cannot be renamed. Requires a message token with `messages:write` scope.","tags":["Messages"],"security":[{"messageTokenAuth":[]}],"parameters":[{"name":"path","in":"path","required":true,"description":"Raw IMAP path of the folder, URL-encoded (may contain the server's hierarchy delimiter).","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/RenameMessageFolderRequest"}}}},"responses":{"200":{"description":"Folder renamed","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MessageFolderMutationResponse"}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"409":{"description":"folder_busy: a folder-wide move the webmail has already shown as done is still moving messages into or out of this folder or one of its subfolders; retryable, retry after the move finishes. folder_exists: a folder with the new name already exists at this level; not retryable, choose another name","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"$ref":"#\/components\/responses\/ValidationError"},"429":{"$ref":"#\/components\/responses\/TooManyRequests"}}},"delete":{"operationId":"deleteMessageFolder","summary":"Delete a folder","description":"Deletes a custom folder that has no subfolders; a folder with subfolders is refused with 409 folder_has_children, so delete them first. Special folders cannot be deleted. Requires a message token with `messages:write` scope and an `Idempotency-Key` header.","tags":["Messages"],"security":[{"messageTokenAuth":[]}],"parameters":[{"name":"path","in":"path","required":true,"description":"Raw IMAP path of the folder, URL-encoded (may contain the server's hierarchy delimiter).","schema":{"type":"string"}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"responses":{"204":{"description":"Folder deleted"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"409":{"description":"folder_has_children: the folder has subfolders (child_count, at every depth); delete them first. folder_busy: a folder-wide move the webmail has already shown as done is still moving messages into or out of this folder; retryable, retry after the move finishes. Also idempotency_mismatch, or conflict on a concurrent request using the same key","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"$ref":"#\/components\/responses\/TooManyRequests"}}}},"\/messages\/send":{"post":{"operationId":"sendMessage","summary":"Send an email from the mailbox","description":"Queues an email for sending from the authenticated mailbox or a source-bound Send As identity. Requires a message token with `messages:send` scope and an `Idempotency-Key` header.\n\n`202` means accepted, not sent: the plan's sending allowances are checked again when the message leaves the queue. Follow a `202` with `GET \/messages\/deliveries\/{requestId}` to learn whether it went out. When an allowance is already spent in full the request is refused at once with `429 sending_limit_exceeded`, which says which allowance (`dimension`) and when it renews (`resets_at`). `GET \/messages\/sending-limits` shows today's allowance before sending. Shared sending with shared_mailbox_id requires both can_read and can_send. Send-only members receive shared_mailbox_send_denied and can send from webmail or a mail app instead. Delegated identity_id values are refused with identity_unavailable.","tags":["Messages"],"security":[{"messageTokenAuth":[]}],"parameters":[{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/SendMessageRequest"}}}},"responses":{"202":{"description":"Message queued for delivery","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/SendMessageResponse"}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"409":{"$ref":"#\/components\/responses\/Conflict"},"422":{"$ref":"#\/components\/responses\/ValidationError"},"429":{"$ref":"#\/components\/responses\/TooManyRequests"}}}},"\/messages\/deliveries\/{requestId}":{"get":{"operationId":"getMessageDelivery","summary":"Status of a message accepted by POST \/messages\/send","description":"Looks a send up by the `request_id` its `202` returned, with the same token. `failure` is set only for `failed`; a message refused by a sending allowance carries `failure.code = sending_limit_exceeded` with the same fields as the 429 error.","tags":["Messages"],"security":[{"messageTokenAuth":[]}],"parameters":[{"name":"requestId","in":"path","required":true,"schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"Delivery status","content":{"application\/json":{"schema":{"type":"object","properties":{"request_id":{"type":"string"},"message_id":{"type":"string"},"status":{"type":"string","enum":["pending","sending","sent","failed","delivery_uncertain"]},"failure":{"type":["object","null"],"properties":{"code":{"type":"string","description":"`sending_limit_exceeded` or `delivery_failed`."},"message":{"type":["string","null"]},"dimension":{"type":"string"},"limit":{"type":["integer","null"]},"used":{"type":["integer","null"]},"requested":{"type":"integer"},"remaining":{"type":["integer","null"]},"resets_at":{"type":["string","null"],"format":"date-time"},"causes":{"type":"array","items":{"type":"string"}}}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"404":{"$ref":"#\/components\/responses\/NotFound"}}}},"\/messages\/sending-limits":{"get":{"operationId":"getMailboxSendingLimits","summary":"Today's sending allowance for this token's mailbox","description":"How many more recipients this mailbox can reach today (`remaining_today`, the lowest of its own, its domain's and the account's allowance), the per-message recipient cap, when it renews, and the REST API's own caps. The account-wide total's figures are for account tokens: GET \/sending-limits.","tags":["Messages"],"security":[{"messageTokenAuth":[]}],"responses":{"200":{"description":"Allowance","content":{"application\/json":{"schema":{"type":"object","properties":{"mailbox":{"type":"string"},"recipients_per_message":{"type":["integer","null"]},"remaining_today":{"type":["integer","null"],"description":"How many more recipients can be reached today. Null while the lowest allowance is the account total and some of it is left; 0 once it is spent. Account tokens read the account total from GET \/sending-limits."},"limit_today":{"type":["integer","null"],"description":"The allowance `remaining_today` is measured against; null when that is the account total."},"binding_dimension":{"type":["string","null"],"enum":["mailbox_daily","domain_daily","account_daily",null]},"resets_at":{"type":["string","null"],"format":"date-time"},"api":{"type":"object","properties":{"token_daily_limit":{"type":"integer"},"token_sent_today":{"type":"integer"},"mailbox_daily_limit":{"type":"integer","description":"Messages per mailbox over a rolling 24 hours."},"max_recipients_per_request":{"type":"integer"}}}}}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"}}}},"\/messages\/_ping":{"get":{"operationId":"pingMessageToken","summary":"Verify message token connectivity","description":"Returns the mailbox address and scopes for the authenticated message token. Use this to verify a token is valid before making other requests.","tags":["Messages"],"security":[{"messageTokenAuth":[]}],"responses":{"200":{"description":"Token is valid","content":{"application\/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"mailbox":{"type":"string","format":"email"},"scopes":{"type":"array","items":{"type":"string","enum":["messages:read","messages:write","messages:send"]}}}}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"429":{"$ref":"#\/components\/responses\/TooManyRequests"}}}},"\/migrations":{"get":{"operationId":"listMigrations","summary":"List email migrations","tags":["Migrations"],"parameters":[{"name":"status","in":"query","schema":{"type":"string","enum":["pending","validating","planning","processing","completed","failed","cancelled"]}},{"name":"mailbox_id","in":"query","schema":{"type":"integer"}},{"name":"page","in":"query","schema":{"type":"integer","default":1}},{"name":"per_page","in":"query","schema":{"type":"integer","default":20,"maximum":100}}],"responses":{"200":{"description":"Paginated list of migrations","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/MigrationJob"}}}}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/InsufficientScope"}}},"post":{"operationId":"startMigration","summary":"Start email migration","tags":["Migrations"],"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["provider","mailbox_id","source_host","source_port","source_security","source_email","source_password"],"properties":{"provider":{"type":"string","enum":["gmail","outlook","yahoo","icloud","generic_imap"]},"mailbox_id":{"type":"integer"},"source_host":{"type":"string"},"source_port":{"type":"integer"},"source_security":{"type":"string","enum":["ssl","tls","none"]},"source_email":{"type":"string","format":"email"},"source_username":{"type":"string","nullable":true},"source_password":{"type":"string"},"selected_folders":{"type":"array","items":{"type":"string"},"nullable":true,"description":"Folders to import, by IMAP name. Omit it to import every folder except Gmail All Mail and the old provider's trash and spam (Trash, Deleted Items, Bin, Spam, Junk, Bulk Mail, or a folder flagged \\Trash or \\Junk), which TrekMail's Trash and Junk would delete 30 days after the import. List a folder here to import it anyway."},"import_since":{"type":"string","format":"date","nullable":true},"skip_duplicates":{"type":"boolean","default":true}}}}}},"responses":{"201":{"description":"Migration started","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/MigrationJob"}}}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/InsufficientScope"},"409":{"$ref":"#\/components\/responses\/Conflict"},"422":{"$ref":"#\/components\/responses\/ValidationError"},"503":{"description":"Server at migration capacity. Retry later.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/migrations\/test-connection":{"post":{"operationId":"testMigrationConnection","summary":"Test source IMAP connection","tags":["Migrations"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["source_host","source_port","source_security","source_email","source_password"],"properties":{"source_host":{"type":"string"},"source_port":{"type":"integer"},"source_security":{"type":"string","enum":["ssl","tls","none"]},"source_email":{"type":"string","format":"email"},"source_username":{"type":"string","nullable":true},"source_password":{"type":"string"}}}}}},"responses":{"200":{"description":"Connection successful with folder list","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"folders":{"type":"object","additionalProperties":{"type":"integer"}},"default_selected":{"type":"array","items":{"type":"string"},"description":"Folders the dashboard import wizard ticks by default: every folder except Gmail All Mail and the old provider's trash and spam (Trash, Deleted Items, Bin, Spam, Junk, Bulk Mail, or a folder flagged \\Trash or \\Junk), because TrekMail's Trash and Junk delete a message 30 days after it lands there. Pass your own selection in selected_folders when you start the migration."},"all_mail":{"type":"array","items":{"type":"string"},"description":"Gmail All Mail folders among folders, recognised by the \\All flag, so localized names are included. All Mail repeats Inbox, Sent and label folders, plus mail archived without a label."},"labels":{"type":"object","additionalProperties":{"type":"string"},"description":"Readable names for folders whose IMAP name is modified UTF-7, keyed by the IMAP name. Always use the IMAP name in selected_folders."},"roles":{"type":"object","additionalProperties":{"type":"string","enum":["inbox","sent","drafts","starred","important","all_mail","spam","trash","archive"]},"description":"What a folder is, from INBOX or its IMAP SPECIAL-USE flags, keyed by IMAP name. Folders without flags are left out."}}}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/InsufficientScope"},"422":{"description":"Connection failed","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/migrations\/{job}":{"get":{"operationId":"getMigration","summary":"Get migration details","tags":["Migrations"],"parameters":[{"name":"job","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Migration details with per-folder breakdown","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/MigrationJob"}}}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"404":{"$ref":"#\/components\/responses\/NotFound"}}},"delete":{"operationId":"deleteMigration","summary":"Delete a migration record","tags":["Migrations"],"parameters":[{"name":"job","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"204":{"description":"Migration record deleted"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"404":{"$ref":"#\/components\/responses\/NotFound"},"409":{"$ref":"#\/components\/responses\/Conflict"}}}},"\/migrations\/{job}:cancel":{"post":{"operationId":"cancelMigration","summary":"Cancel a running migration","tags":["Migrations"],"parameters":[{"name":"job","in":"path","required":true,"schema":{"type":"integer"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"Migration cancelled","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/MigrationJob"}}}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"404":{"$ref":"#\/components\/responses\/NotFound"},"409":{"$ref":"#\/components\/responses\/Conflict"}}}},"\/migrations\/{job}:retry":{"post":{"operationId":"retryMigration","summary":"Retry a failed or cancelled migration","tags":["Migrations"],"parameters":[{"name":"job","in":"path","required":true,"schema":{"type":"integer"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"Migration retried","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/MigrationJob"}}}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"404":{"$ref":"#\/components\/responses\/NotFound"},"409":{"$ref":"#\/components\/responses\/Conflict"}}}},"\/migrations\/bulk\/{batch}":{"delete":{"operationId":"deleteBulkMigration","summary":"Delete a bulk migration batch record","description":"Delete a completed, failed, or cancelled bulk migration batch. Cannot delete active batches.","tags":["Bulk Migrations"],"parameters":[{"name":"batch","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"204":{"description":"Batch record deleted"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"404":{"$ref":"#\/components\/responses\/NotFound"},"409":{"$ref":"#\/components\/responses\/Conflict"}}}},"\/migrations\/bulk\/{batch}\/jobs\/{job}\/password":{"patch":{"operationId":"updateBulkMigrationJobPassword","summary":"Update source password for a failed bulk migration job","description":"Update the source IMAP password for a failed job within a bulk migration batch. Only works on jobs with 'failed' status.","tags":["Bulk Migrations"],"parameters":[{"name":"batch","in":"path","required":true,"schema":{"type":"integer"}},{"name":"job","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["source_password"],"properties":{"source_password":{"type":"string","maxLength":255,"description":"New source IMAP password or app password"}}}}}},"responses":{"200":{"description":"Password updated"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}}},"\/drive\/spaces":{"get":{"operationId":"listDriveSpaces","summary":"List Drive spaces the caller can access","tags":["Drive"],"responses":{"200":{"description":"Array of DriveSpace objects (account + mailbox-personal)","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object"}}}}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"}}}},"\/drive\/storage":{"get":{"operationId":"getDriveStorage","summary":"Account-wide Drive pool snapshot (used\/limit\/addon)","tags":["Drive"],"responses":{"200":{"description":"Pool snapshot","content":{"application\/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"}}}},"\/drive\/spaces\/{space}\/usage":{"get":{"operationId":"getDriveSpaceUsage","summary":"Per-space quota usage","tags":["Drive"],"parameters":[{"name":"space","in":"path","required":true,"schema":{"type":"string"},"description":"'account' | 'mailbox:N' | numeric DriveSpace id"}],"responses":{"200":{"description":"Quota snapshot for the space"},"404":{"$ref":"#\/components\/responses\/NotFound"}}}},"\/drive\/spaces\/{space}\/folders":{"get":{"operationId":"listDriveRootFolders","summary":"List root folders + files in a space","tags":["Drive"],"parameters":[{"name":"space","in":"path","required":true,"schema":{"type":"string"}},{"name":"sort","in":"query","schema":{"type":"string"}},{"name":"dir","in":"query","schema":{"type":"string","enum":["asc","desc"]}},{"name":"per_page","in":"query","schema":{"type":"integer","default":50,"maximum":200}},{"name":"cursor","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Folder + file listing with next_cursor"}}},"post":{"operationId":"createDriveFolder","description":"is_shared true also requires drive:account:write and drive:account:share (403 missing_scope otherwise). A caller restricted to mailbox ids reaches Account Drive only through the folders shared with all mailboxes, as those mailboxes do in webmail: in the account space it creates inside a shared folder (a private parent is 404 parent_folder_not_found) or a new folder with is_shared true; a private folder at the root is 403 shared_folders_only.","summary":"Create a folder","tags":["Drive"],"parameters":[{"name":"space","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","maxLength":255},"parent_id":{"type":"integer","nullable":true},"color":{"type":"string"},"is_shared":{"type":"boolean"}}}}}},"responses":{"201":{"description":"Folder created"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}}},"\/drive\/spaces\/{space}\/folders\/{folder}":{"get":{"operationId":"showDriveFolder","summary":"List a folder's children + files","tags":["Drive"],"parameters":[{"name":"space","in":"path","required":true,"schema":{"type":"string"}},{"name":"folder","in":"path","required":true,"schema":{"type":"integer"}},{"name":"sort","in":"query","schema":{"type":"string"}},{"name":"dir","in":"query","schema":{"type":"string","enum":["asc","desc"]}},{"name":"per_page","in":"query","schema":{"type":"integer","default":50,"maximum":200}},{"name":"cursor","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Folder contents"},"404":{"$ref":"#\/components\/responses\/NotFound"}}}},"\/drive\/spaces\/{space}\/folder-tree":{"get":{"operationId":"getDriveFolderTree","summary":"Full folder hierarchy for a space","tags":["Drive"],"parameters":[{"name":"space","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Nested folder tree"}}}},"\/drive\/spaces\/{space}\/all-ids":{"get":{"operationId":"listDriveAllIds","summary":"All folder + file ids in a space (bulk-select helper)","tags":["Drive"],"parameters":[{"name":"space","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"folder_ids[] + file_ids[]"}}}},"\/drive\/spaces\/{space}\/folders\/{folder}\/all-ids":{"get":{"operationId":"listDriveAllIdsInFolder","summary":"All ids beneath a specific folder (bulk-select helper)","tags":["Drive"],"parameters":[{"name":"space","in":"path","required":true,"schema":{"type":"string"}},{"name":"folder","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"folder_ids[] + file_ids[] under the folder"}}}},"\/drive\/spaces\/{space}\/trash":{"get":{"operationId":"listDriveTrash","summary":"List trashed items in a space","tags":["Drive"],"parameters":[{"name":"space","in":"path","required":true,"schema":{"type":"string"}},{"name":"per_page","in":"query","schema":{"type":"integer","default":50,"maximum":200}},{"name":"cursor","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Trashed items with next_cursor"}}},"delete":{"operationId":"emptyDriveTrash","description":"A caller restricted to mailbox ids reaches Account Drive only through the folders shared with all mailboxes, as those mailboxes do in webmail, so it cannot empty the Account Drive trash (403 shared_folders_only), as webmail never empties the shared trash.","summary":"Permanently purge every trashed item in a space","tags":["Drive"],"parameters":[{"name":"space","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"responses":{"200":{"description":"{purged_files, purged_folders}"}}}},"\/drive\/files\/{file}":{"get":{"operationId":"showDriveFile","summary":"Get file metadata","tags":["Drive"],"parameters":[{"name":"file","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"File metadata"},"404":{"$ref":"#\/components\/responses\/NotFound"}}},"patch":{"operationId":"updateDriveFile","summary":"Rename a file","tags":["Drive"],"parameters":[{"name":"file","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","maxLength":255}}}}}},"responses":{"200":{"description":"Updated file"}}},"delete":{"operationId":"trashDriveFile","summary":"Soft-delete (trash) a file","tags":["Drive"],"parameters":[{"name":"file","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"responses":{"204":{"description":"Trashed"}}}},"\/drive\/files\/{file}\/download":{"get":{"operationId":"getDriveFileDownload","summary":"Get a presigned download URL for a file","tags":["Drive"],"parameters":[{"name":"file","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"{download_url, expires_at}"}}}},"\/drive\/files\/{file}:move":{"post":{"operationId":"moveDriveFile","summary":"Move a file to another folder","tags":["Drive"],"parameters":[{"name":"file","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["target_folder_id"],"properties":{"target_folder_id":{"type":"integer","nullable":true}}}}}},"responses":{"200":{"description":"Moved file"}}}},"\/drive\/files\/{file}:restore":{"post":{"operationId":"restoreDriveFile","summary":"Restore a trashed file","tags":["Drive"],"parameters":[{"name":"file","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"responses":{"200":{"description":"Restored file"}}}},"\/drive\/files\/{file}:purge":{"delete":{"operationId":"purgeDriveFile","summary":"Permanently delete a file (requires drive:*:purge)","tags":["Drive"],"parameters":[{"name":"file","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"responses":{"204":{"description":"Purged"}}}},"\/drive\/files\/{file}\/share-links":{"get":{"operationId":"listDriveShareLinks","summary":"List share links for a file","tags":["Drive"],"parameters":[{"name":"file","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Share links"}}},"post":{"operationId":"createDriveShareLink","summary":"Create a public share link for a file","tags":["Drive"],"parameters":[{"name":"file","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":false,"content":{"application\/json":{"schema":{"type":"object","properties":{"expires_at":{"type":"string","format":"date-time","nullable":true},"max_downloads":{"type":"integer","nullable":true}}}}}},"responses":{"201":{"description":"Share link with one-time token"}}}},"\/drive\/share-links\/{link}":{"delete":{"operationId":"revokeDriveShareLink","summary":"Revoke a share link","tags":["Drive"],"parameters":[{"name":"link","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"responses":{"204":{"description":"Revoked"}}}},"\/drive\/folders\/{folder}":{"patch":{"operationId":"updateDriveFolder","summary":"Rename \/ recolor a folder","tags":["Drive"],"parameters":[{"name":"folder","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":255},"color":{"type":"string","nullable":true}}}}}},"responses":{"200":{"description":"Updated folder"}}},"delete":{"operationId":"trashDriveFolder","summary":"Soft-delete (trash) a folder and its contents","tags":["Drive"],"parameters":[{"name":"folder","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"responses":{"204":{"description":"Trashed"}}}},"\/drive\/folders\/{folder}:move":{"post":{"operationId":"moveDriveFolder","summary":"Move a folder under a new parent (or to root)","tags":["Drive"],"parameters":[{"name":"folder","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"target_parent_id":{"type":"integer","nullable":true}}}}}},"responses":{"200":{"description":"Moved folder"}}}},"\/drive\/folders\/{folder}:restore":{"post":{"operationId":"restoreDriveFolder","summary":"Restore a trashed folder","tags":["Drive"],"parameters":[{"name":"folder","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"responses":{"200":{"description":"Restored folder"}}}},"\/drive\/folders\/{folder}:share-with-account":{"post":{"operationId":"shareDriveFolderWithAccount","description":"Requires write access to the folder's space plus drive:account:write and drive:account:share: the folder becomes visible to every mailbox, and a mailbox folder moves into Account Drive. Without drive:account:share the answer is 403 missing_scope.","summary":"Promote a folder to a top-level account-shared folder","tags":["Drive"],"parameters":[{"name":"folder","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"responses":{"200":{"description":"Folder updated with is_shared=true"}}}},"\/drive\/folders\/{folder}:stop-sharing":{"post":{"operationId":"stopSharingDriveFolder","summary":"Stop account-wide sharing for a folder","description":"Requires drive:account:write and drive:account:share (a shared folder lives in Account Drive) and a caller that is not restricted to mailboxes. The folder stays in Account Drive and becomes visible only to account-level Drive users. A caller restricted to mailbox ids gets 403 shared_folder_stop_sharing_admin_only for a shared folder: as in webmail, no mailbox stops a share. Idempotent on a folder that is not shared.","tags":["Drive"],"parameters":[{"name":"folder","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"responses":{"200":{"description":"Folder updated with is_shared=false"}}}},"\/drive\/folders\/{folder}:purge":{"delete":{"operationId":"purgeDriveFolder","summary":"Permanently delete a folder + descendants (requires drive:*:purge)","tags":["Drive"],"parameters":[{"name":"folder","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"responses":{"204":{"description":"Purged"}}}},"\/drive\/spaces\/{space}\/uploads:initiate":{"post":{"operationId":"initiateDriveUpload","description":"A caller restricted to mailbox ids reaches Account Drive only through the folders shared with all mailboxes, as those mailboxes do in webmail: in the account space folder_id must be a shared folder (a private one is 404 folder_not_found, the root 403 shared_folders_only).","summary":"Initiate a single-part or multi-part upload","tags":["Drive"],"parameters":[{"name":"space","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["name","size_bytes"],"properties":{"name":{"type":"string","maxLength":255},"size_bytes":{"type":"integer"},"folder_id":{"type":"integer","nullable":true},"mime_type":{"type":"string","nullable":true}}}}}},"responses":{"201":{"description":"Upload session with presigned PUT URL(s)"}}}},"\/drive\/uploads\/{file}:complete":{"post":{"operationId":"completeDriveUpload","summary":"Finalize a multi-part upload (mark file as available)","tags":["Drive"],"parameters":[{"name":"file","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["parts"],"properties":{"parts":{"type":"array","items":{"type":"object","properties":{"part_number":{"type":"integer"},"etag":{"type":"string"}}}}}}}}},"responses":{"200":{"description":"File marked available"}}}},"\/drive\/uploads\/{file}:refresh-parts":{"post":{"operationId":"refreshDriveUploadParts","summary":"Re-presign one or more part URLs for an in-flight multipart upload","tags":["Drive"],"parameters":[{"name":"file","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["part_numbers"],"properties":{"part_numbers":{"type":"array","items":{"type":"integer"}}}}}}},"responses":{"200":{"description":"Refreshed parts"}}}},"\/drive\/uploads\/{file}:abort":{"post":{"operationId":"abortDriveUpload","summary":"Abort an in-flight upload + release reservation","tags":["Drive"],"parameters":[{"name":"file","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Aborted"}}}},"\/drive\/spaces\/{space}\/bulk:trash":{"post":{"operationId":"bulkTrashDrive","summary":"Bulk soft-delete (up to 5000 ids)","tags":["Drive"],"parameters":[{"name":"space","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/DriveBulkRequest"}}}},"responses":{"200":{"description":"Bulk result counts"}}}},"\/drive\/spaces\/{space}\/bulk:restore":{"post":{"operationId":"bulkRestoreDrive","summary":"Bulk restore from trash (up to 5000 ids)","tags":["Drive"],"parameters":[{"name":"space","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/DriveBulkRequest"}}}},"responses":{"200":{"description":"Bulk result counts"}}}},"\/drive\/spaces\/{space}\/bulk:move":{"post":{"operationId":"bulkMoveDrive","summary":"Bulk move (up to 5000 ids)","tags":["Drive"],"parameters":[{"name":"space","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"allOf":[{"$ref":"#\/components\/schemas\/DriveBulkRequest"},{"type":"object","required":["target_folder_id"],"properties":{"target_folder_id":{"type":"integer","nullable":true}}}]}}}},"responses":{"200":{"description":"Bulk result counts"}}}},"\/drive\/spaces\/{space}\/bulk:purge":{"post":{"operationId":"bulkPurgeDrive","summary":"Bulk permanent delete (up to 5000 ids; requires drive:*:purge)","tags":["Drive"],"parameters":[{"name":"space","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/DriveBulkRequest"}}}},"responses":{"200":{"description":"Bulk result counts"}}}},"\/drive\/addon":{"get":{"operationId":"getDriveAddon","summary":"Drive Storage Add-on status","tags":["Drive Add-on"],"responses":{"200":{"description":"Add-on state (active\/grace\/inactive + size_gb + period end)"}}}},"\/drive\/addon\/pricing":{"get":{"operationId":"getDriveAddonPricing","summary":"Drive Storage Add-on pricing ladder","tags":["Drive Add-on"],"parameters":[{"name":"currency","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Currency + snap-points + ladder"}}}},"\/drive\/addon\/cancellation-preview":{"get":{"operationId":"getDriveAddonCancellationPreview","summary":"Files at risk if the Drive Add-on is cancelled today","tags":["Drive Add-on"],"responses":{"200":{"description":"Cancellation impact preview"}}}},"\/drive\/devices":{"get":{"operationId":"listDriveDevices","summary":"List Drive sync-device passwords for the account","tags":["Drive Devices"],"description":"Requires `drive:devices:read`. A mailbox-constrained token only sees devices bound to its allowed mailboxes; account-wide devices (mailbox_id=null) are hidden.","responses":{"200":{"description":"Device list (without plaintext or hash)","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/DriveDevice"}}}}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"}}},"post":{"operationId":"createDriveDevice","summary":"Mint a new Drive sync-device password","tags":["Drive Devices"],"description":"Requires `drive:devices:write`. Returns the plaintext `dsync_\u2026` credential exactly once in `data.password`; it is never recoverable. Rate-limited 20\/hour per account. Per-account cap of 1000 active+revoked rows.","parameters":[{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["label","scopes"],"properties":{"label":{"type":"string","minLength":1,"maxLength":64},"scopes":{"type":"array","items":{"type":"string","enum":["drive:account:read","drive:account:write","drive:account:share","drive:account:purge","drive:mailbox:read","drive:mailbox:write","drive:mailbox:share","drive:mailbox:purge"]}},"mailbox_id":{"type":"integer","nullable":true,"description":"Bind to a single mailbox's Drive; omit \/ null = account-wide."},"expires_in_days":{"type":"integer","nullable":true,"minimum":1,"maximum":3650}}}}}},"responses":{"201":{"description":"Device created. `data.password` is the plaintext, returned ONCE.","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"allOf":[{"$ref":"#\/components\/schemas\/DriveDevice"},{"type":"object","properties":{"password":{"type":"string","description":"Plaintext dsync_\u2026 credential. Show to user once; never recoverable."}}}]}}}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/ValidationError"},"429":{"$ref":"#\/components\/responses\/TooManyRequests"}}}},"\/drive\/devices\/{device}":{"delete":{"operationId":"revokeDriveDevice","summary":"Revoke a Drive sync-device password","tags":["Drive Devices"],"description":"Requires `drive:devices:write`. Idempotent \u2014 already-revoked rows return 200 unchanged. Sync clients lose access immediately on the next request.","parameters":[{"name":"device","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"responses":{"200":{"description":"Revoked device","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/DriveDevice"}}}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"}}}},"\/drive\/devices\/{device}:rotate":{"post":{"operationId":"rotateDriveDevice","summary":"Atomic rotate: revoke old + mint new (inherits label\/scopes\/mailbox)","tags":["Drive Devices"],"description":"Requires `drive:devices:write`. New plaintext returned ONCE in `data.password`. Old password stops working immediately. Rate-limited 10\/hour per account.","parameters":[{"name":"device","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":false,"content":{"application\/json":{"schema":{"type":"object","properties":{"expires_in_days":{"type":"integer","nullable":true,"minimum":1,"maximum":3650,"description":"Override inherited expiry. Omit \/ null = inherit original window."}}}}}},"responses":{"201":{"description":"New device + plaintext","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"allOf":[{"$ref":"#\/components\/schemas\/DriveDevice"},{"type":"object","properties":{"password":{"type":"string"},"rotated_from_device_id":{"type":"integer"}}}]}}}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"},"429":{"$ref":"#\/components\/responses\/TooManyRequests"}}}},"\/smtp\/default":{"get":{"operationId":"getAccountSmtpDefault","summary":"Get the account-wide SMTP default","description":"Dashboard\/Ops API. Requires `smtp:read`.","tags":["SMTP"],"responses":{"200":{"description":"Account SMTP default and effective route"},"403":{"$ref":"#\/components\/responses\/Forbidden"}}},"put":{"operationId":"setAccountSmtpDefault","summary":"Set the account-wide SMTP default","description":"Dashboard\/Ops API. Requires `smtp:write`. Optionally applies the route to every domain.","tags":["SMTP"],"parameters":[{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["smtp_mode"],"properties":{"smtp_mode":{"type":"string","enum":["platform","profile","not_configured"]},"smtp_connection_id":{"type":["integer","null"]},"apply_to_all":{"type":"boolean","default":false}}}}}},"responses":{"200":{"description":"Updated account SMTP default"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}}},"\/domains\/{domain}\/smtp":{"get":{"operationId":"getDomainSmtp","summary":"Get a domain's effective SMTP route","description":"Dashboard\/Ops API. Requires `smtp:read`.","tags":["SMTP"],"parameters":[{"$ref":"#\/components\/parameters\/DomainId"}],"responses":{"200":{"description":"Domain SMTP route"},"404":{"$ref":"#\/components\/responses\/NotFound"}}},"put":{"operationId":"setDomainSmtp","summary":"Set a domain's SMTP route","description":"Dashboard\/Ops API. Requires `smtp:write`.","tags":["SMTP"],"parameters":[{"$ref":"#\/components\/parameters\/DomainId"},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["smtp_mode"],"properties":{"smtp_mode":{"type":"string","enum":["inherit","platform","profile","not_configured"]},"smtp_connection_id":{"type":["integer","null"]}}}}}},"responses":{"200":{"description":"Updated domain SMTP route"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}}},"\/domains\/{domain}\/smtp\/profiles":{"get":{"operationId":"listDomainSmtpProfiles","summary":"List reusable SMTP profiles and usage counts","description":"Dashboard\/Ops API. Requires `smtp:read`. Passwords are never returned.","tags":["SMTP"],"parameters":[{"$ref":"#\/components\/parameters\/DomainId"}],"responses":{"200":{"description":"Saved profiles with domain and sending-address usage counts"}}},"post":{"operationId":"createDomainSmtpProfile","summary":"Create and select a reusable SMTP profile","description":"Dashboard\/Ops API. Requires `smtp:write`.","tags":["SMTP"],"parameters":[{"$ref":"#\/components\/parameters\/DomainId"},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/SmtpProfileInput"}}}},"responses":{"201":{"description":"Profile created and selected for this domain"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}}},"\/domains\/{domain}\/smtp\/profiles\/{smtpConnection}":{"put":{"operationId":"updateDomainSmtpProfile","summary":"Update a reusable SMTP profile","description":"Dashboard\/Ops API. Requires `smtp:write`.","tags":["SMTP"],"parameters":[{"$ref":"#\/components\/parameters\/DomainId"},{"$ref":"#\/components\/parameters\/SmtpConnectionId"},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/SmtpProfileInput"}}}},"responses":{"200":{"description":"Profile updated"},"404":{"$ref":"#\/components\/responses\/NotFound"}}},"delete":{"operationId":"deleteDomainSmtpProfile","summary":"Delete a reusable SMTP profile","description":"Dashboard\/Ops API. Requires `smtp:write`. Existing domain routes and Send As addresses are retired safely.","tags":["SMTP"],"parameters":[{"$ref":"#\/components\/parameters\/DomainId"},{"$ref":"#\/components\/parameters\/SmtpConnectionId"},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"responses":{"200":{"description":"Profile deleted with reassignment details"},"404":{"$ref":"#\/components\/responses\/NotFound"}}}},"\/domains\/{domain}\/smtp\/profiles\/{smtpConnection}\/usage":{"get":{"operationId":"getDomainSmtpProfileUsage","summary":"Show exactly where an SMTP profile is used","description":"Dashboard\/Ops API. Requires `smtp:read`. Returns domains and connected-inbox Send As addresses; never returns credentials.","tags":["SMTP"],"parameters":[{"$ref":"#\/components\/parameters\/DomainId"},{"$ref":"#\/components\/parameters\/SmtpConnectionId"}],"responses":{"200":{"description":"Profile usage details"},"404":{"$ref":"#\/components\/responses\/NotFound"}}}},"\/messages\/external-accounts":{"get":{"operationId":"listMessageExternalAccounts","summary":"List connected external mailboxes","description":"Webmail\/Message API. Requires `messages:read`. Returns only accounts connected to the message token's mailbox; credentials are never returned.","tags":["Connected accounts"],"security":[{"messageTokenAuth":[]}],"responses":{"200":{"description":"Connected-account list"},"403":{"$ref":"#\/components\/responses\/Forbidden"}}},"post":{"operationId":"createMessageExternalAccount","summary":"Connect an external IMAP\/SMTP mailbox","description":"Webmail\/Message API. Requires `messages:write`. Runs a live IMAP and SMTP test before persisting. Microsoft accounts must first complete the interactive OAuth flow in webmail.","tags":["Connected accounts"],"security":[{"messageTokenAuth":[]}],"parameters":[{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ExternalAccountConnectionInput"}}}},"responses":{"201":{"description":"Connected account created"},"409":{"description":"Address is already connected"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}}},"\/messages\/external-accounts\/detect":{"post":{"operationId":"detectMessageExternalAccountProvider","summary":"Detect provider and suggested server settings","description":"Webmail\/Message API. Requires `messages:read`. Returns a credential-free provider preset for an email address.","tags":["Connected accounts"],"security":[{"messageTokenAuth":[]}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email","maxLength":255}}}}}},"responses":{"200":{"description":"Provider preset"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}}},"\/messages\/external-accounts\/test":{"post":{"operationId":"testMessageExternalAccountCredentials","summary":"Test unsaved IMAP\/SMTP credentials","description":"Webmail\/Message API. Requires `messages:write`. Nothing is persisted.","tags":["Connected accounts"],"security":[{"messageTokenAuth":[]}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ExternalAccountConnectionInput"}}}},"responses":{"200":{"description":"Credential test result"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}}},"\/messages\/external-accounts\/{externalAccount}":{"patch":{"operationId":"updateMessageExternalAccount","summary":"Update a connected account","description":"Webmail\/Message API. Requires `messages:write`. Changed credentials or endpoints are tested before they replace the saved values.","tags":["Connected accounts"],"security":[{"messageTokenAuth":[]}],"parameters":[{"$ref":"#\/components\/parameters\/ExternalAccountId"},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ExternalAccountUpdateInput"}}}},"responses":{"200":{"description":"Connected account updated"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}},"delete":{"operationId":"deleteMessageExternalAccount","summary":"Disconnect an external mailbox","description":"Webmail\/Message API. Requires `messages:write`. Removes TrekMail's saved connection and related Send As identities; it never deletes mail at the provider. Active queued sends block removal.","tags":["Connected accounts"],"security":[{"messageTokenAuth":[]}],"parameters":[{"$ref":"#\/components\/parameters\/ExternalAccountId"},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"responses":{"200":{"description":"Connected account removed"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}}},"\/messages\/external-accounts\/{externalAccount}\/test":{"post":{"operationId":"testSavedMessageExternalAccount","summary":"Re-test a saved connected account","description":"Webmail\/Message API. Requires `messages:write`. Tests the saved IMAP\/SMTP connection and refreshes its health status.","tags":["Connected accounts"],"security":[{"messageTokenAuth":[]}],"parameters":[{"$ref":"#\/components\/parameters\/ExternalAccountId"}],"responses":{"200":{"description":"Saved connection test result"},"404":{"$ref":"#\/components\/responses\/NotFound"}}}},"\/messages\/identities":{"get":{"operationId":"listMessageIdentities","summary":"List From addresses and Send As configuration","description":"Message API. Requires `messages:read`. Pass `external_account_id` for a connected inbox, or `shared_mailbox_id` for a shared mailbox where the member has both can_read and can_send. Delegated team identities for send-only members are excluded and cannot be selected for Message API sending or scheduling; use webmail or a mail app instead.","tags":["Message identities"],"security":[{"messageTokenAuth":[]}],"parameters":[{"name":"external_account_id","in":"query","schema":{"type":"integer","minimum":1}},{"name":"shared_mailbox_id","in":"query","schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"Source-specific identities, reply policy, eligible addresses\/domains, and permitted SMTP profiles"}}},"post":{"operationId":"createMessageIdentity","summary":"Configure a From address or connected-inbox Send As identity","description":"Webmail\/Message API. Requires `messages:write`. Send As addresses are bound to one external account and one working domain\/profile route.","tags":["Message identities"],"security":[{"messageTokenAuth":[]}],"parameters":[{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MessageIdentityInput"}}}},"responses":{"201":{"description":"Identity configured"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}}},"\/messages\/identities\/reply-policy":{"patch":{"operationId":"setMessageReplyFromPolicy","summary":"Choose how replies select their From address","description":"Webmail\/Message API. Requires `messages:write`.","tags":["Message identities"],"security":[{"messageTokenAuth":[]}],"parameters":[{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["reply_from_policy"],"properties":{"reply_from_policy":{"type":"string","enum":["recipient","default"]}}}}}},"responses":{"200":{"description":"Reply policy updated"}}}},"\/messages\/identities\/{identity}":{"patch":{"operationId":"updateMessageIdentity","summary":"Update a From identity","description":"Webmail\/Message API. Requires `messages:write`. Include `external_account_id` for a connected-inbox Send As identity. Delegated team identities cannot be updated here (422 identity_delegated).","tags":["Message identities"],"security":[{"messageTokenAuth":[]}],"parameters":[{"$ref":"#\/components\/parameters\/IdentityId"},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MessageIdentityInput"}}}},"responses":{"200":{"description":"Identity updated"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}},"delete":{"operationId":"deleteMessageIdentity","summary":"Delete a Send As identity","description":"Webmail\/Message API. Requires `messages:write`. Managed mailbox\/alias identities cannot be deleted. Delegated team identities cannot be deleted here (422 identity_delegated); an administrator changes shared-mailbox access to remove them.","tags":["Message identities"],"security":[{"messageTokenAuth":[]}],"parameters":[{"$ref":"#\/components\/parameters\/IdentityId"},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":false,"content":{"application\/json":{"schema":{"type":"object","properties":{"external_account_id":{"type":"integer","minimum":1}}}}}},"responses":{"204":{"description":"Identity deleted"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}}},"\/white-label":{"get":{"operationId":"getWhiteLabelStatus","summary":"Get White Label status and setup progress","description":"Requires `branding:read`. Returns entitlement state, the default brand, domain readiness, and the next setup step.","tags":["White Label"],"responses":{"200":{"description":"White Label status and setup progress","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/WhiteLabelOverview"}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"}}}},"\/white-label\/access-catalog":{"get":{"operationId":"getWhiteLabelAccessCatalog","summary":"List roles and permissions this caller may grant","description":"Requires `members:read`. Grantability is calculated from the caller's current membership rather than from the token alone.","tags":["White Label"],"responses":{"200":{"description":"Roles, permission groups, grantable permissions, and reachable domains"},"403":{"$ref":"#\/components\/responses\/Forbidden"}}}},"\/white-label\/members":{"get":{"operationId":"listWhiteLabelMembers","summary":"List White Label members and invitations","description":"Requires `members:read`. Domain-constrained callers only see memberships that are fully inside their domain boundary.","tags":["White Label members"],"parameters":[{"name":"search","in":"query","schema":{"type":"string","maxLength":255}},{"name":"role","in":"query","schema":{"type":"string","enum":["owner","account_manager","domain_admin","client","webmail_only","mailbox_operator","support_agent","billing_manager","read_only","custom"]}},{"name":"status","in":"query","schema":{"type":"string","enum":["pending","active","suspended","revoked"]}},{"name":"include_removed","in":"query","schema":{"type":"boolean"}},{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"default":1}},{"name":"per_page","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":25}}],"responses":{"200":{"description":"Paginated member list"},"403":{"$ref":"#\/components\/responses\/Forbidden"}}},"post":{"operationId":"inviteWhiteLabelMember","summary":"Invite a White Label member","description":"Requires `members:write`. A caller cannot grant a role, permission, or domain boundary broader than its own.","tags":["White Label members"],"parameters":[{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/WhiteLabelMemberCreateInput"}}}},"responses":{"201":{"description":"Invitation created; delivery status and the invitation URL are returned"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"409":{"$ref":"#\/components\/responses\/Conflict"},"422":{"$ref":"#\/components\/responses\/ValidationError"},"429":{"$ref":"#\/components\/responses\/TooManyRequests"}}}},"\/white-label\/members\/{membership}":{"get":{"operationId":"getWhiteLabelMember","summary":"Get a White Label member","description":"Requires `members:read`. Returns allowed next operations so clients do not have to guess the member's state machine.","tags":["White Label members"],"parameters":[{"$ref":"#\/components\/parameters\/WhiteLabelMembershipId"}],"responses":{"200":{"description":"Member details","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/WhiteLabelMember"}}}},"404":{"$ref":"#\/components\/responses\/NotFound"}}},"patch":{"operationId":"updateWhiteLabelMember","summary":"Change a White Label member's access","description":"Requires `members:write`. Owner access is immutable here, callers cannot change themselves, and delegated callers cannot widen access beyond their own.","tags":["White Label members"],"parameters":[{"$ref":"#\/components\/parameters\/WhiteLabelMembershipId"},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/WhiteLabelMemberUpdateInput"}}}},"responses":{"200":{"description":"Updated member","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/WhiteLabelMember"}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}},"delete":{"operationId":"removeWhiteLabelMember","summary":"Remove a White Label member","description":"Requires `members:write`. Removal revokes the member's live access keys and can later be reversed with the restore operation.","tags":["White Label members"],"parameters":[{"$ref":"#\/components\/parameters\/WhiteLabelMembershipId"},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"responses":{"200":{"description":"Removed member and number of revoked keys"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"409":{"$ref":"#\/components\/responses\/Conflict"}}}},"\/white-label\/members\/{membership}:suspend":{"post":{"operationId":"suspendWhiteLabelMember","summary":"Suspend a White Label member","description":"Requires `members:write`. Existing access keys are revoked immediately.","tags":["White Label members"],"parameters":[{"$ref":"#\/components\/parameters\/WhiteLabelMembershipId"},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"responses":{"200":{"description":"Suspended member"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"409":{"$ref":"#\/components\/responses\/Conflict"}}}},"\/white-label\/members\/{membership}:resume":{"post":{"operationId":"resumeWhiteLabelMember","summary":"Resume a suspended White Label member","description":"Requires `members:write`. Previously revoked keys stay revoked; the member must reconnect or create a new key.","tags":["White Label members"],"parameters":[{"$ref":"#\/components\/parameters\/WhiteLabelMembershipId"},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"responses":{"200":{"description":"Resumed member"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"409":{"$ref":"#\/components\/responses\/Conflict"}}}},"\/white-label\/members\/{membership}:resend-invitation":{"post":{"operationId":"resendWhiteLabelInvitation","summary":"Send a fresh member invitation","description":"Requires `members:write` and only applies to a pending invitation.","tags":["White Label members"],"parameters":[{"$ref":"#\/components\/parameters\/WhiteLabelMembershipId"},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"responses":{"200":{"description":"Fresh invitation and delivery status"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"409":{"$ref":"#\/components\/responses\/Conflict"}}}},"\/white-label\/members\/{membership}:restore":{"post":{"operationId":"restoreWhiteLabelMember","summary":"Restore a removed White Label member","description":"Requires `members:write`. Restores membership access but never revives previously revoked keys.","tags":["White Label members"],"parameters":[{"$ref":"#\/components\/parameters\/WhiteLabelMembershipId"},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"responses":{"200":{"description":"Restored member"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"409":{"$ref":"#\/components\/responses\/Conflict"}}}},"\/white-label\/client-limits":{"get":{"operationId":"listWhiteLabelClientLimits","summary":"List client storage limits","description":"Requires `members:read`. A client storage limit is one budget shared by the mailboxes, and their Drive, in a white-label client's domains. A domain-constrained caller sees only the limits whose domains are all within its reach; a limit that also covers another domain is left out, so one client never reads another's.","tags":["White Label client storage limits"],"parameters":[{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"default":1}},{"name":"per_page","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":25}}],"responses":{"200":{"description":"Paginated client storage limits","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/ClientLimit"}},"links":{"type":"object"},"meta":{"type":"object"}}}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"}}},"post":{"operationId":"setWhiteLabelClientLimit","summary":"Give domains a client storage limit","description":"Requires `members:write`, an Idempotency-Key and a caller that reaches every domain: a member confined to some domains is refused with 403 scope_blocked_by_membership, a key confined to some domains with 403 token_resource_constrained. Same rules as the Team page: domains without a limit get a new one (201); domains that already share one limit change that limit, and the given domains without a limit join it (200); domains under two or more limits are refused with 409 client_storage_domains_conflict. A limit may not be lower than what its domains already reserve or store: 422 client_storage_limit_too_low, with the lowest accepted value in details.minimum_mb.","tags":["White Label client storage limits"],"parameters":[{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["domain_ids","storage_limit_mb"],"properties":{"domain_ids":{"type":"array","minItems":1,"maxItems":500,"uniqueItems":true,"items":{"type":"integer"},"description":"Domains of this account the limit covers."},"storage_limit_mb":{"type":"integer","minimum":1,"maximum":2147483647,"description":"The budget in MB for mail and Drive in these domains."}}}}}},"responses":{"200":{"description":"The limit these domains already shared, changed","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ClientLimit"}}}},"201":{"description":"New client storage limit","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ClientLimit"}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"409":{"description":"client_storage_domains_conflict: the domains are under different limits (details.domain_ids, details.client_limit_ids)","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"description":"validation_error, or client_storage_limit_too_low (details.minimum_mb, allocated_mb, used_mb, requested_mb)","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"$ref":"#\/components\/responses\/TooManyRequests"}}}},"\/white-label\/client-limits\/{clientLimit}":{"get":{"operationId":"getWhiteLabelClientLimit","summary":"Get a client storage limit","description":"Requires `members:read`. A limit of another account, or one that covers a domain outside a domain-constrained caller's reach, is 404, the same answer as an id that does not exist.","tags":["White Label client storage limits"],"parameters":[{"$ref":"#\/components\/parameters\/ClientLimitId"}],"responses":{"200":{"description":"Client storage limit","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ClientLimit"}}}},"404":{"$ref":"#\/components\/responses\/NotFound"}}},"patch":{"operationId":"updateWhiteLabelClientLimit","summary":"Change a client storage limit","description":"Requires `members:write`, an Idempotency-Key and a caller that reaches every domain: a member confined to some domains is refused with 403 scope_blocked_by_membership, a key confined to some domains with 403 token_resource_constrained. Send storage_limit_mb, domain_ids or both; domain_ids replaces the whole set, and domains left out go back to the account's storage. A domain already under another limit is refused with 409 client_storage_domains_conflict; a limit lower than what its domains reserve or store with 422 client_storage_limit_too_low.","tags":["White Label client storage limits"],"parameters":[{"$ref":"#\/components\/parameters\/ClientLimitId"},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","minProperties":1,"properties":{"storage_limit_mb":{"type":"integer","minimum":1,"maximum":2147483647},"domain_ids":{"type":"array","minItems":1,"maxItems":500,"uniqueItems":true,"items":{"type":"integer"},"description":"The full set of domains the limit covers from now on."}}}}}},"responses":{"200":{"description":"Changed client storage limit","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ClientLimit"}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"409":{"description":"client_storage_domains_conflict","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"description":"validation_error, or client_storage_limit_too_low","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"$ref":"#\/components\/responses\/TooManyRequests"}}},"delete":{"operationId":"removeWhiteLabelClientLimit","summary":"Remove a client storage limit","description":"Requires `members:write`, an Idempotency-Key and a caller that reaches every domain: a member confined to some domains is refused with 403 scope_blocked_by_membership, a key confined to some domains with 403 token_resource_constrained. The limit's domains go back to the account's storage; mailboxes keep their sizes.","tags":["White Label client storage limits"],"parameters":[{"$ref":"#\/components\/parameters\/ClientLimitId"},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"responses":{"200":{"description":"Limit removed","content":{"application\/json":{"schema":{"type":"object","required":["id","removed","domain_ids"],"properties":{"id":{"type":"integer"},"removed":{"type":"boolean","const":true},"domain_ids":{"type":"array","items":{"type":"integer"},"description":"Domains that went back to the account's storage."}}}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"429":{"$ref":"#\/components\/responses\/TooManyRequests"}}}},"\/white-label\/activity":{"get":{"operationId":"listWhiteLabelActivity","summary":"List White Label account activity","description":"Requires `activity:read`. Domain-constrained callers receive only member activity that stays inside their reachable domains.","tags":["White Label activity"],"parameters":[{"name":"action","in":"query","schema":{"type":"string","maxLength":64}},{"name":"member_id","in":"query","schema":{"type":"integer","minimum":1}},{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"default":1}},{"name":"per_page","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":25}}],"responses":{"200":{"description":"Paginated activity list"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"}}}},"\/white-label\/members\/{membership}\/activity":{"get":{"operationId":"getWhiteLabelMemberActivity","summary":"Get one member's actions and sign-in history","description":"Requires both `activity:read` and `members:read`. Sign-in details are returned only for the selected reachable member.","tags":["White Label activity"],"parameters":[{"$ref":"#\/components\/parameters\/WhiteLabelMembershipId"},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}}],"responses":{"200":{"description":"Member, account actions, and sign-in history"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"}}}},"\/domains\/{domain}\/branding":{"get":{"operationId":"getDomainBranding","summary":"Get a domain's White Label branding","description":"Requires `branding:read` and an active White Label entitlement (or the owner recovery grace window).","tags":["White Label branding"],"parameters":[{"$ref":"#\/components\/parameters\/DomainId"}],"responses":{"200":{"description":"Brand, assets, branded hosts, mail zone, and remaining DNS actions","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/WhiteLabelBrandingResponse"}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"}}},"patch":{"operationId":"updateDomainBranding","summary":"Update a domain's White Label branding","description":"Requires `branding:write` and active White Label. This is a partial merge; omitted fields are preserved.","tags":["White Label branding"],"parameters":[{"$ref":"#\/components\/parameters\/DomainId"},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/WhiteLabelBrandingInput"}}}},"responses":{"200":{"description":"Updated branding state","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/WhiteLabelBrandingResponse"}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}},"delete":{"operationId":"deleteDomainBranding","summary":"Clear domain or account-wide White Label branding","description":"Requires `branding:write` and active White Label. Use `scope=domain` or `scope=all`.","tags":["White Label branding"],"parameters":[{"$ref":"#\/components\/parameters\/DomainId"},{"$ref":"#\/components\/parameters\/IdempotencyKey"},{"name":"scope","in":"query","schema":{"type":"string","enum":["domain","all"],"default":"domain"}}],"responses":{"200":{"description":"Branding state after removal","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/WhiteLabelBrandingResponse"}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}}},"\/domains\/{domain}\/branding\/logo\/{slot}":{"put":{"operationId":"setDomainBrandingLogo","summary":"Upload a White Label logo or favicon","description":"Requires `branding:write` and active White Label. Send a base64-encoded PNG, JPEG, or favicon ICO up to 1 MB.","tags":["White Label branding"],"parameters":[{"$ref":"#\/components\/parameters\/DomainId"},{"$ref":"#\/components\/parameters\/BrandingLogoSlot"},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["content_base64"],"properties":{"content_base64":{"type":"string","format":"byte","maxLength":1402200,"description":"Raw PNG\/JPEG\/ICO bytes encoded as base64, without a data-URL prefix; decoded size is limited to 1 MB."},"scope":{"type":"string","enum":["domain","account_default"]}}}}}},"responses":{"200":{"description":"Branding state with the uploaded asset","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/WhiteLabelBrandingResponse"}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}},"delete":{"operationId":"removeDomainBrandingLogo","summary":"Remove a White Label logo or favicon","description":"Requires `branding:write` and active White Label.","tags":["White Label branding"],"parameters":[{"$ref":"#\/components\/parameters\/DomainId"},{"$ref":"#\/components\/parameters\/BrandingLogoSlot"},{"$ref":"#\/components\/parameters\/IdempotencyKey"},{"name":"scope","in":"query","schema":{"type":"string","enum":["domain","account_default"],"default":"domain"}}],"responses":{"200":{"description":"Branding state after asset removal","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/WhiteLabelBrandingResponse"}}}},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}}},"\/domains\/{domain}\/branding\/verify-dns":{"post":{"operationId":"verifyDomainBrandingDns","summary":"Queue White Label DNS verification","description":"Requires `branding:write` and active White Label. Re-read the branding resource to follow asynchronous host and certificate state.","tags":["White Label branding"],"parameters":[{"$ref":"#\/components\/parameters\/DomainId"},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"responses":{"200":{"description":"DNS verification queued"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"}}}},"\/domains\/{domain}\/branding\/preview":{"post":{"operationId":"createDomainBrandingPreview","summary":"Create a short-lived White Label preview","description":"Requires `branding:write` and active White Label. Returns a temporary URL for reviewing the branded experience before DNS is live.","tags":["White Label branding"],"parameters":[{"$ref":"#\/components\/parameters\/DomainId"},{"$ref":"#\/components\/parameters\/IdempotencyKey"}],"responses":{"200":{"description":"Preview URL and expiry"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"},"429":{"$ref":"#\/components\/responses\/TooManyRequests"}}}},"\/mailboxes\/{mailbox}\/messages":{"get":{"operationId":"listAccountMailboxMessages","summary":"List messages in a mailbox folder","description":"Requires the explicit account\/OAuth capability mailboxes:messages:read on Pro or Agency. Applies live plan, membership, domain and mailbox restrictions, including future mailboxes. Reads do not mark messages as seen. External connected accounts are not supported. The daily read quota is shared across this credential\u2019s mailboxes.","tags":["Messages"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"name":"folder","in":"query","description":"IMAP folder path (default: INBOX)","schema":{"type":"string","default":"INBOX","maxLength":255}},{"name":"limit","in":"query","description":"Max messages to return (1-50)","schema":{"type":"integer","default":20,"minimum":1,"maximum":50}},{"name":"before_uid","in":"query","description":"Cursor from the previous page: pagination.next_before_uid. Messages are ordered by date, not UID, so send before_date with it.","schema":{"type":"integer","minimum":1}},{"name":"before_date","in":"query","description":"Cursor from the previous page: pagination.next_before_date (Unix seconds). Send it together with before_uid.","schema":{"type":"integer","minimum":0}},{"name":"since","in":"query","description":"Only return messages since this date (ISO 8601)","schema":{"type":"string","format":"date"}},{"name":"unread_only","in":"query","description":"Only return unread messages","schema":{"type":"boolean","default":false}},{"name":"search","in":"query","description":"Text to find anywhere in the message, headers and body (max 200 chars). A search page can be short or empty while pagination.has_more is true: keep paging.","schema":{"type":"string","maxLength":200}}],"responses":{"200":{"description":"Message list with pagination","content":{"application\/json":{"schema":{"type":"object","properties":{"mailbox":{"type":"string","format":"email"},"folder":{"type":"string"},"messages":{"type":"array","items":{"$ref":"#\/components\/schemas\/MessageSummary"}},"pagination":{"type":"object","properties":{"has_more":{"type":"boolean"},"next_before_uid":{"type":"integer","nullable":true},"next_before_date":{"type":"integer","nullable":true,"description":"Unix seconds; pass as before_date with before_uid for the next page"}}}}}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/ValidationError"},"429":{"$ref":"#\/components\/responses\/TooManyRequests"},"502":{"description":"IMAP connection failed (retryable)","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-required-scope":"mailboxes:messages:read"}},"\/mailboxes\/{mailbox}\/messages\/{uid}":{"get":{"operationId":"getAccountMailboxMessage","summary":"Get a single message by UID","description":"Requires the explicit account\/OAuth capability mailboxes:messages:read on Pro or Agency. Applies live plan, membership, domain and mailbox restrictions, including future mailboxes. Reads do not mark messages as seen. External connected accounts are not supported. The daily read quota is shared across this credential\u2019s mailboxes.","tags":["Messages"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"name":"uid","in":"path","required":true,"description":"IMAP UID of the message","schema":{"type":"integer"}},{"name":"folder","in":"query","description":"IMAP folder path (default: INBOX)","schema":{"type":"string","default":"INBOX","maxLength":255}}],"responses":{"200":{"description":"Full message details","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MessageDetail"}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"413":{"description":"message_too_large: the message is over 100 MiB and the bounded reader cannot render it (an invitation card, a body part over 4 MB). Final, not retryable.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"$ref":"#\/components\/responses\/ValidationError"},"429":{"$ref":"#\/components\/responses\/TooManyRequests"},"502":{"description":"IMAP connection failed (retryable)","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-required-scope":"mailboxes:messages:read"}},"\/mailboxes\/{mailbox}\/folders":{"get":{"operationId":"listAccountMailboxFolders","summary":"List mailbox folders","description":"Requires the explicit account\/OAuth capability mailboxes:messages:read on Pro or Agency. Applies live plan, membership, domain and mailbox restrictions, including future mailboxes. Reads do not mark messages as seen. External connected accounts are not supported. The daily read quota is shared across this credential\u2019s mailboxes.","tags":["Messages"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Folder list","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MessageFolderList"}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"429":{"$ref":"#\/components\/responses\/TooManyRequests"},"502":{"description":"Could not connect to the mailbox"}},"x-required-scope":"mailboxes:messages:read","parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}}]}},"\/mailboxes\/{mailbox}\/messages\/{uid}\/raw":{"get":{"operationId":"getAccountMailboxRawMessage","summary":"Download raw message with account read permission","description":"Requires mailboxes:messages:read on Pro or Agency. Uses the same bounded read implementation as mailbox message tokens and applies live resource constraints. No external_account_id.","tags":["Messages"],"security":[{"bearerAuth":[]}],"x-required-scope":"mailboxes:messages:read","parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"name":"uid","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"name":"folder","in":"query","schema":{"type":"string","default":"INBOX","maxLength":255}}],"responses":{"200":{"description":"JSON with base64 content (maximum decoded size 25 MiB).","content":{"application\/json":{"schema":{"type":"object","required":["uid","folder","content_type","encoding","size_bytes","raw_base64"],"properties":{"uid":{"type":"integer","minimum":1},"folder":{"type":"string"},"content_type":{"type":"string","const":"message\/rfc822"},"encoding":{"type":"string","const":"base64"},"size_bytes":{"type":"integer","maximum":26214400},"raw_base64":{"type":"string","contentEncoding":"base64"}}}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"},"429":{"description":"Read quota or request rate exceeded"},"503":{"description":"Message API or mailbox backend unavailable"},"413":{"description":"Content exceeds the 25 MiB response limit."},"502":{"description":"The mailbox backend could not be reached."}}}},"\/mailboxes\/{mailbox}\/messages\/{uid}\/attachments\/{index}":{"get":{"operationId":"getAccountMailboxAttachment","summary":"Download one attachment with account read permission","description":"Requires mailboxes:messages:read on Pro or Agency. Uses the same bounded read implementation as mailbox message tokens and applies live resource constraints. No external_account_id.","tags":["Messages"],"security":[{"bearerAuth":[]}],"x-required-scope":"mailboxes:messages:read","parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"name":"uid","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"name":"folder","in":"query","schema":{"type":"string","default":"INBOX","maxLength":255}},{"name":"index","in":"path","required":true,"schema":{"type":"integer","minimum":0}}],"responses":{"200":{"description":"JSON with base64 content (maximum decoded size 25 MiB).","content":{"application\/json":{"schema":{"type":"object","required":["uid","index","filename","content_type","size","content_base64"],"properties":{"uid":{"type":"integer","minimum":1},"index":{"type":"integer","minimum":0},"filename":{"type":"string"},"content_type":{"type":"string"},"size":{"type":"integer","maximum":26214400},"content_base64":{"type":"string","contentEncoding":"base64"}}}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"},"429":{"description":"Read quota or request rate exceeded"},"503":{"description":"Message API or mailbox backend unavailable"},"413":{"description":"Content exceeds the 25 MiB response limit. Use attachments\/{index}\/download-url for a file of any size."},"502":{"description":"The mailbox backend could not be reached."}}}},"\/private-notes":{"get":{"operationId":"listPrivateNotes","tags":["Private Notes"],"summary":"listPrivateNotes","description":"Requires private-notes:read. Only own actor\/workflow notes and reachable domain\/mailbox resources. No plaintext, password, decryption key or fragment is accepted. Domain policy narrows account limits; expiry can only shorten. Consume returns ciphertext once, is destructive, and must never be automatically retried. White Label URLs are bound to the serving branded domain.","x-required-scopes":["private-notes:read"],"responses":{"200":{"description":"Success; metadata only except encrypted consumption"},"403":{"description":"Scope, resource, account policy or verified receipt identity denied"},"404":{"description":"Unavailable, foreign or consumed note"},"409":{"description":"Stale revision or unavailable idempotent creation"},"422":{"description":"Invalid input or disallowed lifetime"},"429":{"description":"Actor\/account, receipt or global capacity limit"},"503":{"description":"Dedicated volatile storage unavailable or disabled"}},"parameters":[{"name":"domain_id","in":"query","description":"Required for a domain-constrained connection. Use the same domain for the workflow.","schema":{"type":"integer","minimum":1}},{"name":"mailbox_id","in":"query","description":"Required for mailbox-constrained connections.","schema":{"type":"integer","minimum":1}}]},"post":{"operationId":"createPrivateNoteEncrypted","tags":["Private Notes"],"summary":"createPrivateNoteEncrypted","description":"Requires private-notes:create. Only own actor\/workflow notes and reachable domain\/mailbox resources. No plaintext, password, decryption key or fragment is accepted. Domain policy narrows account limits; expiry can only shorten. Consume returns ciphertext once, is destructive, and must never be automatically retried. White Label URLs are bound to the serving branded domain.","x-required-scopes":["private-notes:create"],"responses":{"200":{"description":"Success; metadata only except encrypted consumption"},"403":{"description":"Scope, resource, account policy or verified receipt identity denied"},"404":{"description":"Unavailable, foreign or consumed note"},"409":{"description":"Stale revision or unavailable idempotent creation"},"422":{"description":"Invalid input or disallowed lifetime"},"429":{"description":"Actor\/account, receipt or global capacity limit"},"503":{"description":"Dedicated volatile storage unavailable or disabled"},"201":{"description":"Created: data contains metadata, reader_url without fragment, management_token (guest capability) and replayed=false. On replay, metadata and reader_url are returned without a management token. Consumed notes cannot be recreated by retrying."},"413":{"description":"Request body over 131,072 bytes"}},"parameters":[],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/PrivateNoteCreate"}}}}}},"\/private-notes\/{id}":{"get":{"operationId":"getPrivateNoteStatus","tags":["Private Notes"],"summary":"getPrivateNoteStatus","description":"Requires private-notes:read. Only own actor\/workflow notes and reachable domain\/mailbox resources. No plaintext, password, decryption key or fragment is accepted. Domain policy narrows account limits; expiry can only shorten. Consume returns ciphertext once, is destructive, and must never be automatically retried. White Label URLs are bound to the serving branded domain.","x-required-scopes":["private-notes:read"],"responses":{"200":{"description":"Success; metadata only except encrypted consumption"},"403":{"description":"Scope, resource, account policy or verified receipt identity denied"},"404":{"description":"Unavailable, foreign or consumed note"},"409":{"description":"Stale revision or unavailable idempotent creation"},"422":{"description":"Invalid input or disallowed lifetime"},"429":{"description":"Actor\/account, receipt or global capacity limit"},"503":{"description":"Dedicated volatile storage unavailable or disabled"}},"parameters":[{"name":"domain_id","in":"query","description":"Required for a domain-constrained connection. Use the same domain for the workflow.","schema":{"type":"integer","minimum":1}},{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{43}$"}},{"name":"mailbox_id","in":"query","description":"Required for mailbox-constrained connections.","schema":{"type":"integer","minimum":1}}]},"patch":{"operationId":"updatePrivateNote","tags":["Private Notes"],"summary":"updatePrivateNote","description":"Requires private-notes:write. Only own actor\/workflow notes and reachable domain\/mailbox resources. No plaintext, password, decryption key or fragment is accepted. Domain policy narrows account limits; expiry can only shorten. Consume returns ciphertext once, is destructive, and must never be automatically retried. White Label URLs are bound to the serving branded domain.","x-required-scopes":["private-notes:write"],"responses":{"200":{"description":"Success; metadata only except encrypted consumption"},"403":{"description":"Scope, resource, account policy or verified receipt identity denied"},"404":{"description":"Unavailable, foreign or consumed note"},"409":{"description":"Stale revision or unavailable idempotent creation"},"422":{"description":"Invalid input or disallowed lifetime"},"429":{"description":"Actor\/account, receipt or global capacity limit"},"503":{"description":"Dedicated volatile storage unavailable or disabled"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{43}$"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/PrivateNoteUpdate"}}}}}},"\/private-notes\/{id}\/revoke":{"post":{"operationId":"revokePrivateNote","tags":["Private Notes"],"summary":"revokePrivateNote","description":"Requires private-notes:revoke. Only own actor\/workflow notes and reachable domain\/mailbox resources. No plaintext, password, decryption key or fragment is accepted. Domain policy narrows account limits; expiry can only shorten. Consume returns ciphertext once, is destructive, and must never be automatically retried. White Label URLs are bound to the serving branded domain.","x-required-scopes":["private-notes:revoke"],"responses":{"200":{"description":"Success; metadata only except encrypted consumption"},"403":{"description":"Scope, resource, account policy or verified receipt identity denied"},"404":{"description":"Unavailable, foreign or consumed note"},"409":{"description":"Stale revision or unavailable idempotent creation"},"422":{"description":"Invalid input or disallowed lifetime"},"429":{"description":"Actor\/account, receipt or global capacity limit"},"503":{"description":"Dedicated volatile storage unavailable or disabled"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{43}$"}}],"requestBody":{"content":{"application\/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"domain_id":{"type":"integer","minimum":1},"mailbox_id":{"type":"integer","minimum":1}}}}}}}},"\/private-notes\/{id}\/consume":{"post":{"operationId":"consumePrivateNoteEncrypted","tags":["Private Notes"],"summary":"consumePrivateNoteEncrypted","description":"Requires private-notes:consume. Only own actor\/workflow notes and reachable domain\/mailbox resources. No plaintext, password, decryption key or fragment is accepted. Domain policy narrows account limits; expiry can only shorten. Consume returns ciphertext once, is destructive, and must never be automatically retried. White Label URLs are bound to the serving branded domain. Send max_ciphertext_bytes with the largest ciphertext your client can decrypt (80016 for the current Private Notes v1 module); without it the server assumes 16400, the limit of clients made for 4,000-character notes. A larger note is refused with 409 private_note_client_outdated before anything is consumed, so a one-time note survives for an updated client.","x-required-scopes":["private-notes:consume"],"responses":{"200":{"description":"Success; metadata only except encrypted consumption"},"403":{"description":"Scope, resource, account policy or verified receipt identity denied"},"404":{"description":"Unavailable, foreign or consumed note"},"409":{"description":"error.code private_note_client_outdated: the note is larger than max_ciphertext_bytes (16400 when omitted). Nothing was consumed; update the client and open the note again."},"422":{"description":"Invalid input or disallowed lifetime"},"429":{"description":"Actor\/account, receipt or global capacity limit"},"503":{"description":"Dedicated volatile storage unavailable or disabled"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{43}$"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","additionalProperties":false,"required":["confirm_open"],"properties":{"confirm_open":{"type":"boolean","const":true},"max_ciphertext_bytes":{"type":"integer","minimum":16400,"default":16400,"description":"The largest ciphertext, in decoded bytes, this client can decrypt. The current Private Notes v1 module decrypts 80016 (20,000 characters); omitting it means 16400, the limit of clients made for 4,000-character notes. Any value below 80016 counts as 16400."},"domain_id":{"type":"integer","minimum":1},"mailbox_id":{"type":"integer","minimum":1}}}}}}}},"\/private-notes\/settings":{"get":{"operationId":"getPrivateNotePolicy","tags":["Private Notes"],"summary":"getPrivateNotePolicy","description":"Requires private-notes:settings:read. Only own actor\/workflow notes and reachable domain\/mailbox resources. No plaintext, password, decryption key or fragment is accepted. Domain policy narrows account limits; expiry can only shorten. Consume returns ciphertext once, is destructive, and must never be automatically retried. White Label URLs are bound to the serving branded domain.","x-required-scopes":["private-notes:settings:read"],"responses":{"200":{"description":"Success; metadata only except encrypted consumption"},"403":{"description":"Scope, resource, account policy or verified receipt identity denied"},"404":{"description":"Unavailable, foreign or consumed note"},"409":{"description":"Stale revision or unavailable idempotent creation"},"422":{"description":"Invalid input or disallowed lifetime"},"429":{"description":"Actor\/account, receipt or global capacity limit"},"503":{"description":"Dedicated volatile storage unavailable or disabled"}},"parameters":[{"name":"domain_id","in":"query","description":"Required for a domain-constrained connection. Use the same domain for the workflow.","schema":{"type":"integer","minimum":1}},{"name":"mailbox_id","in":"query","description":"Required for mailbox-constrained connections.","schema":{"type":"integer","minimum":1}}]},"patch":{"operationId":"updatePrivateNotePolicy","tags":["Private Notes"],"summary":"updatePrivateNotePolicy","description":"Requires private-notes:settings:write. Only own actor\/workflow notes and reachable domain\/mailbox resources. No plaintext, password, decryption key or fragment is accepted. Domain policy narrows account limits; expiry can only shorten. Consume returns ciphertext once, is destructive, and must never be automatically retried. White Label URLs are bound to the serving branded domain.","x-required-scopes":["private-notes:settings:write"],"responses":{"200":{"description":"Success; metadata only except encrypted consumption"},"403":{"description":"Scope, resource, account policy or verified receipt identity denied"},"404":{"description":"Unavailable, foreign or consumed note"},"409":{"description":"Stale revision or unavailable idempotent creation"},"422":{"description":"Invalid input or disallowed lifetime"},"429":{"description":"Actor\/account, receipt or global capacity limit"},"503":{"description":"Dedicated volatile storage unavailable or disabled"}},"parameters":[],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/PrivateNotePolicy"}}}}}},"\/mailboxes\/{mailbox}\/messages\/{uid}\/attachments\/{index}\/download-url":{"get":{"operationId":"getAccountMailboxAttachmentDownloadUrl","summary":"Get a download link for one attachment, any size","description":"Requires mailboxes:messages:read on Pro or Agency. Answers a short-lived download_url instead of the file: no base64 and no 25 MiB limit, the way Drive's file download URL works. GET it with no credential.","tags":["Messages"],"security":[{"bearerAuth":[]}],"x-required-scope":"mailboxes:messages:read","parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"name":"uid","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"name":"folder","in":"query","schema":{"type":"string","default":"INBOX","maxLength":255}},{"name":"index","in":"path","required":true,"schema":{"type":"integer","minimum":0}}],"responses":{"200":{"description":"A short-lived download link (api.attachment_download_url_ttl_minutes, default 5).","content":{"application\/json":{"schema":{"type":"object","required":["uid","index","filename","content_type","size_bytes","download_url","expires_at"],"properties":{"uid":{"type":"integer","minimum":1},"index":{"type":"integer","minimum":0},"filename":{"type":"string"},"content_type":{"type":"string"},"size_bytes":{"type":["integer","null"],"minimum":0,"description":"Exact decoded size; null when it cannot be known before reading (the download then has no Content-Length)."},"download_url":{"type":"string","format":"uri","description":"GET with no Authorization header. Reusable until expires_at; a download already running is not cut off."},"expires_at":{"type":"string","format":"date-time"}}}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"},"429":{"description":"Read quota or request rate exceeded"},"503":{"description":"Message API or mailbox backend unavailable"},"502":{"description":"The mailbox backend could not be reached."}}}},"\/mailboxes\/{mailbox}\/messages\/{uid}\/attachments\/download-url":{"get":{"operationId":"getAccountMailboxAttachmentsDownloadUrl","summary":"Get a download link for all attachments as one ZIP, any size","description":"Requires mailboxes:messages:read on Pro or Agency. The ZIP is written while it downloads (stored entries); size_bytes is its exact size when every attachment's size is known.","tags":["Messages"],"security":[{"bearerAuth":[]}],"x-required-scope":"mailboxes:messages:read","parameters":[{"name":"mailbox","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"name":"uid","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"name":"folder","in":"query","schema":{"type":"string","default":"INBOX","maxLength":255}}],"responses":{"200":{"description":"A short-lived download link (api.attachment_download_url_ttl_minutes, default 5).","content":{"application\/json":{"schema":{"type":"object","required":["uid","filename","content_type","size_bytes","download_url","expires_at","count"],"properties":{"uid":{"type":"integer","minimum":1},"count":{"type":"integer","minimum":1},"filename":{"type":"string"},"content_type":{"type":"string"},"size_bytes":{"type":["integer","null"],"minimum":0,"description":"Exact decoded size; null when it cannot be known before reading (the download then has no Content-Length)."},"download_url":{"type":"string","format":"uri","description":"GET with no Authorization header. Reusable until expires_at; a download already running is not cut off."},"expires_at":{"type":"string","format":"date-time"}}}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/ValidationError"},"429":{"description":"Read quota or request rate exceeded"},"503":{"description":"Message API or mailbox backend unavailable"},"413":{"description":"More attachments than one archive may hold (1000)."},"502":{"description":"The mailbox backend could not be reached."}}}},"\/attachment-downloads\/{token}":{"get":{"operationId":"downloadAttachmentByLink","summary":"Download an attachment (or all of a message's attachments as a ZIP) through a download link","description":"The download_url a download-url endpoint returned. No Authorization header: the link is the credential, valid until its expires_at and reusable until then. The body streams from the mailbox with Content-Length whenever the size is known, so a transfer that breaks off is detectable.","tags":["Messages"],"security":[],"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-f0-9]{64}$"}}],"responses":{"200":{"description":"The file (Content-Disposition: attachment).","content":{"application\/octet-stream":{"schema":{"type":"string","format":"binary"}},"application\/zip":{"schema":{"type":"string","format":"binary"}}}},"404":{"description":"Unknown or expired link (error code download_link_expired), or the attachment is no longer there."},"429":{"description":"Too many downloads through this link or from this address."},"502":{"description":"The mailbox backend could not be read; retryable."}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Account API key (tm_live_) or OAuth access token. Each route still requires its explicit permission."},"messageTokenAuth":{"type":"http","scheme":"bearer","description":"Mailbox message token. Prefix: tm_msg_. Used for message read\/send operations (TS-2)."}},"schemas":{"MigrationJob":{"type":"object","properties":{"id":{"type":"integer"},"mailbox_id":{"type":"integer"},"mailbox_email":{"type":"string","nullable":true},"provider":{"type":"string","enum":["gmail","outlook","yahoo","icloud","generic_imap"]},"source_host":{"type":"string"},"source_email":{"type":"string","description":"Masked for security"},"status":{"type":"string","enum":["pending","validating","planning","processing","completed","failed","cancelled"]},"progress":{"type":"integer","minimum":0,"maximum":100},"total_messages":{"type":"integer"},"imported_messages":{"type":"integer"},"failed_messages":{"type":"integer"},"skipped_duplicates":{"type":"integer"},"imported_bytes":{"type":"integer","nullable":true,"description":"Source size of the messages copied so far, in bytes. Null for an import that was already running when size tracking began (only its later messages were measured); imported_bytes_exact is then false."},"imported_bytes_exact":{"type":"boolean","description":"True when imported_bytes sums every copied message; false when imported_bytes is null because only part of the import was measured."},"estimated_remaining_bytes":{"type":"integer","nullable":true,"description":"Estimated size of the messages this run still has to copy, in bytes, while the import runs. Null when it can't be estimated yet."},"estimated_days_remaining":{"type":"number","nullable":true,"description":"Gmail sources only, while the import runs: estimated_remaining_bytes at Gmail's ~2.5 GB\/day IMAP download limit per account."},"selected_folders":{"type":"array","items":{"type":"string"}},"import_since":{"type":"string","format":"date","nullable":true},"skip_duplicates":{"type":"boolean"},"folders":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"status":{"type":"string"},"expected":{"type":"integer"},"imported":{"type":"integer"},"failed":{"type":"integer"},"skipped":{"type":"integer"}}}},"error_message":{"type":"string","nullable":true},"poll_hint_seconds":{"type":"integer","nullable":true},"started_at":{"type":"string","format":"date-time","nullable":true},"finished_at":{"type":"string","format":"date-time","nullable":true},"created_at":{"type":"string","format":"date-time"}}},"Domain":{"type":"object","properties":{"id":{"type":"integer"},"domain":{"type":"string"},"status":{"type":"string"},"mail_hosting":{"type":"string","enum":["trekmail","external"],"description":"Where the domain's incoming mail is hosted. `external` means TrekMail sends for the domain but never receives it: no MX requirement, no mailboxes, no catch-all or forwarding addresses."},"dns_health":{"type":"string","enum":["ok","warn","fail","unknown"]},"last_checked_at":{"type":"string","format":"date-time","nullable":true},"created_at":{"type":"string","format":"date-time"}}},"ForwardingAddress":{"type":"object","required":["id","address","local_part","domain_id","recipients","is_active","created_at","updated_at"],"properties":{"id":{"type":"integer"},"address":{"type":"string","format":"email"},"local_part":{"type":"string"},"domain_id":{"type":"integer"},"recipients":{"type":"array","items":{"type":"string","format":"email"}},"is_active":{"type":"boolean"},"created_at":{"type":["string","null"],"format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"}}},"ForwardingAddressListResponse":{"type":"object","required":["data","limits","delivery"],"properties":{"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/ForwardingAddress"}},"limits":{"type":"object","required":["used","max","recipients_per_address"],"properties":{"used":{"type":"integer","minimum":0},"max":{"type":"integer","enum":[25,100,300]},"recipients_per_address":{"type":"integer","const":15}}},"delivery":{"type":"object","required":["active","requires_plan","paused_until","paused_reason"],"properties":{"active":{"type":"boolean"},"requires_plan":{"type":"string","const":"pro"},"paused_until":{"type":["string","null"],"format":"date-time"},"paused_reason":{"type":["string","null"]}}}}},"ForwardingAddressLogResponse":{"type":"object","required":["data","address","window"],"properties":{"data":{"type":"array","items":{"type":"object","required":["id","occurred_at","outcome","from","to","smtp_code","smtp_response"],"properties":{"id":{"type":"integer"},"occurred_at":{"type":"string","format":"date-time"},"outcome":{"type":"string","enum":["delivered","deferred","bounced","blocked"]},"from":{"type":["string","null"],"format":"email"},"to":{"type":["string","null"],"format":"email"},"smtp_code":{"type":["string","null"]},"smtp_response":{"type":["string","null"]}}}},"address":{"type":"string","format":"email"},"window":{"type":"object","required":["retention_days","max_events"],"properties":{"retention_days":{"type":"integer","enum":[7,30]},"max_events":{"type":"integer","const":200}}}}},"DomainMatchingAddresses":{"type":"object","required":["configured","enabled","delivering","status","paused_reason","alias_domain","primary_domain","primary_domain_restricted"],"properties":{"configured":{"type":"boolean","description":"Whether a domain-alias connection is saved for this domain."},"enabled":{"type":"boolean","description":"The saved on\/off intent. A true value does not imply delivery when the plan or domain setup is unavailable."},"delivering":{"type":"boolean","description":"Whether the saved connection is currently eligible to deliver mail."},"status":{"type":"string","enum":["not_configured","delivering","disabled","account_suspended","plan_required","alias_domain_unavailable","primary_domain_unavailable","connection_unavailable"]},"paused_reason":{"type":["string","null"],"enum":["disabled","account_suspended","plan_required","alias_domain_unavailable","primary_domain_unavailable","connection_unavailable",null],"description":"Why a saved connection is not delivering, or null when it is delivering or not configured."},"alias_domain":{"type":"object","required":["id","domain"],"properties":{"id":{"type":"integer"},"domain":{"type":"string"}}},"primary_domain":{"oneOf":[{"type":"object","required":["id","domain"],"properties":{"id":{"type":"integer"},"domain":{"type":"string"}}},{"type":"null"}]},"primary_domain_restricted":{"type":"boolean","description":"True when a connection exists but the caller's domain constraints do not permit the primary domain to be disclosed. In that case primary_domain is null."}}},"DnsRequirements":{"type":"object","properties":{"required_records":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"name":{"type":"string"},"value":{"type":"string","nullable":true},"priority":{"type":"integer","nullable":true},"purpose":{"type":"string"},"requirement_state":{"type":"string","description":"Whether the record has a publishable value now or is waiting for\/requires DKIM key generation.","enum":["actionable","pending","error"]}}}},"observed_records":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"name":{"type":"string"},"value":{"type":"string","nullable":true},"priority":{"type":"integer","nullable":true}}}},"checks":{"type":"array","items":{"type":"object","properties":{"check_key":{"type":"string"},"status":{"type":"string","enum":["pass","fail","warn","unknown"]},"requirement_state":{"type":"string","description":"Whether this requirement is actionable, pending key generation, blocked by key-generation failure, or disabled.","enum":["actionable","pending","error","not_required"]},"details":{"type":"string","nullable":true},"hint":{"type":"string","nullable":true}}}}}},"DnsCheck":{"type":"object","properties":{"id":{"type":"integer"},"domain_id":{"type":"integer"},"status":{"type":"string","enum":["queued","running","succeeded","failed"]},"started_at":{"type":"string","format":"date-time","nullable":true},"completed_at":{"type":"string","format":"date-time","nullable":true},"result":{"type":"object","nullable":true},"error":{"type":"string","nullable":true}}},"Mailbox":{"type":"object","properties":{"id":{"type":"integer"},"email":{"type":"string","format":"email"},"domain_id":{"type":"integer"},"status":{"type":"string","description":"disabled means paused (POST \/mailboxes\/{mailbox}:pause): the mailbox receives no mail and mail apps cannot sign in."},"mailbox_type":{"type":"string","enum":["user","shared"]},"is_shared":{"type":"boolean"},"shared_member_count":{"type":"integer","minimum":0,"description":"Present for shared mailboxes."},"display_name":{"type":"string","nullable":true},"note":{"type":["string","null"],"maxLength":120,"description":"Private note for the account's own records; set it with PATCH \/mailboxes\/{mailbox}\/note. Matched by the search filter of GET \/mailboxes."},"conversation_view":{"type":"boolean","description":"Whether webmail groups related messages into conversations for this regular mailbox. Shared mailboxes use their member mailbox preference."},"drive_access":{"type":"string","enum":["full","attachments_only","disabled"],"description":"How much of Drive the mailbox's own user reaches in webmail. `full` is everything; `attachments_only` removes Drive but still sends over-threshold files as a download link; `disabled` also refuses those. Storage is pooled across the account, so this bounds how much of it one person can fill with files. Not applicable to shared mailboxes."},"login_suspended":{"type":"boolean","description":"True while sign-in is suspended (POST \/mailboxes\/{mailbox}:suspend-login). The mailbox still receives mail, unlike a paused one (status disabled)."},"login_suspended_at":{"type":["string","null"],"format":"date-time"},"login_suspended_reason":{"type":["string","null"]},"client_auth_mode":{"type":"string","enum":["password_or_app_password","app_password_only"],"description":"What mail apps (IMAP, SMTP, ManageSieve, CalDAV\/CardDAV) may sign in with: password_or_app_password accepts the mailbox password or an app password; app_password_only accepts only app passwords. Webmail always signs in with the mailbox password. Change it with POST \/mailboxes\/{mailbox}:client-auth-mode. Present while app passwords are enabled on the platform."},"app_passwords_count":{"type":"integer","minimum":0,"description":"Number of active visible app passwords, excluding platform-minted system credentials. Present only while app passwords are enabled on the platform; omitted otherwise."},"can_send":{"type":"boolean"},"sending_paused_at":{"type":"string","format":"date-time","nullable":true,"description":"When sending was paused for abuse; null when it is not paused."},"sending_paused_reason":{"type":"string","nullable":true},"forwarding_enabled":{"type":"boolean"},"aliases_count":{"type":"integer"},"storage":{"type":"object","required":["used_mb","quota_mb","allocation_mb","is_pooled"],"properties":{"used_mb":{"type":"integer","minimum":0},"quota_mb":{"type":["integer","null"],"minimum":0},"allocation_mb":{"type":["integer","null"],"minimum":0},"is_pooled":{"type":"boolean"}}},"created_at":{"type":"string","format":"date-time"}}},"MailboxAppPassword":{"type":"object","description":"A credential a mail app signs in with instead of the mailbox password (IMAP, SMTP, ManageSieve, CalDAV\/CardDAV; never webmail). The secret itself is only in the create and rotate responses.","required":["id","mailbox_id","name","created_at","created_via","created_by_user_id","last_used_at","last_used_ip","last_used_protocol","revoked_at","revoked_reason","active"],"properties":{"id":{"type":"integer"},"mailbox_id":{"type":"integer"},"name":{"type":"string","maxLength":64},"created_at":{"type":"string","format":"date-time"},"created_via":{"type":"string","enum":["dashboard","webmail","api","mcp","admin"],"description":"Where it was created. mcp means through an MCP connector (an OAuth token); admin means by platform staff."},"created_by_user_id":{"type":["integer","null"],"description":"The account user who created it; null when none did, e.g. when the mailbox user created it in webmail."},"last_used_at":{"type":["string","null"],"format":"date-time","description":"Last successful sign-in with it; null until first use. Can lag by about five minutes."},"last_used_ip":{"type":["string","null"]},"last_used_protocol":{"type":["string","null"],"description":"Protocol of the last sign-in: imap, smtp, sieve or dav."},"revoked_at":{"type":["string","null"],"format":"date-time"},"revoked_reason":{"type":["string","null"],"enum":[null,"revoked","rotated","mailbox_password_reset","mailbox_password_changed","login_suspended","account_fraud","converted_to_shared","mailbox_trashed"],"description":"Why it stopped working. revoked: by hand. rotated: replaced by a new secret. mailbox_password_reset: the mailbox password was reset or recovered, including a password set by an account admin through the dashboard, API or MCP; every app password is revoked. mailbox_password_changed: the mailbox user changed their own password in webmail and opted to revoke app passwords. login_suspended: sign-in to the mailbox was suspended. account_fraud: the account was blocked for fraud; every app password of every mailbox is revoked. converted_to_shared: the mailbox became a shared mailbox. mailbox_trashed: the mailbox was moved to Recently deleted; restoring the mailbox keeps these app passwords revoked."},"active":{"type":"boolean","description":"True until it is revoked."}}},"MailClientSetup":{"type":"object","required":["mailbox","language","connection_status","sending","authentication","incoming","outgoing","dav","shared_mailboxes","delegated_send_addresses","apple_mail_profile","clients","password_note"],"properties":{"mailbox":{"type":"object","required":["id","email"],"properties":{"id":{"type":"integer"},"email":{"type":"string","format":"email"}}},"language":{"type":"string","enum":["en","es","fr","de","pt","it","nl","ru","zh","ja","ko","ar","he"]},"connection_status":{"type":"string","enum":["ready","receiving_only","unavailable"]},"sending":{"type":"object","required":["ready","mode","reason"],"properties":{"ready":{"type":"boolean"},"mode":{"type":"string","enum":["platform","profile","not_configured"]},"reason":{"type":["string","null"],"enum":[null,"mailbox_unavailable","direct_login_unavailable","domain_unavailable","domain_deprovisioning","account_suspended","email_verification_required","mailbox_sending_disabled","smtp_not_configured","managed_smtp_not_in_plan","managed_smtp_entitlement_inactive","smtp_profile_unavailable","smtp_route_invalid"]}}},"authentication":{"type":"object","required":["type","username","password_source","password_included"],"properties":{"type":{"type":"string","const":"password"},"username":{"type":"string","format":"email"},"password_source":{"type":"string","enum":["mailbox_password","app_password"],"description":"The password to type into the mail app. app_password when the mailbox accepts app passwords only; mailbox_password otherwise, including whenever app passwords are not enabled on the platform."},"password_included":{"type":"boolean","const":false},"client_auth_mode":{"type":"string","enum":["password_or_app_password","app_password_only"],"description":"The mailbox's mode; see Mailbox.client_auth_mode. Present while app passwords are enabled on the platform."},"accepted_passwords":{"type":"array","minItems":1,"uniqueItems":true,"items":{"type":"string","enum":["mailbox_password","app_password"]},"description":"Every password a mail app may sign in with. Present while app passwords are enabled on the platform."},"app_passwords_endpoint":{"type":"string","example":"\/api\/v1\/mailboxes\/42\/app-passwords","description":"API path that lists (GET) and creates (POST) this mailbox's app passwords. Present while app passwords are enabled on the platform."}}},"incoming":{"$ref":"#\/components\/schemas\/MailClientServerSettings"},"outgoing":{"$ref":"#\/components\/schemas\/MailClientServerSettings"},"dav":{"type":"object","description":"Calendar and contacts sync. It takes the same username and the same password as IMAP and SMTP.","required":["protocols","url","authentication","username","ready","branded"],"properties":{"protocols":{"type":"array","items":{"type":"string","enum":["CalDAV","CardDAV"]}},"url":{"type":"string","format":"uri"},"authentication":{"type":"string","const":"password"},"username":{"type":"string","format":"email"},"ready":{"type":"boolean"},"branded":{"type":"boolean","description":"True when url is on the domain's White Label host rather than the platform host."}}},"shared_mailboxes":{"$ref":"#\/components\/schemas\/NativeSharedMailboxAccess"},"delegated_send_addresses":{"type":"array","description":"Shared mailboxes this mailbox may send as without reading them (Send as only). Add each address as an extra address (identity) in the mail app; sign in with this mailbox and an app password. Empty while send-only access is not enabled. These addresses have no shared IMAP folders and are not Message API identities. Replies arrive in the team inbox; save sent mail in the member\u2019s own Sent folder.","items":{"type":"object","required":["id","email","display_name"],"properties":{"id":{"type":"integer"},"email":{"type":"string","format":"email"},"display_name":{"type":["string","null"]}}}},"apple_mail_profile":{"type":"object","required":["available","endpoint","media_type","password_included"],"properties":{"available":{"type":"boolean"},"endpoint":{"type":"string"},"media_type":{"type":"string","const":"application\/x-apple-aspen-config"},"password_included":{"type":"boolean","const":false}}},"clients":{"type":"array","minItems":5,"maxItems":5,"items":{"$ref":"#\/components\/schemas\/MailClientGuide"}},"password_note":{"type":"string"}}},"NativeSharedMailboxAccess":{"type":"object","description":"Shared IMAP folders for members with Read, using their own mailbox sign-in. Send-only addresses are listed separately in delegated_send_addresses, even when native shared IMAP is disabled.","required":["native_access_enabled","namespace","authentication","items"],"properties":{"native_access_enabled":{"type":"boolean"},"namespace":{"type":"string","example":"Shared"},"authentication":{"type":"object","required":["username","password_source","password_included"],"properties":{"username":{"type":"string","format":"email"},"password_source":{"type":"string","enum":["mailbox_password","app_password"],"description":"Members reach shared mailboxes with their own mailbox's sign-in, so this follows the member mailbox: app_password when it accepts app passwords only."},"password_included":{"type":"boolean","const":false}}},"items":{"type":"array","items":{"$ref":"#\/components\/schemas\/SharedMailboxClientAccess"}}}},"SharedMailboxClientAccess":{"type":"object","required":["id","email","display_name","folder","folders","can_read","can_send","send_as","send_as_ready","send_as_reason","operations","sent_copy","native_access_status","native_access_ready","native_access_retry_at"],"properties":{"id":{"type":"integer"},"email":{"type":"string","format":"email"},"display_name":{"type":["string","null"]},"folder":{"type":"string","description":"Exact delegated IMAP Inbox path retained for backwards compatibility. See folders for all standard targets.","example":"Shared\/support@example.com\/INBOX"},"folders":{"type":"object","required":["root","inbox","sent","archive","junk"],"properties":{"root":{"type":"string","example":"Shared\/support@example.com"},"inbox":{"type":"string","example":"Shared\/support@example.com\/INBOX"},"sent":{"type":"string","example":"Shared\/support@example.com\/Sent"},"archive":{"type":"string","example":"Shared\/support@example.com\/Archive"},"junk":{"type":"string","example":"Shared\/support@example.com\/Junk"}}},"can_read":{"type":"boolean","const":true,"description":"Always true here because this list contains only readers. Send-only access has no shared folder."},"can_send":{"type":"boolean","description":"The membership's Can reply permission. Inspect send_as_ready for effective SMTP readiness."},"send_as":{"type":["string","null"],"format":"email","description":"Shared From address when effective SMTP Send As is ready; otherwise null."},"send_as_ready":{"type":"boolean"},"send_as_reason":{"type":["string","null"],"enum":[null,"membership_read_only","member_sending_disabled","mailbox_unavailable","mailbox_login_suspended","direct_login_unavailable","domain_unavailable","domain_deprovisioning","account_suspended","email_verification_required","mailbox_sending_disabled","smtp_not_configured","managed_smtp_not_in_plan","managed_smtp_entitlement_inactive","smtp_profile_unavailable","smtp_route_invalid"]},"operations":{"type":"object","description":"Server-enforced capabilities for this membership. Shared-content mutations follow can_send (the reply\/write ACL); can_manage is a legacy member-administration flag and does not grant IMAP content rights. Moving includes moves within the shared tree and between personal and shared folders.","required":["read","change_flags","create_folders","move","delete","send_as"],"properties":{"read":{"type":"boolean","const":true},"change_flags":{"type":"boolean"},"create_folders":{"type":"boolean"},"move":{"type":"boolean"},"delete":{"type":"boolean"},"send_as":{"type":"boolean"}}},"sent_copy":{"type":"object","description":"SMTP does not save a Sent copy. The mail client must append it to this shared folder for team visibility.","required":["folder","smtp_saves_copy"],"properties":{"folder":{"type":"string","example":"Shared\/support@example.com\/Sent"},"smtp_saves_copy":{"type":"boolean","const":false}}},"native_access_status":{"type":"string","enum":["pending","applied","failed"],"description":"Durable Dovecot ACL\/subscription synchronization state for this membership."},"native_access_ready":{"type":"boolean"},"native_access_retry_at":{"type":["string","null"],"format":"date-time"}},"description":"Shared IMAP folder access for a member with Read. Send-only addresses appear separately in MailClientSetup.delegated_send_addresses."},"SharedMailboxMember":{"type":"object","required":["id","member_mailbox_id","email","can_read","can_send","access","custom_label","native_access","created_at"],"properties":{"id":{"type":"integer"},"member_mailbox_id":{"type":"integer"},"email":{"type":"string","format":"email"},"can_read":{"type":"boolean"},"can_send":{"type":"boolean"},"custom_label":{"type":["string","null"],"maxLength":120},"native_access":{"type":"object","required":["status","ready","last_attempted_at","retry_at"],"properties":{"status":{"type":"string","enum":["pending","applied","failed"]},"ready":{"type":"boolean"},"last_attempted_at":{"type":["string","null"],"format":"date-time"},"retry_at":{"type":["string","null"],"format":"date-time"}}},"created_at":{"type":["string","null"],"format":"date-time"},"access":{"type":"string","enum":["read_send","read_only","send_only"],"description":"Read and Send as permissions together. At least one permission must remain enabled."}}},"MailClientServerSettings":{"type":"object","required":["protocol","host","port","security","authentication","username","ready"],"properties":{"protocol":{"type":"string","enum":["IMAP","SMTP"]},"host":{"type":"string"},"port":{"type":"integer","minimum":1,"maximum":65535},"security":{"type":"string","const":"SSL\/TLS"},"authentication":{"type":"string","const":"password"},"username":{"type":"string","format":"email"},"ready":{"type":"boolean"}}},"MailClientGuide":{"type":"object","required":["id","name","platform","title","description","action","steps","password_note"],"properties":{"id":{"type":"string","enum":["gmail","outlook","apple","thunderbird","other"]},"name":{"type":"string"},"platform":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"action":{"type":"string","enum":["use_server_settings","download_apple_profile"]},"steps":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"string"}},"password_note":{"type":"string"}}},"MailboxInvite":{"type":"object","properties":{"invite_id":{"type":"integer"},"domain_id":{"type":"integer"},"email_to_create":{"type":"string","nullable":true},"recipient_email":{"type":"string","format":"email"},"invite_url":{"type":"string","format":"uri"},"expires_at":{"type":"string","format":"date-time","nullable":true},"created_at":{"type":"string","format":"date-time"}}},"BulkInviteResult":{"type":"object","properties":{"batch_id":{"type":"string"},"counts":{"type":"object","properties":{"total":{"type":"integer"},"created":{"type":"integer"},"failed":{"type":"integer"}}},"results":{"type":"array","items":{"type":"object","properties":{"local_part":{"type":"string","nullable":true},"recipient_email":{"type":"string"},"status":{"type":"string","enum":["created","failed"]},"reason":{"type":"string","nullable":true,"description":"Stable machine-readable reason for a failed row."},"invite_id":{"type":"integer","nullable":true},"error":{"type":"string","nullable":true}}}}}},"DeleteIntent":{"type":"object","properties":{"id":{"type":"integer"},"mailbox_id":{"type":"integer"},"mailbox_email":{"type":"string","format":"email"},"status":{"type":"string","enum":["pending","confirmed","executed","expired","failed"]},"risk_flags":{"type":"array","items":{"type":"string","enum":["has_active_forwarding","has_aliases","has_active_migration"]}},"expires_at":{"type":"string","format":"date-time"},"confirm_url":{"type":"string","format":"uri"},"created_at":{"type":"string","format":"date-time"}}},"DeleteIntentResult":{"type":"object","properties":{"id":{"type":"integer"},"mailbox_id":{"type":"integer"},"mailbox_email":{"type":"string","format":"email"},"status":{"type":"string","enum":["executed"]},"risk_flags":{"type":"array","items":{"type":"string"}},"confirmed_at":{"type":"string","format":"date-time"},"executed_at":{"type":"string","format":"date-time"}}},"MessageTokenCreated":{"type":"object","properties":{"id":{"type":"integer"},"token":{"type":"string","description":"Plain token value. Shown only once."},"prefix":{"type":"string"},"name":{"type":"string"},"mailbox_id":{"type":"integer"},"mailbox_email":{"type":"string","format":"email"},"scopes":{"type":"array","items":{"type":"string","enum":["messages:read","messages:write","messages:send"]}},"expires_at":{"type":"string","format":"date-time","nullable":true},"reveal":{"type":"string","enum":["one_time"]},"created_at":{"type":"string","format":"date-time"}}},"MessageToken":{"type":"object","properties":{"id":{"type":"integer"},"prefix":{"type":"string"},"name":{"type":"string"},"scopes":{"type":"array","items":{"type":"string","enum":["messages:read","messages:write","messages:send"]}},"expires_at":{"type":"string","format":"date-time","nullable":true},"last_used_at":{"type":"string","format":"date-time","nullable":true},"revoked_at":{"type":"string","format":"date-time","nullable":true},"created_at":{"type":"string","format":"date-time"}}},"MailRuleCondition":{"type":"object","required":["field","operator"],"properties":{"field":{"type":"string","enum":["from","to","subject","body","header","size"]},"operator":{"type":"string","enum":["is","contains","matches","over","under","exists"]},"value":{"type":["string","null"],"maxLength":500,"description":"Required by operators other than exists. Size values are positive kilobytes. CR and LF are rejected."},"header_name":{"type":["string","null"],"maxLength":100,"description":"Required when field is header. Blank values, CR, and LF are rejected."}}},"MailRuleAction":{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["fileinto","redirect_copy","redirect","addflag","mark_read","discard","reject"]},"value":{"type":["string","null"],"maxLength":500,"description":"Folder, address, flag, or rejection text required by the selected action. CR and LF are rejected."}}},"MailRuleRequest":{"type":"object","required":["match_type","conditions","actions"],"properties":{"name":{"type":["string","null"],"maxLength":255},"enabled":{"type":["boolean","null"],"default":true},"match_type":{"type":"string","enum":["all","any"]},"stop":{"type":["boolean","null"],"default":false},"conditions":{"type":"array","minItems":1,"maxItems":10,"items":{"$ref":"#\/components\/schemas\/MailRuleCondition"}},"actions":{"type":"array","minItems":1,"maxItems":5,"items":{"$ref":"#\/components\/schemas\/MailRuleAction"}}}},"MailRule":{"type":"object","required":["id","priority","enabled","match_type","stop","conditions","actions"],"properties":{"id":{"type":"integer"},"name":{"type":["string","null"]},"priority":{"type":"integer","minimum":0},"enabled":{"type":"boolean"},"match_type":{"type":"string","enum":["all","any"]},"stop":{"type":"boolean"},"conditions":{"type":"array","items":{"$ref":"#\/components\/schemas\/MailRuleCondition"}},"actions":{"type":"array","items":{"$ref":"#\/components\/schemas\/MailRuleAction"}},"created_at":{"type":["string","null"],"format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"}}},"MailRuleMutationResponse":{"allOf":[{"$ref":"#\/components\/schemas\/MailRule"},{"type":"object","required":["sync_pending"],"properties":{"sync_pending":{"type":"boolean"}}}]},"MailboxAlias":{"type":"object","properties":{"id":{"type":"integer"},"email":{"type":"string"},"local_part":{"type":"string"},"domain_id":{"type":"integer"},"domain":{"type":"string"},"type":{"type":"string","enum":["primary","alias"]},"can_receive":{"type":"boolean"},"can_send":{"type":"boolean"},"is_active":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"ForwardingSettings":{"type":"object","properties":{"enabled":{"type":"boolean"},"targets":{"type":"array","items":{"type":"string","format":"email"}},"keep_copy":{"type":"boolean"},"updated_at":{"type":"string","format":"date-time","nullable":true}}},"EmailAddress":{"type":"object","properties":{"name":{"type":"string","nullable":true},"email":{"type":"string","format":"email"}}},"MessageSummary":{"type":"object","properties":{"uid":{"type":"integer"},"message_id":{"type":"string"},"date":{"type":"string","format":"date-time","nullable":true},"from":{"$ref":"#\/components\/schemas\/EmailAddress"},"original_from":{"description":"Authenticated original author when a mailing-list provider rewrote From; null otherwise. The canonical from field remains unchanged.","allOf":[{"$ref":"#\/components\/schemas\/EmailAddress"}],"nullable":true},"sender_via":{"description":"Mailing-list identity through which original_from was delivered; null otherwise.","allOf":[{"$ref":"#\/components\/schemas\/EmailAddress"}],"nullable":true},"to":{"type":"array","items":{"$ref":"#\/components\/schemas\/EmailAddress"}},"subject":{"type":"string"},"flags":{"type":"array","items":{"type":"string"}},"has_attachments":{"type":"boolean"},"preview_text":{"type":"string"}}},"AttachmentMeta":{"type":"object","properties":{"index":{"type":"integer"},"filename":{"type":"string"},"content_type":{"type":"string"},"size_bytes":{"type":"integer"},"disposition":{"type":"string","enum":["attachment","inline"]}}},"MessageDetail":{"allOf":[{"$ref":"#\/components\/schemas\/MessageSummary"},{"type":"object","properties":{"cc":{"type":"array","items":{"$ref":"#\/components\/schemas\/EmailAddress"}},"bcc":{"type":"array","items":{"$ref":"#\/components\/schemas\/EmailAddress"}},"reply_to":{"type":"array","items":{"$ref":"#\/components\/schemas\/EmailAddress"}},"headers":{"type":"object","additionalProperties":{"type":"string"}},"body":{"type":"object","properties":{"text":{"type":"string","nullable":true},"html":{"type":"string","nullable":true}}},"attachments":{"type":"array","items":{"$ref":"#\/components\/schemas\/AttachmentMeta"}}}}]},"MessageFolder":{"type":"object","properties":{"name":{"type":"string","description":"Leaf folder name (modified-UTF7 encoded when it contains non-ASCII)"},"path":{"type":"string","description":"Full IMAP path; split on `delimiter` to reconstruct the hierarchy"},"delimiter":{"type":"string","description":"Hierarchy separator reported by the server (e.g. \"\/\" or \".\")"},"unseen":{"type":"integer","description":"Number of unread messages"},"messages":{"type":"integer","description":"Total number of messages"},"attributes":{"type":"array","items":{"type":"string"},"description":"IMAP LIST attributes (e.g. Noselect, or Gmail virtual-folder flags)"}}},"MessageFolderList":{"type":"object","properties":{"mailbox":{"type":"string","format":"email"},"folders":{"type":"array","items":{"$ref":"#\/components\/schemas\/MessageFolder"}}}},"CreateMessageFolderRequest":{"type":"object","required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":255,"description":"Leaf name for the new folder; may not be a reserved name or contain the server's hierarchy delimiter"},"parent":{"type":"string","minLength":1,"maxLength":255,"description":"Optional raw path of an existing folder to nest the new folder under"}}},"RenameMessageFolderRequest":{"type":"object","required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":255,"description":"New leaf name for the folder"}}},"MessageFolderMutationResponse":{"type":"object","properties":{"folder":{"type":"object","properties":{"name":{"type":"string"},"path":{"type":"string"}}}}},"SendMessageRequest":{"type":"object","required":["to","subject","body"],"properties":{"to":{"type":"array","minItems":1,"items":{"type":"string","format":"email"},"description":"Recipient email addresses (max 10 total across to\/cc\/bcc)"},"cc":{"type":"array","items":{"type":"string","format":"email"}},"bcc":{"type":"array","items":{"type":"string","format":"email"}},"subject":{"type":"string","maxLength":998,"description":"Email subject line. Must not contain CR or LF characters."},"body":{"type":"object","description":"At least one of text or html must be provided.","properties":{"text":{"type":"string","nullable":true,"description":"Plain text body (max 200 KB)"},"html":{"type":"string","nullable":true,"description":"HTML body (max 500 KB)"}}},"attachments":{"type":"array","maxItems":5,"description":"File attachments (max 5 files, 5 MB each, 10 MB total)","items":{"type":"object","required":["filename","content_type","content_base64"],"properties":{"filename":{"type":"string","maxLength":255},"content_type":{"type":"string","description":"MIME type (must be in allowlist)","enum":["image\/jpeg","image\/png","image\/gif","image\/webp","application\/pdf","text\/plain","text\/csv","text\/html","application\/json","application\/xml","application\/zip","application\/gzip","application\/vnd.openxmlformats-officedocument.wordprocessingml.document","application\/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application\/vnd.openxmlformats-officedocument.presentationml.presentation","application\/msword","application\/vnd.ms-excel","message\/rfc822"]},"content_base64":{"type":"string","format":"byte","description":"Base64-encoded file content"}}}},"headers":{"type":"object","maxProperties":8,"description":"Optional outbound headers. Names are case-insensitive and limited to List-Unsubscribe, List-Unsubscribe-Post, Reply-To, and X-* custom headers. Values are strings up to 998 bytes; CR and LF are rejected. Reply-To must be a valid address. Transport-managed headers such as From, To, Subject, Date, Message-ID, MIME, DKIM, ARC, Received, and Return-Path cannot be supplied.","additionalProperties":{"type":"string","maxLength":998}},"reply_to_message_id":{"type":"string","nullable":true,"maxLength":500,"description":"Message-ID to reply to (sets In-Reply-To and References headers)"},"external_account_id":{"type":"integer","minimum":1,"description":"Connected inbox used as the mail source and Sent-folder destination. Required when the selected Send As identity is bound to that inbox."},"identity_id":{"type":"integer","minimum":1,"description":"From identity returned by GET \/messages\/identities for the same source. Its SMTP route, visible From, Reply-To, and Sent destination are enforced at execution time. Delegated team identities are excluded and refused."},"shared_mailbox_id":{"type":"integer","minimum":1,"description":"Send as a shared (team) mailbox where the acting member has both can_read and can_send. Send-only access is not supported by the Message API; use webmail or a mail app. A token bound to a shared mailbox cannot send on its own."},"apply_default_recipients":{"type":"boolean","default":true,"description":"Whether the mailbox's Default CC\/BCC (Settings > Profile) are added to this message. They are applied by default, exactly as they are to mail written in the web app, and an address already on the message is not added twice. Set false to leave them off a single send. Not applied when sending from a connected external account, which has no such setting of its own."}}},"SendMessageResponse":{"type":"object","properties":{"status":{"type":"string","enum":["queued"]},"message_id":{"type":"string","description":"RFC 5322 Message-ID assigned to the outgoing email"},"queued_at":{"type":"string","format":"date-time"},"request_id":{"type":"string"}}},"WhiteLabelOverview":{"type":"object","properties":{"entitlement":{"type":"object","properties":{"state":{"type":"string","enum":["active","grace","unavailable"]},"trial":{"type":"boolean"},"read_only":{"type":"boolean"},"hard_delete_at":{"type":["string","null"],"format":"date-time"}},"required":["state","trial","read_only","hard_delete_at"]},"default_brand":{"type":["object","null"],"description":"The account's shared brand profile, including asset URLs and support\/sender identity."},"setup":{"type":"object","properties":{"completed_steps":{"type":"integer"},"total_steps":{"type":"integer"},"finished":{"type":"boolean"},"steps":{"type":"array","items":{"type":"object"}},"next":{"type":"object","properties":{"route":{"type":["string","null"]},"domain_id":{"type":["integer","null"]}}}}},"domains":{"type":"array","items":{"type":"object"}}},"required":["entitlement","default_brand","setup","domains"]},"WhiteLabelMember":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":["string","null"]},"email":{"type":"string","format":"email"},"role":{"type":"object","properties":{"key":{"type":"string","enum":["owner","account_manager","domain_admin","client","webmail_only","mailbox_operator","support_agent","billing_manager","read_only","custom"]},"label":{"type":"string"},"custom":{"type":"boolean"}}},"status":{"type":"object","properties":{"key":{"type":"string","enum":["pending","active","suspended","revoked"]},"label":{"type":"string"}}},"all_domains":{"type":"boolean"},"domains":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}}}},"client_limit":{"anyOf":[{"$ref":"#\/components\/schemas\/ClientLimitSummary"},{"type":"null"}],"description":"The client storage limit all of this member's domains are under; null when the member reaches every domain, has no domains, or their domains are not all under one limit. For a domain-constrained caller, also null when that limit covers a domain outside the caller's reach."},"permissions":{"type":["array","null"],"items":{"type":"string"},"description":"Explicit selections for a custom role; null for preset roles."},"effective_permissions":{"type":"array","items":{"type":"string"}},"note":{"type":["string","null"],"maxLength":120},"two_factor_enabled":{"type":["boolean","null"]},"invited_at":{"type":["string","null"],"format":"date-time"},"accepted_at":{"type":["string","null"],"format":"date-time"},"suspended_at":{"type":["string","null"],"format":"date-time"},"revoked_at":{"type":["string","null"],"format":"date-time"},"last_seen_at":{"type":["string","null"],"format":"date-time"},"allowed_operations":{"type":"array","description":"Actions allowed by both the member's state and the current caller's write permission, self-management rule, and delegation ceiling.","items":{"type":"string","enum":["update","suspend","resume","resend-invitation","remove","restore"]}},"created_at":{"type":["string","null"],"format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"}},"required":["id","email","role","status","all_domains","effective_permissions","allowed_operations"]},"ClientLimit":{"type":"object","description":"A white-label client storage limit: one budget in MB shared by every mailbox, and its Drive, in the domains attached to it. Fixed-size mailboxes reserve part of it; mailboxes on shared storage share what is left (pool_mb), and never more than the account pool has free either. Sizes are MB, usage is bytes.","properties":{"id":{"type":"integer"},"storage_limit_mb":{"type":"integer","minimum":1},"domain_ids":{"type":"array","items":{"type":"integer"},"description":"Domains under this limit. A domain-constrained caller only ever sees limits whose domains are all within its reach."},"allocated_mb":{"type":"integer","description":"Fixed sizes of the mailboxes in these domains, Recently deleted included (it keeps its reservation)."},"pending_invites_mb":{"type":"integer","description":"Fixed sizes promised by invitations that are still open."},"pool_mb":{"type":"integer","description":"What mailboxes on shared storage in these domains share: storage_limit_mb minus allocated_mb, never below 0."},"used_bytes":{"type":"integer","description":"Mail and Drive stored in these domains, as last measured; mail usage is refreshed every few hours."},"member_ids":{"type":"array","items":{"type":"integer"},"description":"White Label members confined to some of these domains. A domain-constrained caller sees only the members it can reach."}},"required":["id","storage_limit_mb","domain_ids","allocated_mb","pending_invites_mb","pool_mb","used_bytes","member_ids"]},"ClientLimitSummary":{"type":"object","description":"The client storage limit that every domain of a member, or of a domain-constrained caller, is under.","properties":{"id":{"type":"integer"},"storage_limit_mb":{"type":"integer"},"allocated_mb":{"type":"integer","description":"Fixed sizes reserved in the limit's domains."},"used_bytes":{"type":"integer","description":"Mail and Drive stored in the limit's domains."}},"required":["id","storage_limit_mb","allocated_mb","used_bytes"]},"MailboxStorageUpdate":{"type":"object","required":["storage_allocation_mb"],"properties":{"storage_allocation_mb":{"type":["integer","null"],"minimum":1,"description":"A fixed size in MB, taken from the account pool and, in a domain under a client storage limit, from that limit. null moves the mailbox to shared storage. The field is required: send null explicitly for shared storage."}}},"WhiteLabelMemberCreateInput":{"type":"object","required":["email","role","all_domains"],"properties":{"email":{"type":"string","format":"email","maxLength":255},"role":{"$ref":"#\/components\/schemas\/WhiteLabelAssignableRole"},"all_domains":{"type":"boolean"},"domain_ids":{"type":"array","items":{"type":"integer","minimum":1},"maxItems":500,"uniqueItems":true},"permissions":{"type":"array","items":{"type":"string"},"maxItems":200,"uniqueItems":true,"description":"Required and non-empty for `custom`; ignored for preset roles."},"note":{"type":["string","null"],"maxLength":120}}},"WhiteLabelMemberUpdateInput":{"type":"object","description":"Partial access update. Omitted fields preserve their current values.","properties":{"role":{"$ref":"#\/components\/schemas\/WhiteLabelAssignableRole"},"all_domains":{"type":"boolean"},"domain_ids":{"type":"array","items":{"type":"integer","minimum":1},"maxItems":500,"uniqueItems":true},"permissions":{"type":"array","items":{"type":"string"},"maxItems":200,"uniqueItems":true},"note":{"type":["string","null"],"maxLength":120}}},"WhiteLabelAssignableRole":{"type":"string","enum":["client","webmail_only","domain_admin","mailbox_operator","read_only","custom"]},"WhiteLabelBrandingInput":{"type":"object","description":"Partial branding update. Omitted fields are preserved.","properties":{"mode":{"type":"string","enum":["off","inherit","custom"]},"name":{"type":["string","null"],"minLength":1,"maxLength":120},"primary_color":{"type":"string","pattern":"^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$"},"accent_color":{"type":"string","pattern":"^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$"},"dashboard_enabled":{"type":"boolean"},"dashboard_label":{"type":["string","null"],"maxLength":63,"pattern":"^(?!-)[a-zA-Z0-9-]+(?<!-)$"},"webmail_enabled":{"type":"boolean"},"webmail_label":{"type":["string","null"],"maxLength":63,"pattern":"^(?!-)[a-zA-Z0-9-]+(?<!-)$"},"mail_zone_enabled":{"type":"boolean"},"support_email":{"type":["string","null"],"format":"email","maxLength":255},"support_url":{"type":["string","null"],"format":"uri","maxLength":500},"sender_email":{"type":["string","null"],"format":"email","maxLength":255},"scope":{"type":"string","enum":["domain","account_default","all"],"default":"domain"}}},"WhiteLabelBrandingResponse":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/WhiteLabelBranding"}},"required":["data"]},"WhiteLabelBranding":{"type":"object","properties":{"mode":{"type":"string","enum":["off","inherit","custom"]},"white_label_addon_active":{"type":"boolean"},"brand":{"type":["object","null"],"properties":{"id":{"type":"integer"},"name":{"type":"string"},"primary_color":{"type":["string","null"]},"accent_color":{"type":["string","null"]},"logo_url":{"type":["string","null"]},"logo_dark_url":{"type":["string","null"]},"favicon_url":{"type":["string","null"]},"support_email":{"type":["string","null"],"format":"email"},"support_url":{"type":["string","null"],"format":"uri"},"sender_email":{"type":["string","null"],"format":"email"}}},"hosts":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["dashboard","webmail"]},"hostname":{"type":"string"},"subdomain_label":{"type":"string"},"enabled":{"type":"boolean"},"status":{"type":"string","enum":["draft","pending_dns","cert_pending","active","cert_failed","disabled","suspended","pending_deletion","retired"]}},"required":["kind","hostname","subdomain_label","enabled","status"]}},"dns_records":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","const":"CNAME"},"name":{"type":"string"},"value":{"type":"string"},"proxied":{"type":"boolean","const":false}},"required":["type","name","value","proxied"]}},"cname_target":{"type":"string"},"mail_zone":{"$ref":"#\/components\/schemas\/WhiteLabelMailZone"}},"required":["mode","white_label_addon_active","brand","hosts","dns_records","cname_target","mail_zone"]},"WhiteLabelMailZone":{"type":"object","properties":{"enabled":{"type":"boolean"},"dns_status":{"type":"string","enum":["off","pending_dns","active","failed","cleanup_claimed"]},"client_hosts_status":{"type":"string","enum":["off","pending_dns","active","failed","cleanup_claimed"]},"domain":{"type":["string","null"]},"records":{"type":"array","description":"Only DNS records that still need attention after the latest authoritative check.","items":{"type":"object","properties":{"type":{"type":"string","enum":["TXT","CNAME"]},"name":{"type":"string"},"value":{"type":"string"}},"required":["type","name","value"]}},"dav_url":{"type":["string","null"],"format":"uri"},"dav_ready":{"type":"boolean"},"cert_expires_at":{"type":["string","null"],"format":"date-time"},"checked_at":{"type":["string","null"],"format":"date-time"}},"required":["enabled","dns_status","client_hosts_status","domain","records","dav_url","dav_ready","cert_expires_at","checked_at"]},"WhiteLabelActivityEntry":{"type":"object","properties":{"id":{"type":"integer"},"at":{"type":["string","null"],"format":"date-time"},"action":{"type":"string"},"category":{"type":"string"},"description":{"type":"string"},"actor":{"type":"object"},"target":{"type":"object"},"changes":{"type":"array","items":{"type":"object"}}},"required":["id","action","category","description","actor","target","changes"]},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["not_found","validation_error","insufficient_scope","token_scope_blocked_by_plan","scope_blocked_by_entitlement","scope_blocked_by_membership","member_not_manageable","membership_state_conflict","plan_api_disabled","plan_message_api_disabled","message_token_unauthenticated","forbidden","conflict","rate_limited","idempotency_mismatch","missing_idempotency_key","invalid_idempotency_key","duplicate_mailbox","mailbox_limit_reached","domain_hosts_no_mailboxes","mailbox_unavailable","direct_login_unavailable","mail_client_setup_not_ready","invalid_selection","selection_too_large","invalid_name","app_password_limit_reached","mailbox_not_eligible","system_mailbox_protected","plan_required","invalid_member","already_member","already_shared","shared_mailbox_provisioning_deferred","last_member","native_access_sync_failed","service_unavailable","server_error","imap_error","send_blocked","mailbox_sending_paused","account_sending_on_hold","mailbox_send_disabled","account_email_unverified","sending_limit_exceeded","daily_send_limit_exceeded","daily_read_limit_exceeded","recipient_suppressed","intent_expired","intent_already_confirmed","missing_confirm_header","destructive_cooldown","no_access_left","send_only_disabled","last_reader","shared_mailbox_send_denied","identity_unavailable","identity_delegated","account_scheduled_for_deletion","storage_pool_exceeded","trial_mailbox_limit_reached","invalid_storage_allocation","token_resource_constrained","client_storage_limit_exceeded","client_storage_below_usage","client_storage_limit_too_low","client_storage_domains_conflict","folder_has_children","folder_busy"]},"message":{"type":"string"},"hint":{"type":["string","null"],"nullable":true},"request_id":{"type":"string"},"retryable":{"type":"boolean"},"details":{"type":"object","additionalProperties":true,"description":"validation_error: the rejected fields and their messages. Client storage limit codes: the numbers, in MB. client_storage_limit_exceeded carries limit_mb, allocated_mb, available_mb and requested_mb (only available_mb and requested_mb for a domain-constrained caller when the limit also covers a domain outside its reach); client_storage_below_usage used_mb and requested_mb; client_storage_limit_too_low minimum_mb, allocated_mb, used_mb and requested_mb; client_storage_domains_conflict domain_ids and client_limit_ids."},"dimension":{"type":"string","enum":["mailbox_daily","domain_daily","account_daily","recipients_per_message","smtp_hourly","api_token_daily","api_mailbox_daily"],"description":"Sending-limit errors only (`sending_limit_exceeded`, `daily_send_limit_exceeded`, and `rate_limited` for the per-mailbox daily API cap): which allowance refused the message."},"limit":{"type":["integer","null"],"description":"Sending-limit errors only. The allowance, in recipients (API caps: messages). Null for the account-wide total, which message tokens are not shown; use GET \/sending-limits with an account token."},"used":{"type":["integer","null"],"description":"Sending-limit errors only. How much of the allowance was already spent. Null where `limit` is."},"requested":{"type":"integer","description":"Sending-limit errors only. Recipients (or messages) this request asked for."},"remaining":{"type":["integer","null"],"description":"Sending-limit errors only. What could still go before the reset; null for the per-message recipient cap, which does not reset."},"resets_at":{"type":["string","null"],"format":"date-time","description":"Sending-limit errors only. When the allowance renews: 00:00 UTC for daily allowances; for the per-mailbox API cap, a rolling 24 hours from its first send. These errors carry no `retry_after` and are never `retryable` \u2014 retrying before `resets_at` cannot succeed."},"causes":{"type":"array","items":{"type":"string","enum":["trial","unpaid","new_payer","warmup"]},"description":"Sending-limit errors only. Why this allowance is below the plan's figure: `trial` (raised by the first payment), `unpaid` (an account whose first payment has not gone through), `new_payer` (the first 24 hours after the account's first payment; the plan's full limits then apply on their own), `warmup` (a domain in its first week)."},"shared_mailbox_id":{"type":"integer","description":"Shared mailbox refusals only. The shared mailbox the next call in `hint` uses."},"member_id":{"type":"integer","description":"Shared mailbox refusals only. The membership id for the next PATCH or DELETE \/mailboxes\/{shared_mailbox_id}\/members\/{member_id} call."},"identity_id":{"type":"integer","description":"Identity refusals only. The identity_id that was refused."},"child_count":{"type":"integer","description":"folder_has_children only. How many folders lie beneath the folder, at every depth."}},"required":["code","message","request_id","retryable"]}}},"DriveBulkRequest":{"type":"object","required":["folder_ids","file_ids"],"properties":{"folder_ids":{"type":"array","items":{"type":"integer"},"maxItems":5000,"description":"Folder ids to operate on. Empty array allowed."},"file_ids":{"type":"array","items":{"type":"integer"},"maxItems":5000,"description":"File ids to operate on. Empty array allowed."}}},"DriveDevice":{"type":"object","description":"A Drive sync-device password row. Plaintext is returned ONLY on create \/ rotate responses, never on read.","properties":{"id":{"type":"integer"},"label":{"type":"string","maxLength":64},"scopes":{"type":"array","items":{"type":"string"}},"mailbox_id":{"type":"integer","nullable":true,"description":"Null = account-wide; integer = mailbox-bound."},"created_via":{"type":"string","enum":["dashboard","webmail","api"]},"created_at":{"type":"string","format":"date-time"},"last_used_at":{"type":"string","format":"date-time","nullable":true},"last_used_ip":{"type":"string","nullable":true},"expires_at":{"type":"string","format":"date-time","nullable":true},"revoked_at":{"type":"string","format":"date-time","nullable":true},"is_active":{"type":"boolean","description":"True iff not revoked and not expired."}},"required":["id","label","scopes","mailbox_id","created_via","created_at","is_active"]},"SmtpProfileInput":{"type":"object","required":["name","host","port","encryption","username"],"properties":{"name":{"type":"string","maxLength":80},"host":{"type":"string","maxLength":255},"port":{"type":"integer","enum":[25,465,587,2525]},"encryption":{"type":"string","enum":["none","ssl","tls"]},"username":{"type":"string","maxLength":255},"password":{"type":"string","maxLength":255,"writeOnly":true,"description":"Required when creating; omit on update to preserve the stored secret."}}},"ExternalAccountConnectionInput":{"type":"object","required":["email","provider","password","imap_host","imap_port","imap_encryption","smtp_host","smtp_port","smtp_encryption"],"properties":{"email":{"type":"string","format":"email","maxLength":255},"provider":{"type":"string","enum":["gmail","yahoo","aol","icloud","outlook","zoho","gmx","yandex","fastmail","custom"]},"password":{"type":"string","maxLength":1024,"writeOnly":true},"imap_host":{"type":"string","maxLength":255},"imap_port":{"type":"integer","enum":[143,993]},"imap_encryption":{"type":"string","enum":["ssl","tls"]},"imap_username":{"type":["string","null"],"maxLength":255},"smtp_host":{"type":"string","maxLength":255},"smtp_port":{"type":"integer","enum":[465,587,2525]},"smtp_encryption":{"type":"string","enum":["ssl","tls"]},"smtp_username":{"type":["string","null"],"maxLength":255},"smtp_password":{"type":["string","null"],"maxLength":1024,"writeOnly":true,"description":"Defaults to password when omitted."},"label":{"type":["string","null"],"maxLength":255},"color":{"type":["string","null"],"maxLength":16},"include_in_unified":{"type":"boolean","default":true}}},"ExternalAccountUpdateInput":{"type":"object","description":"Every property is optional. Blank passwords preserve the stored secret. Connection changes are tested before saving.","properties":{"label":{"type":["string","null"],"maxLength":255},"color":{"type":["string","null"],"maxLength":16},"include_in_unified":{"type":"boolean"},"sort_order":{"type":"integer","minimum":0,"maximum":1000},"password":{"type":["string","null"],"maxLength":1024,"writeOnly":true},"smtp_password":{"type":["string","null"],"maxLength":1024,"writeOnly":true},"imap_host":{"type":"string","maxLength":255},"imap_port":{"type":"integer","enum":[143,993]},"imap_encryption":{"type":"string","enum":["ssl","tls"]},"imap_username":{"type":["string","null"],"maxLength":255},"smtp_host":{"type":"string","maxLength":255},"smtp_port":{"type":"integer","enum":[465,587,2525]},"smtp_encryption":{"type":"string","enum":["ssl","tls"]},"smtp_username":{"type":["string","null"],"maxLength":255}}},"MessageIdentityInput":{"type":"object","properties":{"kind":{"type":"string","enum":["managed","send_as"],"default":"managed"},"email":{"type":"string","format":"email","description":"Required on create; must be the mailbox address or an active send-enabled alias."},"name":{"type":["string","null"],"maxLength":255},"reply_to":{"type":["string","null"],"format":"email"},"signature_html":{"type":["string","null"],"maxLength":65535},"signature_enabled":{"type":"boolean"},"is_default":{"type":"boolean","description":"Managed identities only."},"external_account_id":{"type":"integer","minimum":1,"description":"Required for connected-inbox Send As creation and source-bound update."},"smtp_mode":{"type":"string","enum":["domain","profile"],"default":"domain"},"smtp_connection_id":{"type":["integer","null"],"minimum":1,"description":"Required for smtp_mode=profile. Direct profile selection is limited to the account-owner mailbox."}}},"PrivateNoteEnvelope":{"type":"object","additionalProperties":false,"required":["version","iv","ciphertext"],"properties":{"version":{"type":"integer","const":1},"iv":{"type":"string","pattern":"^[A-Za-z0-9_-]{16}$"},"ciphertext":{"type":"string","minLength":22,"maxLength":106688,"pattern":"^[A-Za-z0-9_-]+$","description":"Unpadded base64url AES-256-GCM ciphertext with its 16-byte tag: at most 80,016 bytes, which holds 20,000 characters of text."}}},"PrivateNoteCreate":{"type":"object","additionalProperties":false,"required":["envelope","policy","expires_in"],"properties":{"domain_id":{"type":"integer","minimum":1},"mailbox_id":{"type":"integer","minimum":1},"envelope":{"$ref":"#\/components\/schemas\/PrivateNoteEnvelope"},"policy":{"type":"string","enum":["once","timed"]},"expires_in":{"type":"integer","enum":[3600,86400,604800]},"confirm_open":{"type":"boolean","default":true},"notify_self":{"type":"boolean","default":false,"description":"Verified human actor only. Receipt sent to that actor, never an arbitrary address."},"reference":{"type":["string","null"],"maxLength":80,"pattern":"^[^\\r\\n]*$"},"idempotency_key":{"type":"string","maxLength":80,"pattern":"^[A-Za-z0-9_-]+$"}}},"PrivateNoteUpdate":{"type":"object","additionalProperties":false,"required":["revision"],"properties":{"domain_id":{"type":"integer","minimum":1},"mailbox_id":{"type":"integer","minimum":1},"expires_in":{"type":"integer","enum":[3600,86400,604800]},"confirm_open":{"type":"boolean","default":true},"notify_self":{"type":"boolean","default":false,"description":"Verified human actor only. Receipt sent to that actor, never an arbitrary address."},"reference":{"type":["string","null"],"maxLength":80,"pattern":"^[^\\r\\n]*$"},"revision":{"type":"integer","minimum":1}}},"PrivateNotePolicy":{"type":"object","additionalProperties":false,"properties":{"domain_id":{"type":"integer","minimum":1},"enabled":{"type":"boolean"},"receipts_enabled":{"type":"boolean"},"public_tool_enabled":{"type":"boolean","default":false},"max_expiry":{"type":"integer","enum":[3600,86400,604800]}}},"PrivateNoteMetadata":{"type":"object","properties":{"policy":{"type":"string","enum":["once","timed"]},"domain_id":{"type":"integer","minimum":1},"confirm_open":{"type":"boolean","default":true},"notify_self":{"type":"boolean","default":false,"description":"Verified human actor only. Receipt sent to that actor, never an arbitrary address."},"reference":{"type":["string","null"],"maxLength":80,"pattern":"^[^\\r\\n]*$"},"id":{"type":"string","pattern":"^[A-Za-z0-9_-]{43}$"},"expires_at":{"type":"integer","description":"Unix seconds UTC"},"revision":{"type":"integer","minimum":1},"mailbox_id":{"type":["integer","null"],"minimum":1}}}},"parameters":{"IdempotencyKey":{"name":"Idempotency-Key","in":"header","required":true,"description":"Client-supplied unique key (max 255 chars). Replays within 24h return the original response. Required by mutating endpoints; the middleware auto-rejects POST\/PUT\/PATCH\/DELETE without it on idempotent routes.","schema":{"type":"string","maxLength":255}},"DomainId":{"name":"domain","in":"path","required":true,"schema":{"type":"integer","minimum":1}},"WhiteLabelMembershipId":{"name":"membership","in":"path","required":true,"description":"Numeric membership id returned by the White Label member list.","schema":{"type":"integer","minimum":1}},"ClientLimitId":{"name":"clientLimit","in":"path","required":true,"description":"Numeric client storage limit id returned by GET \/white-label\/client-limits.","schema":{"type":"integer","minimum":1}},"BrandingLogoSlot":{"name":"slot","in":"path","required":true,"schema":{"type":"string","enum":["light","dark","favicon"]}},"SmtpConnectionId":{"name":"smtpConnection","in":"path","required":true,"schema":{"type":"integer","minimum":1}},"IdentityId":{"name":"identity","in":"path","required":true,"schema":{"type":"integer","minimum":1}},"ExternalAccountId":{"name":"externalAccount","in":"path","required":true,"schema":{"type":"integer","minimum":1}}},"responses":{"Unauthorized":{"description":"Authentication required","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"InsufficientScope":{"description":"The token is missing a required scope for this operation","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"Forbidden":{"description":"Insufficient permissions","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"NotFound":{"description":"Resource not found","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"Gone":{"description":"Resource expired or no longer available","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"Conflict":{"description":"Resource conflict","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"ValidationError":{"description":"Validation failed","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"TooManyRequests":{"description":"Rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"}}},"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}}