{"ok":true,"code":200,"message":"success","requestId":"9f1229f4-a88d-49da-bc61-f08d74914ffb","data":{"openapi":"3.1.0","info":{"title":"MailAgents Agent API","version":"1.0.0","description":"Stable mailbox API for AI agents and automation clients."},"servers":[{"url":"/api/agent/v1"}],"security":[{"bearerAuth":[]},{"agentToken":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"},"agentToken":{"type":"apiKey","in":"header","name":"X-Agent-Token"}},"parameters":{"accountIdQuery":{"name":"accountId","in":"query","schema":{"type":"integer"},"description":"Mailbox id. Required for manager-token calls."},"emailIdPath":{"name":"emailId","in":"path","required":true,"schema":{"type":"integer"}},"webhookIdPath":{"name":"webhookId","in":"path","required":true,"schema":{"type":"integer"}},"typeQuery":{"name":"type","in":"query","schema":{"type":"integer","enum":[0,1],"default":0},"description":"0 received, 1 sent."},"sizeQuery":{"name":"size","in":"query","schema":{"type":"integer","minimum":1,"maximum":50,"default":20}},"cursorQuery":{"name":"cursor","in":"query","schema":{"type":"integer"}},"timeSortQuery":{"name":"timeSort","in":"query","schema":{"type":"integer","enum":[0,1],"default":0},"description":"0 newest first, 1 oldest first."},"idempotencyHeader":{"name":"Idempotency-Key","in":"header","schema":{"type":"string","maxLength":128},"description":"Optional key for safely retrying send/reply requests for 24 hours."}},"schemas":{"Envelope":{"type":"object","required":["ok","code","message","requestId","data"],"properties":{"ok":{"type":"boolean"},"code":{"type":"integer"},"message":{"type":"string"},"requestId":{"type":"string"},"data":{},"meta":{"type":"object","additionalProperties":true}}},"ErrorEnvelope":{"allOf":[{"$ref":"#/components/schemas/Envelope"},{"type":"object","properties":{"ok":{"const":false},"error":{"type":"object","properties":{"type":{"type":"string"},"stack":{"type":"string"}}}}}]},"Mailbox":{"type":"object","properties":{"id":{"type":"integer"},"email":{"type":"string","format":"email"},"name":{"type":"string"},"status":{"type":"integer"},"userId":{"type":"integer"},"allReceive":{"type":"boolean"},"latestEmailAt":{"type":["string","null"]},"createdAt":{"type":"string"}}},"MailboxToken":{"type":"object","properties":{"id":{"type":"integer"},"accountId":{"type":"integer"},"userId":{"type":"integer"},"name":{"type":"string"},"scopes":{"type":"array","items":{"type":"string","enum":["read","send"]}},"expiresAt":{"type":["string","null"]},"revokedAt":{"type":["string","null"]},"lastUsedAt":{"type":["string","null"]},"createdAt":{"type":"string"}}},"Attachment":{"type":"object","properties":{"id":{"type":"integer"},"emailId":{"type":"integer"},"accountId":{"type":"integer"},"filename":{"type":["string","null"]},"mimeType":{"type":["string","null"]},"size":{"type":["integer","null"]},"key":{"type":"string"},"url":{"type":"string"},"disposition":{"type":["string","null"]},"contentId":{"type":["string","null"]},"createdAt":{"type":"string"}}},"Email":{"type":"object","properties":{"id":{"type":"integer"},"accountId":{"type":"integer"},"userId":{"type":"integer"},"direction":{"type":"string","enum":["received","sent"]},"status":{"type":"string"},"unread":{"type":"boolean"},"from":{"type":"object","properties":{"email":{"type":"string"},"name":{"type":"string"}}},"to":{"type":"array","items":{"type":"object","additionalProperties":true}},"subject":{"type":"string"},"plainText":{"type":"string"},"html":{"type":"string"},"snippet":{"type":"string"},"encrypted":{"type":"boolean","description":"True when this message has an end-to-end encrypted payload."},"bodyAvailable":{"type":"boolean","description":"True when plainText or html is available in the API response."},"decryptRequired":{"type":"boolean","description":"True when the body is end-to-end encrypted and not available to the server-side API."},"decryptStatus":{"type":"string","enum":["not_encrypted","decrypted","agent_envelope_available","missing_agent_envelope"]},"decryptHint":{"type":"string","description":"Human-readable guidance for encrypted messages that require browser-side decryption."},"decryptAction":{"type":"string","description":"Next action for encrypted messages, such as retry_with_local_bridge_headers or open_mailagents_web_ui."},"requiredHeaders":{"type":"array","items":{"type":"string"},"description":"Headers needed when retrying through the registered local Agent E2EE bridge."},"docsUrl":{"type":"string"},"canDecryptLocally":{"type":"boolean"},"oldMessageRecoverable":{"type":"boolean"},"localBridgeRuntimeRequired":{"type":"boolean","description":"True when plaintext decryption requires the local MailAgents plugin bridge runtime rather than a direct remote MCP call."},"plaintextAvailableOnlyInPluginBridge":{"type":"boolean","description":"True when direct remote MCP can return only envelope metadata; the local plugin bridge can unwrap matching envelopes into plainText/html."},"localBridgeDecryptionAttempted":{"type":"boolean","description":"True when the request was authorized as a local bridge request and agent envelope material was released for local decryption."},"encryptionKeyId":{"type":"string"},"agentEnvelopeAvailable":{"type":"boolean"},"verificationCode":{"type":"string"},"messageId":{"type":"string"},"inReplyTo":{"type":"string"},"threadId":{"type":"string"},"providerMessageId":{"type":"string"},"errorMessage":{"type":"string"},"createdAt":{"type":"string"},"delivery":{"type":"object","description":"Stable sent-message delivery metadata for verifying send/reply results.","properties":{"emailId":{"type":"integer"},"accountId":{"type":"integer"},"status":{"type":"string"},"providerMessageId":{"type":"string"},"messageId":{"type":"string"},"createdAt":{"type":"string"},"from":{"type":"object","additionalProperties":true},"to":{"type":"array","items":{"type":"object","additionalProperties":true}},"cc":{"type":"array","items":{"type":"object","additionalProperties":true}},"bcc":{"type":"array","items":{"type":"object","additionalProperties":true}},"idempotencyKeyEcho":{"type":"string"}}},"task":{"$ref":"#/components/schemas/EmailTask"},"attachments":{"type":"array","items":{"$ref":"#/components/schemas/Attachment"}}}},"EmailTask":{"type":"object","properties":{"status":{"type":"string","enum":["new","processing","handled","needs_human","ignored"]},"reason":{"type":"string"},"handledBy":{"type":"string"},"handledAt":{"type":["string","null"]},"leaseOwner":{"type":"string"},"leaseExpiresAt":{"type":["string","null"]},"locked":{"type":"boolean"}}},"TaskStats":{"type":"object","properties":{"accountId":{"type":"integer"},"userId":{"type":"integer"},"total":{"type":"integer"},"locked":{"type":"integer"},"available":{"type":"integer"},"expired":{"type":"integer"},"byStatus":{"type":"object","additionalProperties":{"type":"object","properties":{"total":{"type":"integer"},"locked":{"type":"integer"},"available":{"type":"integer"},"expired":{"type":"integer"}}}},"lockedByOwner":{"type":"object","additionalProperties":{"type":"integer"}},"expiredByOwner":{"type":"object","additionalProperties":{"type":"integer"}},"generatedAt":{"type":"string"}}},"SendEmailRequest":{"type":"object","required":["to"],"properties":{"accountId":{"type":"integer"},"to":{"type":"array","minItems":1,"items":{"type":"string","format":"email"}},"receiveEmail":{"type":"array","minItems":1,"items":{"type":"string","format":"email"}},"subject":{"type":"string"},"text":{"type":"string"},"plainText":{"type":"string"},"html":{"type":"string"},"content":{"type":"string"},"bodyRef":{"type":"string","description":"Reference returned by /body-refs. Use for long message bodies."},"draftRef":{"type":"string","description":"Alias for bodyRef."},"attachments":{"type":"array","maxItems":10,"items":{"type":"object","additionalProperties":true}},"idempotencyKey":{"type":"string","maxLength":128}}},"ReplyEmailRequest":{"type":"object","required":["emailId"],"description":"Reply to an existing email. If to/receiveEmail is omitted, MailAgents replies to the original sender after verifying the message.","properties":{"accountId":{"type":"integer"},"emailId":{"type":"integer"},"to":{"type":"array","minItems":1,"items":{"type":"string","format":"email"},"description":"Optional. Defaults to the original sender when omitted."},"receiveEmail":{"type":"array","minItems":1,"items":{"type":"string","format":"email"},"description":"Alias for to."},"subject":{"type":"string"},"text":{"type":"string"},"plainText":{"type":"string"},"html":{"type":"string"},"content":{"type":"string"},"bodyRef":{"type":"string","description":"Reference returned by /body-refs. Use for long message bodies."},"draftRef":{"type":"string","description":"Alias for bodyRef."},"attachments":{"type":"array","maxItems":10,"items":{"type":"object","additionalProperties":true}},"idempotencyKey":{"type":"string","maxLength":128}}},"BodyRefRequest":{"type":"object","properties":{"accountId":{"type":"integer"},"subject":{"type":"string"},"text":{"type":"string"},"plainText":{"type":"string"},"html":{"type":"string"},"content":{"type":"string"}}},"ClaimEmailTaskRequest":{"type":"object","properties":{"owner":{"type":"string","description":"Agent identifier holding the lease."},"agentId":{"type":"string","description":"Alias for owner."},"ttlSeconds":{"type":"integer","minimum":30,"maximum":3600,"default":300},"reason":{"type":"string"}}},"ClaimNextEmailTaskRequest":{"type":"object","properties":{"accountId":{"type":"integer"},"status":{"type":"string","default":"new","description":"Comma-separated task statuses."},"statuses":{"type":"array","items":{"type":"string","enum":["new","processing","handled","needs_human","ignored"]}},"owner":{"type":"string","description":"Agent identifier holding the lease."},"agentId":{"type":"string","description":"Alias for owner."},"ttlSeconds":{"type":"integer","minimum":30,"maximum":3600,"default":300},"reason":{"type":"string"},"limit":{"type":"integer","minimum":1,"maximum":20,"default":5},"cursor":{"type":"integer"},"timeSort":{"type":"integer","enum":[0,1],"default":0}}},"RequeueExpiredEmailTasksRequest":{"type":"object","properties":{"accountId":{"type":"integer"},"owner":{"type":"string","description":"Optional lease owner filter."},"agentId":{"type":"string","description":"Alias for owner."},"before":{"type":"string","description":"ISO timestamp cutoff. Defaults to now."},"limit":{"type":"integer","minimum":1,"maximum":50,"default":20},"reason":{"type":"string","default":"lease expired"}}},"ReleaseEmailTaskRequest":{"type":"object","properties":{"owner":{"type":"string"},"agentId":{"type":"string","description":"Alias for owner."},"status":{"type":"string","enum":["new","processing","handled","needs_human","ignored"]}}},"ReleaseEmailTaskBatchRequest":{"type":"object","required":["emailIds"],"properties":{"accountId":{"type":"integer"},"emailIds":{"type":"array","items":{"type":"integer"}},"owner":{"type":"string"},"agentId":{"type":"string","description":"Alias for owner."},"status":{"type":"string","enum":["new","processing","handled","needs_human","ignored"]}}},"RenewEmailTaskRequest":{"type":"object","anyOf":[{"required":["owner"]},{"required":["agentId"]}],"properties":{"owner":{"type":"string"},"agentId":{"type":"string","description":"Alias for owner."},"ttlSeconds":{"type":"integer","minimum":30,"maximum":3600,"default":300},"reason":{"type":"string"}}},"RenewEmailTaskBatchRequest":{"type":"object","required":["emailIds"],"anyOf":[{"required":["owner"]},{"required":["agentId"]}],"properties":{"accountId":{"type":"integer"},"emailIds":{"type":"array","items":{"type":"integer"}},"owner":{"type":"string"},"agentId":{"type":"string","description":"Alias for owner."},"ttlSeconds":{"type":"integer","minimum":30,"maximum":3600,"default":300},"reason":{"type":"string"}}},"UpdateEmailTaskRequest":{"type":"object","required":["status"],"properties":{"status":{"type":"string","enum":["new","processing","handled","needs_human","ignored"]},"owner":{"type":"string"},"agentId":{"type":"string","description":"Alias for owner."},"reason":{"type":"string"}}},"UpdateEmailTaskBatchRequest":{"type":"object","required":["emailIds","status"],"properties":{"accountId":{"type":"integer"},"emailIds":{"type":"array","items":{"type":"integer"}},"status":{"type":"string","enum":["new","processing","handled","needs_human","ignored"]},"owner":{"type":"string"},"agentId":{"type":"string","description":"Alias for owner."},"reason":{"type":"string"}}},"MarkReadRequest":{"type":"object","required":["emailIds"],"properties":{"emailIds":{"type":"array","items":{"type":"integer"}}}},"WebhookRequest":{"type":"object","required":["url"],"properties":{"url":{"type":"string","format":"uri"},"name":{"type":"string"},"accountId":{"type":"integer"},"ownerAccountId":{"type":"integer"},"events":{"type":"array","items":{"type":"string","enum":["email.received"]}}}},"Webhook":{"type":"object","properties":{"webhookId":{"type":"integer"},"userId":{"type":"integer"},"accountId":{"type":["integer","null"]},"name":{"type":"string"},"url":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"status":{"type":"integer"},"lastStatus":{"type":["integer","null"]},"lastError":{"type":["string","null"]},"lastDeliverTime":{"type":["string","null"]},"createTime":{"type":"string"}}}},"responses":{"Ok":{"description":"Successful response envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"BadRequest":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"Unauthorized":{"description":"Missing or invalid agent token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"Conflict":{"description":"Task lease or idempotency conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}},"paths":{"/me":{"get":{"operationId":"getAgentIdentity","summary":"Inspect the authenticated agent identity and mailbox scope","responses":{"200":{"$ref":"#/components/responses/Ok"},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/mailboxes":{"get":{"operationId":"listMailboxes","summary":"List accessible mailboxes","responses":{"200":{"$ref":"#/components/responses/Ok"},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"operationId":"createMailbox","summary":"Create a mailbox and initial mailbox token","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email"},"ownerAccountId":{"type":"integer"},"accountId":{"type":"integer"},"tokenName":{"type":"string"},"scopes":{"type":"array","items":{"type":"string","enum":["read","send"]}},"expiresAt":{"type":"string"},"turnstileToken":{"type":"string"},"token":{"type":"string"}}}}}},"responses":{"200":{"$ref":"#/components/responses/Ok"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/mailboxes/{accountId}/tokens":{"get":{"operationId":"listMailboxTokens","summary":"List mailbox tokens","parameters":[{"name":"accountId","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"$ref":"#/components/responses/Ok"},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"operationId":"createMailboxToken","summary":"Create a mailbox token","parameters":[{"name":"accountId","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"scopes":{"type":"array","items":{"type":"string","enum":["read","send"]}},"expiresAt":{"type":"string"}}}}}},"responses":{"200":{"$ref":"#/components/responses/Ok"},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/tokens/{tokenId}":{"delete":{"operationId":"revokeMailboxToken","summary":"Revoke a mailbox token","parameters":[{"name":"tokenId","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"$ref":"#/components/responses/Ok"},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/emails":{"get":{"operationId":"listEmails","summary":"List emails with cursor pagination","parameters":[{"$ref":"#/components/parameters/accountIdQuery"},{"$ref":"#/components/parameters/typeQuery"},{"$ref":"#/components/parameters/sizeQuery"},{"$ref":"#/components/parameters/cursorQuery"},{"$ref":"#/components/parameters/timeSortQuery"}],"responses":{"200":{"$ref":"#/components/responses/Ok"},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/emails/search":{"get":{"operationId":"searchEmails","summary":"Search emails by text, sender, recipient, date, and attachment filters","parameters":[{"$ref":"#/components/parameters/accountIdQuery"},{"name":"q","in":"query","schema":{"type":"string"}},{"name":"from","in":"query","schema":{"type":"string"}},{"name":"to","in":"query","schema":{"type":"string"}},{"name":"subject","in":"query","schema":{"type":"string"}},{"name":"since","in":"query","schema":{"type":"string"}},{"name":"before","in":"query","schema":{"type":"string"}},{"name":"direction","in":"query","schema":{"type":"string","enum":["received","sent"]}},{"name":"hasAttachment","in":"query","schema":{"type":"boolean"}},{"$ref":"#/components/parameters/sizeQuery"},{"$ref":"#/components/parameters/cursorQuery"},{"$ref":"#/components/parameters/timeSortQuery"}],"responses":{"200":{"$ref":"#/components/responses/Ok"},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/tasks":{"get":{"operationId":"listEmailTasks","summary":"List received email tasks by agent status and lease availability","parameters":[{"$ref":"#/components/parameters/accountIdQuery"},{"name":"status","in":"query","schema":{"type":"string","default":"new"},"description":"Comma-separated task statuses."},{"name":"includeLocked","in":"query","schema":{"type":"boolean","default":false}},{"name":"lockedOnly","in":"query","schema":{"type":"boolean","default":false}},{"name":"owner","in":"query","schema":{"type":"string"},"description":"Filter tasks by lease owner."},{"name":"agentId","in":"query","schema":{"type":"string"},"description":"Alias for owner."},{"$ref":"#/components/parameters/sizeQuery"},{"$ref":"#/components/parameters/cursorQuery"},{"$ref":"#/components/parameters/timeSortQuery"}],"responses":{"200":{"$ref":"#/components/responses/Ok"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/tasks/stats":{"get":{"operationId":"getEmailTaskStats","summary":"Get email task backlog and lease statistics","parameters":[{"$ref":"#/components/parameters/accountIdQuery"}],"responses":{"200":{"description":"Email task statistics.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Envelope"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TaskStats"}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/tasks/claim-next":{"post":{"operationId":"claimNextEmailTask","summary":"Atomically claim the next available received email task","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClaimNextEmailTaskRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/Ok"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/tasks/claim-batch":{"post":{"operationId":"claimEmailTaskBatch","summary":"Atomically claim a batch of available received email tasks","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClaimNextEmailTaskRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/Ok"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/tasks/requeue-expired":{"post":{"operationId":"requeueExpiredEmailTasks","summary":"Requeue expired processing tasks whose leases are no longer active","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequeueExpiredEmailTasksRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/Ok"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/tasks/update-batch":{"put":{"operationId":"updateEmailTaskBatch","summary":"Update a batch of email task statuses","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateEmailTaskBatchRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/Ok"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/tasks/renew-batch":{"post":{"operationId":"renewEmailTaskBatch","summary":"Renew a batch of email task leases held by the same agent owner","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RenewEmailTaskBatchRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/Ok"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/tasks/release-batch":{"post":{"operationId":"releaseEmailTaskBatch","summary":"Release a batch of email task leases","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReleaseEmailTaskBatchRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/Ok"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/emails/{emailId}":{"get":{"operationId":"getEmail","summary":"Get a single email","parameters":[{"$ref":"#/components/parameters/emailIdPath"}],"responses":{"200":{"$ref":"#/components/responses/Ok"},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/emails/{emailId}/claim":{"post":{"operationId":"claimEmailTask","summary":"Claim an email task lease for an agent","parameters":[{"$ref":"#/components/parameters/emailIdPath"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClaimEmailTaskRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/Ok"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/emails/{emailId}/release":{"post":{"operationId":"releaseEmailTask","summary":"Release an email task lease","parameters":[{"$ref":"#/components/parameters/emailIdPath"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReleaseEmailTaskRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/Ok"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/emails/{emailId}/renew":{"post":{"operationId":"renewEmailTaskLease","summary":"Renew an email task lease held by the same agent owner","parameters":[{"$ref":"#/components/parameters/emailIdPath"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RenewEmailTaskRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/Ok"},"400":{"$ref":"#/components/responses/BadRequest"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/emails/{emailId}/task":{"put":{"operationId":"updateEmailTaskStatus","summary":"Update email task status","parameters":[{"$ref":"#/components/parameters/emailIdPath"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateEmailTaskRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/Ok"},"400":{"$ref":"#/components/responses/BadRequest"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/send":{"post":{"operationId":"sendEmail","summary":"Send an email from the authenticated mailbox","parameters":[{"$ref":"#/components/parameters/idempotencyHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendEmailRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/Ok"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/reply":{"post":{"operationId":"replyEmail","summary":"Reply to an existing email","parameters":[{"$ref":"#/components/parameters/idempotencyHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReplyEmailRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/Ok"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/body-refs":{"post":{"operationId":"createBodyRef","summary":"Store a long email body for 24 hours and return a bodyRef","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BodyRefRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/Ok"},"400":{"$ref":"#/components/responses/BadRequest"}}}},"/read":{"put":{"operationId":"markEmailsRead","summary":"Mark emails as read","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarkReadRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/Ok"}}}},"/attachments":{"get":{"operationId":"listAttachments","summary":"List email attachments","parameters":[{"name":"emailId","in":"query","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"$ref":"#/components/responses/Ok"},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/webhooks":{"get":{"operationId":"listWebhooks","summary":"List webhook subscriptions","responses":{"200":{"$ref":"#/components/responses/Ok"},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"operationId":"createWebhook","summary":"Create a webhook subscription","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/Ok"},"400":{"$ref":"#/components/responses/BadRequest"}}}},"/webhooks/{webhookId}":{"delete":{"operationId":"deleteWebhook","summary":"Delete a webhook subscription","parameters":[{"$ref":"#/components/parameters/webhookIdPath"}],"responses":{"200":{"$ref":"#/components/responses/Ok"},"401":{"$ref":"#/components/responses/Unauthorized"}}}}}}}