Repository Public
1// GENERATED FILE — do not edit. Source: docs/OPENAPI.yaml (sha256 b4adc147be840cf61e47385d3c2fae21279e7dbb8f2026551fd3e9477ab60e6c).2// Regenerate with `pnpm generate` in packages/sdk-ts; a test fails when this file is stale.3/* eslint-disable */45/** sha256 of the OpenAPI document these types were generated from. */6export const OPENAPI_SHA256 = "b4adc147be840cf61e47385d3c2fae21279e7dbb8f2026551fd3e9477ab60e6c"7/** `info.version` of the OpenAPI document. */8export const OPENAPI_VERSION = "1.0.0"910/** Error envelope of every non-2xx answer. */11export interface ErrorBody {12 error: { code: string; message: string; details?: unknown }13}1415export interface EmailAddress {16 email: string17 name: string | null18}1920export type Recipient = string | {21 email: string22 name?: string23}2425export interface AttachmentRef {26 file_id: string27 filename?: string28 /** Inline image referenced from the HTML as cid:<cid> */29 inline?: boolean30 cid?: string31}3233export interface FolderRef {34 id: string35 role: string | null36 name: string37}3839export interface Attachment {40 id: string41 name: string | null42 type: string43 size: number44 cid: string | null45 disposition: string | null46 inline: boolean47}4849export interface MessageAuth {50 spf: string | null51 dkim: string | null52 dmarc: string | null53 raw: string | null54}5556export interface MessageSummary {57 id: string58 thread_id: string59 /** Primary address of the physical mailbox holding the message */60 mailbox: string61 /** Envelope recipients recorded by the mail server (Delivered-To) */62 delivered_to: string[]63 folders: FolderRef[]64 from: EmailAddress[]65 to: EmailAddress[]66 cc: EmailAddress[]67 subject: string68 preview: string69 received_at: string70 sent_at: string | null71 size: number72 unread: boolean73 starred: boolean74 draft: boolean75 answered: boolean76 forwarded: boolean77 has_attachment: boolean78 labels: string[]79 /** Pinned to the top of its lists (`$pinned` keyword) */80 pinned: boolean81 /** Currently snoozed (`$snoozed` keyword); it returns to the inbox when the snooze ends */82 snoozed: boolean83 /** A follow-up reminder is set on the message (`$followup` keyword) */84 followup: boolean85}8687export interface Message {88 id: string89 thread_id: string90 /** Primary address of the physical mailbox holding the message */91 mailbox: string92 /** Envelope recipients recorded by the mail server (Delivered-To) */93 delivered_to: string[]94 folders: FolderRef[]95 from: EmailAddress[]96 to: EmailAddress[]97 cc: EmailAddress[]98 subject: string99 preview: string100 received_at: string101 sent_at: string | null102 size: number103 unread: boolean104 starred: boolean105 draft: boolean106 answered: boolean107 forwarded: boolean108 has_attachment: boolean109 labels: string[]110 /** Pinned to the top of its lists (`$pinned` keyword) */111 pinned: boolean112 /** Currently snoozed (`$snoozed` keyword); it returns to the inbox when the snooze ends */113 snoozed: boolean114 /** A follow-up reminder is set on the message (`$followup` keyword) */115 followup: boolean116 bcc: EmailAddress[]117 reply_to: EmailAddress[]118 message_id: string | null119 in_reply_to: string[]120 references: string[]121 headers: {122 name: string123 value: string124 }[]125 text: string | null126 /** Sanitised server-side (strict allowlist); remote images are NOT fetched or rewritten */127 html: string | null128 truncated: boolean129 attachments: Attachment[]130 auth: MessageAuth131}132133export interface MessageUpdateParams {134 unread?: boolean135 starred?: boolean136 add_labels?: string[]137 remove_labels?: string[]138}139140export interface Thread {141 id: string142 mailbox: string143 messages: MessageSummary[]144}145146export interface ThreadSummary {147 id: string148 mailbox: string149 latest: MessageSummary150}151152export interface Changes {153 mailbox: string154 state: string155 created: string[]156 updated: string[]157 destroyed: string[]158 has_more: boolean159}160161export interface Folder {162 id: string163 mailbox: string164 name: string165 role: string | null166 parent_id: string | null167 total: number | null168 unread: number | null169}170171export interface FolderCreateParams {172 /** Primary address of the mailbox */173 address: string174 name: string175 parent_id?: string176}177178export type OutboundStatus = "queued" | "scheduled" | "pending_approval" | "sent" | "delivered" | "deferred" | "bounced" | "failed" | "cancelled" | "draft"179180export interface OutboundRecipient {181 address: string182 status: string183 smtp_reply: string | null184}185186export interface OutboundMessage {187 /** msg_out_… (or the draft's msg_… id when status is draft) */188 id: string189 status: OutboundStatus190 from: string191 message_id: string | null192 recipients: OutboundRecipient[]193 external: boolean194 send_at: string | null195 attempts: number196 last_error: string | null197 submitted_at: string | null198 final_at: string | null199 created_at: string200 updated_at: string201 approval_id?: string202 thread_id?: string | null203 /** Undo send: the message is held until this instant and can still be cancelled */204 undo_until?: string | null205}206207export interface SendParams {208 /** Sender address; must be in the caller's allowlist, active and allowed to send */209 from: string210 to?: Recipient[]211 cc?: Recipient[]212 bcc?: Recipient[]213 subject?: string214 text?: string215 /** Sanitised server-side with a strict allowlist before being stored or sent */216 html?: string217 attachments?: AttachmentRef[]218 /** Message (msg_…) being answered: sets In-Reply-To / References from it */219 reply_to_message_id?: string220 in_reply_to?: string221 references?: string[]222 /** Only X-*, Reply-To, List-Unsubscribe, List-Unsubscribe-Post */223 headers?: {224 [key: string]: string225 }226 priority?: "high" | "normal" | "low"227 /** ISO 8601; future = scheduled (max 30 days ahead) */228 send_at?: string229 /** Save as a draft only; nothing is sent */230 draft?: boolean231 /** Send a stored template (see /templates): its rendered subject, HTML and text are used; `html` and `text` must then be omitted, `subject` is optional and overrides the template's */232 template_id?: string233 /** Values for the template's {{variables}}; every required variable must be present */234 variables?: {235 [key: string]: string236 }237 /** Undo send: hold the message this many seconds before it is submitted (status `scheduled`, response carries `undo_until`); cancel with DELETE /messages/scheduled/{id}. Ignored with a future `send_at`, `draft`, or when the message awaits approval */238 undo_seconds?: number239 /** ISO 8601; creates a follow-up reminder on the sent message once it has been submitted (session callers only) */240 remind_at?: string241 /** With `remind_at`: the reminder resolves silently if somebody replied in the meantime */242 remind_if_no_reply?: boolean243 /** Session callers: confirms sending to recipients listed as sensitive in the compose preferences (otherwise `409 confirmation_required`) */244 confirm_sensitive?: boolean245}246247export interface ReplyParams {248 /** Defaults to the allowed address the message was delivered to, else the mailbox's primary address */249 from?: string250 reply_all?: boolean251 text?: string252 html?: string253 cc?: Recipient[]254 bcc?: Recipient[]255 attachments?: AttachmentRef[]256 headers?: {257 [key: string]: string258 }259 send_at?: string260 draft?: boolean261 /** Undo send: hold the message this many seconds before it is submitted (status `scheduled`, response carries `undo_until`); cancel with DELETE /messages/scheduled/{id}. Ignored with a future `send_at`, `draft`, or when the message awaits approval */262 undo_seconds?: number263 /** ISO 8601; creates a follow-up reminder on the sent message once it has been submitted (session callers only) */264 remind_at?: string265 /** With `remind_at`: the reminder resolves silently if somebody replied in the meantime */266 remind_if_no_reply?: boolean267 /** Session callers: confirms sending to recipients listed as sensitive in the compose preferences (otherwise `409 confirmation_required`) */268 confirm_sensitive?: boolean269}270271export interface ForwardParams {272 from?: string273 to: Recipient[]274 cc?: Recipient[]275 bcc?: Recipient[]276 text?: string277 include_attachments?: boolean278 send_at?: string279 draft?: boolean280 /** Undo send: hold the message this many seconds before it is submitted (status `scheduled`, response carries `undo_until`); cancel with DELETE /messages/scheduled/{id}. Ignored with a future `send_at`, `draft`, or when the message awaits approval */281 undo_seconds?: number282 /** ISO 8601; creates a follow-up reminder on the sent message once it has been submitted (session callers only) */283 remind_at?: string284 /** With `remind_at`: the reminder resolves silently if somebody replied in the meantime */285 remind_if_no_reply?: boolean286 /** Session callers: confirms sending to recipients listed as sensitive in the compose preferences (otherwise `409 confirmation_required`) */287 confirm_sensitive?: boolean288}289290export interface BatchResult {291 results: {292 index: number293 ok: boolean294 status: number295 message?: OutboundMessage296 error?: {297 code: string298 message: string299 details?: unknown300 }301 }[]302}303304export interface DraftCreateParams {305 from: string306 to?: Recipient[]307 cc?: Recipient[]308 bcc?: Recipient[]309 subject?: string310 text?: string311 /** Sanitised server-side with a strict allowlist before being stored or sent */312 html?: string313 attachments?: AttachmentRef[]314 /** Message (msg_…) being answered: sets In-Reply-To / References from it */315 reply_to_message_id?: string316 in_reply_to?: string317 references?: string[]318 /** Only X-*, Reply-To, List-Unsubscribe, List-Unsubscribe-Post */319 headers?: {320 [key: string]: string321 }322 priority?: "high" | "normal" | "low"323}324325export interface DraftUpdateParams {326 /** Sender address; must be in the caller's allowlist, active and allowed to send */327 from?: string328 to?: Recipient[]329 cc?: Recipient[]330 bcc?: Recipient[]331 subject?: string332 text?: string333 /** Sanitised server-side with a strict allowlist before being stored or sent */334 html?: string335 attachments?: AttachmentRef[]336 /** Message (msg_…) being answered: sets In-Reply-To / References from it */337 reply_to_message_id?: string338 in_reply_to?: string339 references?: string[]340 /** Only X-*, Reply-To, List-Unsubscribe, List-Unsubscribe-Post */341 headers?: {342 [key: string]: string343 }344 priority?: "high" | "normal" | "low"345}346347export interface UploadedFile {348 id: string349 name: string350 type: string351 size: number352 mailbox: string353 expires_at: string354}355356export type AddressKind = "mailbox" | "alias" | "shared" | "notification" | "send_only" | "receive_only" | "temporary"357358export interface Address {359 id: string360 address: string361 kind: AddressKind362 /** Primary address of the physical mailbox that stores and sends for this address */363 mailbox: string | null364 mailbox_id: string365 display_name: string366 signature_text: string367 signature_html: string368 avatar: string | null369 can_send: boolean370 can_receive: boolean371 status: "active" | "suspended"372 suspended_reason: string | null373 expired: boolean374 expires_at: string | null375 retention_days: number | null376 retention_trash_days: number | null377 retention_junk_days: number | null378 quota_bytes: number | null379 reply_policy: "reject" | "accept" | "discard"380 protected: boolean381 extra_destinations: string[]382 /** What the mail server currently does with mail for this address */383 inbound: "accept" | "reject" | "discard"384 created_at: string385 updated_at: string386}387388export interface AddressCreateParams {389 display_name?: string390 signature_text?: string391 signature_html?: string392 avatar?: string | null393 can_send?: boolean394 can_receive?: boolean395 status?: "active" | "suspended"396 expires_at?: string | null397 retention_days?: number | null398 retention_trash_days?: number | null399 retention_junk_days?: number | null400 quota_bytes?: number | null401 reply_policy?: "reject" | "accept" | "discard"402 extra_destinations?: string[]403 kind?: AddressKind404 protected?: boolean405 address: string406 /** Alias kinds: primary address (or address id) of the mailbox that will store/send for it */407 mailbox?: string408 /** Mailbox kinds: owner user (defaults to the admin who owns the key or session) */409 user_id?: string410}411412export interface AddressUpdateParams {413 display_name?: string414 signature_text?: string415 signature_html?: string416 avatar?: string | null417 can_send?: boolean418 can_receive?: boolean419 status?: "active" | "suspended"420 expires_at?: string | null421 retention_days?: number | null422 retention_trash_days?: number | null423 retention_junk_days?: number | null424 quota_bytes?: number | null425 reply_policy?: "reject" | "accept" | "discard"426 extra_destinations?: string[]427 kind?: AddressKind428 protected?: boolean429}430431export interface Automation {432 managed: boolean433 active: boolean434 rules: unknown[]435 vacation: unknown436 forward: {437 to: unknown438 keep_copy: boolean439 } | null440 raw_sieve?: string441}442443export interface AutomationUpdateParams {444 rules?: ({445 id: string446 name?: string447 enabled?: boolean448 match?: "all" | "any"449 conditions: {450 field: "from" | "to" | "subject"451 op: "contains" | "is"452 value: string453 }[]454 actions: ({455 type: "move"456 folder: string457 } | {458 type: "markRead"459 } | {460 type: "flag"461 } | {462 type: "trash"463 })[]464 })[]465 vacation?: {466 enabled?: boolean467 subject?: string468 text?: string469 from?: string | null470 to?: string | null471 days?: number472 }473 forward?: {474 to: string475 keep_copy?: boolean476 } | null477 raw_sieve?: string478}479480export type WebhookEventType = "message.received" | "message.sent" | "message.delivered" | "message.deferred" | "message.bounced" | "message.failed" | "message.read" | "message.deleted" | "draft.created" | "address.created" | "address.suspended" | "rule.matched"481482export interface Webhook {483 id: string484 name: string485 url: string486 events: string[]487 address_ids: string[]488 include_content: boolean489 active: boolean490 owner: "key" | "admin"491 key_id: string | null492 created_at: string493 updated_at: string494 /** Only present at creation and after a secret rotation; never shown again */495 secret?: string496}497498export interface WebhookCreateParams {499 name: string500 url: string501 events: WebhookEventType[]502 address_ids?: string[]503 include_content?: boolean504 active?: boolean505}506507export interface WebhookUpdateParams {508 name?: string509 url?: string510 events?: WebhookEventType[]511 address_ids?: string[]512 include_content?: boolean513 active?: boolean514 rotate_secret?: boolean515}516517export interface WebhookDelivery {518 id: string519 webhook_id: string520 event_id: string521 event_type: string522 status: "pending" | "retrying" | "delivered" | "failed"523 attempt: number524 next_attempt_at: string | null525 last_status: number | null526 last_error: string | null527 delivered_at: string | null528 created_at: string529}530531export interface WebhookTestResult {532 delivery: WebhookDelivery533 http_status: number | null534 error: string | null535}536537export interface Event {538 id: string539 type: string540 occurred_at: string541 address: string | null542 mailbox: string | null543 data: {544 [key: string]: unknown545 }546}547548export interface TemplateVariable {549 name: string550 description: string551 example: string552 required: boolean553}554555export interface TemplateSummary {556 id: string557 name: string558 category: string559 subject: string560 preheader: string561 variables: TemplateVariable[]562 source: "manual" | "ai"563 version: number564 size_bytes: number565 created_at: string566 updated_at: string567}568569export interface Template {570 id: string571 name: string572 category: string573 subject: string574 preheader: string575 variables: TemplateVariable[]576 source: "manual" | "ai"577 version: number578 size_bytes: number579 created_at: string580 updated_at: string581 html: string582 text: string583}584585export interface TemplateRenderParams {586 variables?: {587 [key: string]: string588 }589 use_examples?: boolean590}591592export interface RenderedTemplate {593 subject: string594 preheader: string595 html: string596 text: string597 missing: string[]598}599600export interface MeAddress {601 id: string602 address: string603 kind: string604 mailbox: string605 status: string606 can_send: boolean607 can_receive: boolean608 read: "full" | "restricted" | "none"609}610611export interface Me {612 type: "key" | "user"613 id: string614 name: string615 explorer: boolean616 scopes: string[]617 all_addresses: boolean618 addresses: MeAddress[]619 limits: {620 rate_per_minute: number | null621 daily_send_limit: number | null622 external_send_policy: string623 allowed_recipient_domains: string[]624 }625 usage_today: {626 sent: number627 requests: number628 }629 version: string630}631632export interface Health {633 ok: boolean634 version: string635 database: "ok" | "down"636 mail_server: "reachable" | "unreachable"637 workers: "on" | "off"638}639640/** Every operation of the API: path/query parameters, request body and the body of each 2xx answer. */641export interface Operations {642 /** GET /addresses — Addresses visible to the caller */643 getAddresses: {644 method: "GET"645 path: "/addresses"646 params: Record<string, never>647 query: {648 kind?: AddressKind649 mailbox?: string650 status?: "active" | "suspended"651 }652 body: undefined653 responses: {654 200: {655 data: Address[]656 }657 }658 }659 /** POST /addresses — Create an address (alias kinds, or a new physical mailbox) */660 postAddresses: {661 method: "POST"662 path: "/addresses"663 params: Record<string, never>664 query: Record<string, never>665 body: AddressCreateParams666 responses: {667 201: Address668 }669 }670 /** DELETE /addresses/{id} — Delete an alias, or detach / purge a mailbox */671 deleteAddressesId: {672 method: "DELETE"673 path: "/addresses/{id}"674 params: {675 id: string676 }677 query: {678 purge?: "delete-all-mail"679 }680 body: {681 confirm?: string682 }683 responses: {684 200: {685 ok: true686 purged: boolean687 }688 }689 }690 /** GET /addresses/{id} — Read one address */691 getAddressesId: {692 method: "GET"693 path: "/addresses/{id}"694 params: {695 id: string696 }697 query: Record<string, never>698 body: undefined699 responses: {700 200: Address701 }702 }703 /** PATCH /addresses/{id} — Update an address (display, signatures, send/receive, suspension, expiry, quota, retention…) */704 patchAddressesId: {705 method: "PATCH"706 path: "/addresses/{id}"707 params: {708 id: string709 }710 query: Record<string, never>711 body: AddressUpdateParams712 responses: {713 200: Address714 }715 }716 /** GET /addresses/{id}/automation — Filters, auto-reply and forwarding of a mailbox */717 getAddressesIdAutomation: {718 method: "GET"719 path: "/addresses/{id}/automation"720 params: {721 id: string722 }723 query: Record<string, never>724 body: undefined725 responses: {726 200: Automation727 }728 }729 /** PUT /addresses/{id}/automation — Replace filters / auto-reply / forwarding of a mailbox */730 putAddressesIdAutomation: {731 method: "PUT"732 path: "/addresses/{id}/automation"733 params: {734 id: string735 }736 query: Record<string, never>737 body: AutomationUpdateParams738 responses: {739 200: Automation740 }741 }742 /** GET /aliases — Alias-type addresses visible to the caller */743 getAliases: {744 method: "GET"745 path: "/aliases"746 params: Record<string, never>747 query: {748 kind?: AddressKind749 mailbox?: string750 status?: "active" | "suspended"751 }752 body: undefined753 responses: {754 200: {755 data: Address[]756 }757 }758 }759 /** POST /aliases — Create an alias on a mailbox */760 postAliases: {761 method: "POST"762 path: "/aliases"763 params: Record<string, never>764 query: Record<string, never>765 body: {766 display_name?: string767 signature_text?: string768 signature_html?: string769 avatar?: string | null770 can_send?: boolean771 can_receive?: boolean772 status?: "active" | "suspended"773 expires_at?: string | null774 retention_days?: number | null775 retention_trash_days?: number | null776 retention_junk_days?: number | null777 quota_bytes?: number | null778 reply_policy?: "reject" | "accept" | "discard"779 extra_destinations?: string[]780 kind?: "alias" | "notification" | "send_only" | "receive_only" | "temporary"781 protected?: boolean782 address: string783 /** Alias kinds: primary address (or address id) of the mailbox that will store/send for it */784 mailbox?: string785 /** Mailbox kinds: owner user (defaults to the admin who owns the key or session) */786 user_id?: string787 }788 responses: {789 201: Address790 }791 }792 /** DELETE /aliases/{id} — Delete an alias */793 deleteAliasesId: {794 method: "DELETE"795 path: "/aliases/{id}"796 params: {797 id: string798 }799 query: Record<string, never>800 body: undefined801 responses: {802 200: {803 ok: true804 purged: boolean805 }806 }807 }808 /** PATCH /aliases/{id} — Update an alias (destinations, signature, sendable, disable, expiry) */809 patchAliasesId: {810 method: "PATCH"811 path: "/aliases/{id}"812 params: {813 id: string814 }815 query: Record<string, never>816 body: AddressUpdateParams817 responses: {818 200: Address819 }820 }821 /** GET /drafts — List drafts */822 getDrafts: {823 method: "GET"824 path: "/drafts"825 params: Record<string, never>826 query: {827 address?: string828 limit?: number829 cursor?: string830 }831 body: undefined832 responses: {833 200: {834 data: MessageSummary[]835 next_cursor: string | null836 has_more: boolean837 }838 }839 }840 /** POST /drafts — Create a draft */841 postDrafts: {842 method: "POST"843 path: "/drafts"844 params: Record<string, never>845 query: Record<string, never>846 body: DraftCreateParams847 responses: {848 201: OutboundMessage849 }850 }851 /** DELETE /drafts/{id} — Discard a draft (destroyed, not moved to trash) */852 deleteDraftsId: {853 method: "DELETE"854 path: "/drafts/{id}"855 params: {856 id: string857 }858 query: Record<string, never>859 body: undefined860 responses: {861 200: {862 ok: true863 }864 }865 }866 /** GET /drafts/{id} — Read a draft */867 getDraftsId: {868 method: "GET"869 path: "/drafts/{id}"870 params: {871 id: string872 }873 query: Record<string, never>874 body: undefined875 responses: {876 200: Message877 }878 }879 /** PATCH /drafts/{id} — Replace fields of a draft */880 patchDraftsId: {881 method: "PATCH"882 path: "/drafts/{id}"883 params: {884 id: string885 }886 query: Record<string, never>887 body: DraftUpdateParams888 responses: {889 200: OutboundMessage890 }891 }892 /** POST /drafts/{id}/send — Send an existing draft */893 postDraftsIdSend: {894 method: "POST"895 path: "/drafts/{id}/send"896 params: {897 id: string898 }899 query: Record<string, never>900 body: {901 send_at?: string902 }903 responses: {904 200: OutboundMessage905 202: OutboundMessage906 }907 }908 /** GET /events — Recent events visible to the caller (metadata only, newest first) */909 getEvents: {910 method: "GET"911 path: "/events"912 params: Record<string, never>913 query: {914 type?: WebhookEventType915 limit?: number916 cursor?: string917 }918 body: undefined919 responses: {920 200: {921 data: Event[]922 next_cursor: string | null923 has_more: boolean924 }925 }926 }927 /** POST /files — Upload a file to attach later (raw body) */928 postFiles: {929 method: "POST"930 path: "/files"931 params: Record<string, never>932 query: {933 filename?: string934 address?: string935 }936 body: Uint8Array937 responses: {938 201: UploadedFile939 }940 }941 /** GET /folders — Folders of the readable mailboxes */942 getFolders: {943 method: "GET"944 path: "/folders"945 params: Record<string, never>946 query: {947 address?: string948 }949 body: undefined950 responses: {951 200: {952 data: Folder[]953 }954 }955 }956 /** POST /folders — Create a folder in a mailbox */957 postFolders: {958 method: "POST"959 path: "/folders"960 params: Record<string, never>961 query: Record<string, never>962 body: FolderCreateParams963 responses: {964 201: Folder965 }966 }967 /** GET /health — Liveness of the API, database and mail server */968 getHealth: {969 method: "GET"970 path: "/health"971 params: Record<string, never>972 query: Record<string, never>973 body: undefined974 responses: {975 200: Health976 }977 }978 /** GET /me — Who am I: scopes, allowed addresses, limits, usage today */979 getMe: {980 method: "GET"981 path: "/me"982 params: Record<string, never>983 query: Record<string, never>984 body: undefined985 responses: {986 200: Me987 }988 }989 /** GET /messages — List / search messages (unified across mailboxes) */990 getMessages: {991 method: "GET"992 path: "/messages"993 params: Record<string, never>994 query: {995 address?: string996 mailbox?: string997 folder?: string998 unread?: "true" | "false"999 flagged?: "true" | "false"1000 has_attachment?: "true" | "false"1001 from?: string1002 to?: string1003 subject?: string1004 text?: string1005 before?: string1006 after?: string1007 label?: string1008 limit?: number1009 cursor?: string1010 }1011 body: undefined1012 responses: {1013 200: {1014 data: MessageSummary[]1015 next_cursor: string | null1016 has_more: boolean1017 }1018 }1019 }1020 /** DELETE /messages/{id} — Move to trash, or delete permanently with explicit confirmation */1021 deleteMessagesId: {1022 method: "DELETE"1023 path: "/messages/{id}"1024 params: {1025 id: string1026 }1027 query: {1028 permanent?: "true" | "false"1029 }1030 body: {1031 confirm?: string1032 }1033 responses: {1034 200: {1035 ok: true1036 permanent: boolean1037 }1038 }1039 }1040 /** GET /messages/{id} — Read one message (headers, text, sanitised HTML, attachment metadata) */1041 getMessagesId: {1042 method: "GET"1043 path: "/messages/{id}"1044 params: {1045 id: string1046 }1047 query: Record<string, never>1048 body: undefined1049 responses: {1050 200: Message1051 }1052 }1053 /** PATCH /messages/{id} — Mark read/unread, star, add or remove labels */1054 patchMessagesId: {1055 method: "PATCH"1056 path: "/messages/{id}"1057 params: {1058 id: string1059 }1060 query: Record<string, never>1061 body: MessageUpdateParams1062 responses: {1063 200: MessageSummary1064 }1065 }1066 /** GET /messages/{id}/attachments — Attachment metadata of a message */1067 getMessagesIdAttachments: {1068 method: "GET"1069 path: "/messages/{id}/attachments"1070 params: {1071 id: string1072 }1073 query: Record<string, never>1074 body: undefined1075 responses: {1076 200: {1077 data: Attachment[]1078 }1079 }1080 }1081 /** GET /messages/{id}/attachments/{attachment_id} — Download one attachment */1082 getMessagesIdAttachmentsAttachment_id: {1083 method: "GET"1084 path: "/messages/{id}/attachments/{attachment_id}"1085 params: {1086 id: string1087 attachment_id: string1088 }1089 query: Record<string, never>1090 body: undefined1091 responses: {1092 200: Uint8Array1093 }1094 }1095 /** POST /messages/{id}/forward — Forward a message, keeping its attachments */1096 postMessagesIdForward: {1097 method: "POST"1098 path: "/messages/{id}/forward"1099 params: {1100 id: string1101 }1102 query: Record<string, never>1103 body: ForwardParams1104 responses: {1105 200: OutboundMessage1106 201: OutboundMessage1107 202: OutboundMessage1108 }1109 }1110 /** POST /messages/{id}/move — Move to a folder (archive, trash, inbox = restore, or a folder id) */1111 postMessagesIdMove: {1112 method: "POST"1113 path: "/messages/{id}/move"1114 params: {1115 id: string1116 }1117 query: Record<string, never>1118 body: {1119 folder: string1120 }1121 responses: {1122 200: MessageSummary1123 }1124 }1125 /** POST /messages/{id}/reply — Reply (or reply-all) to a message, keeping the thread */1126 postMessagesIdReply: {1127 method: "POST"1128 path: "/messages/{id}/reply"1129 params: {1130 id: string1131 }1132 query: Record<string, never>1133 body: ReplyParams1134 responses: {1135 200: OutboundMessage1136 201: OutboundMessage1137 202: OutboundMessage1138 }1139 }1140 /** GET /messages/changes — Incremental sync of one mailbox (JMAP Email/changes) */1141 getMessagesChanges: {1142 method: "GET"1143 path: "/messages/changes"1144 params: Record<string, never>1145 query: {1146 address?: string1147 since?: string1148 limit?: number1149 }1150 body: undefined1151 responses: {1152 200: Changes1153 }1154 }1155 /** GET /messages/outbound — Messages sent through the API by this caller, with delivery status */1156 getMessagesOutbound: {1157 method: "GET"1158 path: "/messages/outbound"1159 params: Record<string, never>1160 query: {1161 status?: "queued" | "scheduled" | "pending_approval" | "sent" | "delivered" | "deferred" | "bounced" | "failed" | "cancelled"1162 limit?: number1163 cursor?: string1164 }1165 body: undefined1166 responses: {1167 200: {1168 data: OutboundMessage[]1169 next_cursor: string | null1170 has_more: boolean1171 }1172 }1173 }1174 /** GET /messages/outbound/{id} — Delivery status of one sent message (per recipient, with SMTP replies) */1175 getMessagesOutboundId: {1176 method: "GET"1177 path: "/messages/outbound/{id}"1178 params: {1179 id: string1180 }1181 query: Record<string, never>1182 body: undefined1183 responses: {1184 200: OutboundMessage1185 }1186 }1187 /** GET /messages/scheduled — Scheduled messages not yet sent */1188 getMessagesScheduled: {1189 method: "GET"1190 path: "/messages/scheduled"1191 params: Record<string, never>1192 query: {1193 limit?: number1194 cursor?: string1195 }1196 body: undefined1197 responses: {1198 200: {1199 data: OutboundMessage[]1200 next_cursor: string | null1201 has_more: boolean1202 }1203 }1204 }1205 /** DELETE /messages/scheduled/{id} — Cancel a scheduled message (nothing is sent, the stored draft is destroyed) */1206 deleteMessagesScheduledId: {1207 method: "DELETE"1208 path: "/messages/scheduled/{id}"1209 params: {1210 id: string1211 }1212 query: Record<string, never>1213 body: undefined1214 responses: {1215 200: OutboundMessage1216 }1217 }1218 /** POST /messages/send — Send a message (or schedule it, or save it as a draft) */1219 postMessagesSend: {1220 method: "POST"1221 path: "/messages/send"1222 params: Record<string, never>1223 query: Record<string, never>1224 body: SendParams1225 responses: {1226 200: OutboundMessage1227 201: OutboundMessage1228 202: OutboundMessage1229 }1230 }1231 /** POST /messages/send-batch — Send up to 50 messages; each item is validated and limited independently */1232 postMessagesSendBatch: {1233 method: "POST"1234 path: "/messages/send-batch"1235 params: Record<string, never>1236 query: Record<string, never>1237 body: {1238 messages: unknown[]1239 }1240 responses: {1241 200: BatchResult1242 }1243 }1244 /** GET /openapi.json — OpenAPI 3.1 description (JSON), generated from the route registry */1245 "getOpenapi.json": {1246 method: "GET"1247 path: "/openapi.json"1248 params: Record<string, never>1249 query: Record<string, never>1250 body: undefined1251 responses: {1252 200: {1253 [key: string]: unknown1254 }1255 }1256 }1257 /** GET /openapi.yaml — OpenAPI 3.1 description (YAML) */1258 "getOpenapi.yaml": {1259 method: "GET"1260 path: "/openapi.yaml"1261 params: Record<string, never>1262 query: Record<string, never>1263 body: undefined1264 responses: {1265 200: Uint8Array1266 }1267 }1268 /** GET /templates — List the templates of the caller's library */1269 getTemplates: {1270 method: "GET"1271 path: "/templates"1272 params: Record<string, never>1273 query: Record<string, never>1274 body: undefined1275 responses: {1276 200: {1277 templates: TemplateSummary[]1278 }1279 }1280 }1281 /** GET /templates/{id} — Get a template with its HTML and plain text */1282 getTemplatesId: {1283 method: "GET"1284 path: "/templates/{id}"1285 params: {1286 id: string1287 }1288 query: Record<string, never>1289 body: undefined1290 responses: {1291 200: Template1292 }1293 }1294 /** POST /templates/{id}/render — Render a template with variable values, without sending */1295 postTemplatesIdRender: {1296 method: "POST"1297 path: "/templates/{id}/render"1298 params: {1299 id: string1300 }1301 query: Record<string, never>1302 body: TemplateRenderParams1303 responses: {1304 200: RenderedTemplate1305 }1306 }1307 /** GET /threads — List conversations (one entry per thread, newest message first) */1308 getThreads: {1309 method: "GET"1310 path: "/threads"1311 params: Record<string, never>1312 query: {1313 address?: string1314 mailbox?: string1315 folder?: string1316 unread?: "true" | "false"1317 flagged?: "true" | "false"1318 has_attachment?: "true" | "false"1319 from?: string1320 to?: string1321 subject?: string1322 text?: string1323 before?: string1324 after?: string1325 label?: string1326 limit?: number1327 cursor?: string1328 }1329 body: undefined1330 responses: {1331 200: {1332 data: ThreadSummary[]1333 next_cursor: string | null1334 has_more: boolean1335 }1336 }1337 }1338 /** GET /threads/{id} — Messages of a conversation, oldest first */1339 getThreadsId: {1340 method: "GET"1341 path: "/threads/{id}"1342 params: {1343 id: string1344 }1345 query: Record<string, never>1346 body: undefined1347 responses: {1348 200: Thread1349 }1350 }1351 /** POST /webhook-deliveries/{id}/replay — Replay a delivery (same event id, new signature and timestamp) */1352 postWebhookDeliveriesIdReplay: {1353 method: "POST"1354 path: "/webhook-deliveries/{id}/replay"1355 params: {1356 id: string1357 }1358 query: Record<string, never>1359 body: undefined1360 responses: {1361 200: WebhookDelivery1362 }1363 }1364 /** GET /webhooks — List webhooks */1365 getWebhooks: {1366 method: "GET"1367 path: "/webhooks"1368 params: Record<string, never>1369 query: Record<string, never>1370 body: undefined1371 responses: {1372 200: {1373 data: Webhook[]1374 }1375 }1376 }1377 /** POST /webhooks — Create a webhook (the signing secret is returned once) */1378 postWebhooks: {1379 method: "POST"1380 path: "/webhooks"1381 params: Record<string, never>1382 query: Record<string, never>1383 body: WebhookCreateParams1384 responses: {1385 201: Webhook1386 }1387 }1388 /** DELETE /webhooks/{id} — Delete a webhook and its delivery history */1389 deleteWebhooksId: {1390 method: "DELETE"1391 path: "/webhooks/{id}"1392 params: {1393 id: string1394 }1395 query: Record<string, never>1396 body: undefined1397 responses: {1398 200: {1399 ok: true1400 }1401 }1402 }1403 /** GET /webhooks/{id} — Read a webhook */1404 getWebhooksId: {1405 method: "GET"1406 path: "/webhooks/{id}"1407 params: {1408 id: string1409 }1410 query: Record<string, never>1411 body: undefined1412 responses: {1413 200: Webhook1414 }1415 }1416 /** PATCH /webhooks/{id} — Update a webhook, or rotate its secret */1417 patchWebhooksId: {1418 method: "PATCH"1419 path: "/webhooks/{id}"1420 params: {1421 id: string1422 }1423 query: Record<string, never>1424 body: WebhookUpdateParams1425 responses: {1426 200: Webhook1427 }1428 }1429 /** GET /webhooks/{id}/deliveries — Delivery attempts of a webhook, newest first */1430 getWebhooksIdDeliveries: {1431 method: "GET"1432 path: "/webhooks/{id}/deliveries"1433 params: {1434 id: string1435 }1436 query: {1437 status?: "pending" | "retrying" | "delivered" | "failed"1438 limit?: number1439 cursor?: string1440 }1441 body: undefined1442 responses: {1443 200: {1444 data: WebhookDelivery[]1445 next_cursor: string | null1446 has_more: boolean1447 }1448 }1449 }1450 /** POST /webhooks/{id}/test — Send a signed `webhook.test` event to this webhook now */1451 postWebhooksIdTest: {1452 method: "POST"1453 path: "/webhooks/{id}/test"1454 params: {1455 id: string1456 }1457 query: Record<string, never>1458 body: undefined1459 responses: {1460 200: WebhookTestResult1461 }1462 }1463}14641465/** Scopes accepted by each operation (`x-required-scopes`; any one of them, see docs/API.md §3 for the finer rules). */1466export const OPERATION_SCOPES = {1467 "getAddresses": [1468 "mail.addresses.read"1469 ],1470 "postAddresses": [1471 "mail.addresses.manage",1472 "mail.aliases.manage"1473 ],1474 "deleteAddressesId": [1475 "mail.addresses.manage",1476 "mail.aliases.manage"1477 ],1478 "getAddressesId": [1479 "mail.addresses.read"1480 ],1481 "patchAddressesId": [1482 "mail.addresses.manage",1483 "mail.aliases.manage"1484 ],1485 "getAddressesIdAutomation": [1486 "mail.addresses.read"1487 ],1488 "putAddressesIdAutomation": [1489 "mail.addresses.manage"1490 ],1491 "getAliases": [1492 "mail.addresses.read"1493 ],1494 "postAliases": [1495 "mail.aliases.manage",1496 "mail.addresses.manage"1497 ],1498 "deleteAliasesId": [1499 "mail.aliases.manage",1500 "mail.addresses.manage"1501 ],1502 "patchAliasesId": [1503 "mail.aliases.manage",1504 "mail.addresses.manage"1505 ],1506 "getDrafts": [1507 "mail.drafts"1508 ],1509 "postDrafts": [1510 "mail.drafts"1511 ],1512 "deleteDraftsId": [1513 "mail.drafts"1514 ],1515 "getDraftsId": [1516 "mail.drafts"1517 ],1518 "patchDraftsId": [1519 "mail.drafts"1520 ],1521 "postDraftsIdSend": [1522 "mail.send"1523 ],1524 "getEvents": [1525 "mail.read",1526 "mail.webhooks.manage",1527 "mail.send"1528 ],1529 "postFiles": [1530 "mail.attachments.write"1531 ],1532 "getFolders": [1533 "mail.read"1534 ],1535 "postFolders": [1536 "mail.modify"1537 ],1538 "getHealth": [],1539 "getMe": [],1540 "getMessages": [1541 "mail.read",1542 "mail.search"1543 ],1544 "deleteMessagesId": [1545 "mail.modify",1546 "mail.delete"1547 ],1548 "getMessagesId": [1549 "mail.read"1550 ],1551 "patchMessagesId": [1552 "mail.modify"1553 ],1554 "getMessagesIdAttachments": [1555 "mail.attachments.read"1556 ],1557 "getMessagesIdAttachmentsAttachment_id": [1558 "mail.attachments.read"1559 ],1560 "postMessagesIdForward": [1561 "mail.send"1562 ],1563 "postMessagesIdMove": [1564 "mail.modify"1565 ],1566 "postMessagesIdReply": [1567 "mail.send"1568 ],1569 "getMessagesChanges": [1570 "mail.read"1571 ],1572 "getMessagesOutbound": [1573 "mail.send",1574 "mail.read"1575 ],1576 "getMessagesOutboundId": [1577 "mail.send",1578 "mail.read"1579 ],1580 "getMessagesScheduled": [1581 "mail.send"1582 ],1583 "deleteMessagesScheduledId": [1584 "mail.send"1585 ],1586 "postMessagesSend": [1587 "mail.send",1588 "mail.drafts"1589 ],1590 "postMessagesSendBatch": [1591 "mail.send"1592 ],1593 "getOpenapi.json": [],1594 "getOpenapi.yaml": [],1595 "getTemplates": [1596 "mail.send",1597 "mail.drafts"1598 ],1599 "getTemplatesId": [1600 "mail.send",1601 "mail.drafts"1602 ],1603 "postTemplatesIdRender": [1604 "mail.send",1605 "mail.drafts"1606 ],1607 "getThreads": [1608 "mail.read"1609 ],1610 "getThreadsId": [1611 "mail.read"1612 ],1613 "postWebhookDeliveriesIdReplay": [1614 "mail.webhooks.manage"1615 ],1616 "getWebhooks": [1617 "mail.webhooks.manage"1618 ],1619 "postWebhooks": [1620 "mail.webhooks.manage"1621 ],1622 "deleteWebhooksId": [1623 "mail.webhooks.manage"1624 ],1625 "getWebhooksId": [1626 "mail.webhooks.manage"1627 ],1628 "patchWebhooksId": [1629 "mail.webhooks.manage"1630 ],1631 "getWebhooksIdDeliveries": [1632 "mail.webhooks.manage"1633 ],1634 "postWebhooksIdTest": [1635 "mail.webhooks.manage"1636 ]1637} as const1638