{
    "openapi": "3.1.0",
    "info": {
        "title": "Ace Email API",
        "version": "1.0.0",
        "description": "This reference defines the API integration contract. The endpoints described are not enabled yet; the examples illustrate the intended requests and responses."
    },
    "x-status": "specification",
    "servers": [
        {
            "url": "https://ace.email/api/v1",
            "description": "Target URL of the proposed contract; operational endpoints are not enabled."
        }
    ],
    "tags": [
        {
            "name": "Access"
        },
        {
            "name": "Folders and messages"
        },
        {
            "name": "Actions"
        },
        {
            "name": "Drafts and delivery"
        },
        {
            "name": "Exports"
        }
    ],
    "paths": {
        "/auth/login": {
            "post": {
                "operationId": "login",
                "tags": [
                    "Access"
                ],
                "summary": "Obtain a token with mailbox credentials",
                "description": "This reference defines the API integration contract. The endpoints described are not enabled yet; the examples illustrate the intended requests and responses.",
                "security": [],
                "responses": {
                    "200": {
                        "description": "Example response for the proposed API contract.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "access_token": {
                                                    "type": "string"
                                                },
                                                "token_type": {
                                                    "type": "string"
                                                },
                                                "expires_in": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "data": {
                                        "access_token": "example_token_not_a_credential",
                                        "token_type": "Bearer",
                                        "expires_in": 31536000
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "invalid_credentials / invalid_token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "conflict",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "410": {
                        "description": "export_expired / message_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "payload_too_large",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "423": {
                        "description": "security_check_failed",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                },
                                "example": 30
                            }
                        }
                    },
                    "503": {
                        "description": "mail_server_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "email": {
                                        "type": "string",
                                        "format": "email"
                                    },
                                    "password": {
                                        "type": "string",
                                        "writeOnly": true
                                    },
                                    "device_name": {
                                        "type": "string",
                                        "maxLength": 100
                                    }
                                },
                                "required": [
                                    "email",
                                    "password",
                                    "device_name"
                                ]
                            },
                            "example": {
                                "email": "usuario@ace.email",
                                "password": "TU_CONTRASEÑA",
                                "device_name": "my-agent"
                            }
                        }
                    }
                }
            }
        },
        "/auth/logout": {
            "post": {
                "operationId": "logout",
                "tags": [
                    "Access"
                ],
                "summary": "Revoke the current token",
                "description": "This reference defines the API integration contract. The endpoints described are not enabled yet; the examples illustrate the intended requests and responses.",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Example response for the proposed API contract.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "revoked": {
                                                    "type": "boolean"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "data": {
                                        "revoked": true
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "invalid_credentials / invalid_token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "conflict",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "410": {
                        "description": "export_expired / message_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "payload_too_large",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "423": {
                        "description": "security_check_failed",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                },
                                "example": 30
                            }
                        }
                    },
                    "503": {
                        "description": "mail_server_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/me": {
            "get": {
                "operationId": "me",
                "tags": [
                    "Access"
                ],
                "summary": "Retrieve the authenticated account",
                "description": "This reference defines the API integration contract. The endpoints described are not enabled yet; the examples illustrate the intended requests and responses.",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Example response for the proposed API contract.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "email": {
                                                    "type": "string"
                                                },
                                                "name": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "data": {
                                        "email": "usuario@ace.email",
                                        "name": "Example User"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "invalid_credentials / invalid_token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "conflict",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "410": {
                        "description": "export_expired / message_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "payload_too_large",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "423": {
                        "description": "security_check_failed",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                },
                                "example": 30
                            }
                        }
                    },
                    "503": {
                        "description": "mail_server_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/folders": {
            "get": {
                "operationId": "folders",
                "tags": [
                    "Folders and messages"
                ],
                "summary": "List folders and views with counts",
                "description": "This reference defines the API integration contract. The endpoints described are not enabled yet; the examples illustrate the intended requests and responses.",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Example response for the proposed API contract.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "string"
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "is_virtual": {
                                                        "type": "boolean"
                                                    },
                                                    "total": {
                                                        "type": "integer"
                                                    },
                                                    "unread": {
                                                        "type": "integer"
                                                    }
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "data": [
                                        {
                                            "id": "inbox",
                                            "name": "Inbox",
                                            "is_virtual": false,
                                            "total": 143,
                                            "unread": 12
                                        },
                                        {
                                            "id": "unread",
                                            "name": "Unread",
                                            "is_virtual": true,
                                            "total": 12,
                                            "unread": 12
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "invalid_credentials / invalid_token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "conflict",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "410": {
                        "description": "export_expired / message_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "payload_too_large",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "423": {
                        "description": "security_check_failed",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                },
                                "example": 30
                            }
                        }
                    },
                    "503": {
                        "description": "mail_server_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/messages": {
            "get": {
                "operationId": "messages",
                "tags": [
                    "Folders and messages"
                ],
                "summary": "List and search message metadata",
                "description": "This reference defines the API integration contract. The endpoints described are not enabled yet; the examples illustrate the intended requests and responses.",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Example response for the proposed API contract.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer"
                                                    },
                                                    "folder": {
                                                        "type": "string"
                                                    },
                                                    "subject": {
                                                        "type": "string"
                                                    },
                                                    "from": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "object",
                                                            "properties": {
                                                                "address": {
                                                                    "type": "string"
                                                                },
                                                                "name": {
                                                                    "type": "string"
                                                                }
                                                            }
                                                        }
                                                    },
                                                    "to": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "object",
                                                            "properties": {
                                                                "address": {
                                                                    "type": "string"
                                                                }
                                                            }
                                                        }
                                                    },
                                                    "date": {
                                                        "type": "string"
                                                    },
                                                    "is_read": {
                                                        "type": "boolean"
                                                    },
                                                    "is_starred": {
                                                        "type": "boolean"
                                                    },
                                                    "has_attachments": {
                                                        "type": "boolean"
                                                    },
                                                    "version": {
                                                        "type": "integer"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "page": {
                                                    "type": "integer"
                                                },
                                                "per_page": {
                                                    "type": "integer"
                                                },
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "last_page": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "data": [
                                        {
                                            "id": 123,
                                            "folder": "inbox",
                                            "subject": "Example message",
                                            "from": [
                                                {
                                                    "address": "contact@example.net",
                                                    "name": "Example Contact"
                                                }
                                            ],
                                            "to": [
                                                {
                                                    "address": "usuario@ace.email"
                                                }
                                            ],
                                            "date": "2026-11-24T12:00:00Z",
                                            "is_read": false,
                                            "is_starred": false,
                                            "has_attachments": true,
                                            "version": 1
                                        }
                                    ],
                                    "meta": {
                                        "page": 1,
                                        "per_page": 30,
                                        "total": 143,
                                        "last_page": 5
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "invalid_credentials / invalid_token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "conflict",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "410": {
                        "description": "export_expired / message_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "payload_too_large",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "423": {
                        "description": "security_check_failed",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                },
                                "example": 30
                            }
                        }
                    },
                    "503": {
                        "description": "mail_server_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "folder",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "inbox"
                    },
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "maxLength": 150
                        },
                        "example": "invoice"
                    },
                    {
                        "name": "unread",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "boolean"
                        },
                        "example": true
                    },
                    {
                        "name": "starred",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "boolean"
                        },
                        "example": false
                    },
                    {
                        "name": "has_attachments",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "boolean"
                        },
                        "example": true
                    },
                    {
                        "name": "label_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 10
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 1
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "default": 30
                        },
                        "example": 30
                    }
                ]
            }
        },
        "/messages/{id}": {
            "get": {
                "operationId": "message",
                "tags": [
                    "Folders and messages"
                ],
                "summary": "Read text, HTML and attachment metadata",
                "description": "This reference defines the API integration contract. The endpoints described are not enabled yet; the examples illustrate the intended requests and responses.",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Example response for the proposed API contract.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "folder": {
                                                    "type": "string"
                                                },
                                                "subject": {
                                                    "type": "string"
                                                },
                                                "from": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "address": {
                                                                "type": "string"
                                                            },
                                                            "name": {
                                                                "type": "string"
                                                            }
                                                        }
                                                    }
                                                },
                                                "to": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "address": {
                                                                "type": "string"
                                                            }
                                                        }
                                                    }
                                                },
                                                "date": {
                                                    "type": "string"
                                                },
                                                "is_read": {
                                                    "type": "boolean"
                                                },
                                                "is_starred": {
                                                    "type": "boolean"
                                                },
                                                "has_attachments": {
                                                    "type": "boolean"
                                                },
                                                "version": {
                                                    "type": "integer"
                                                },
                                                "body_text": {
                                                    "type": "string"
                                                },
                                                "body_html": {
                                                    "type": "string"
                                                },
                                                "cc": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "bcc": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "reply_to": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "attachments": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "name": {
                                                                "type": "string"
                                                            },
                                                            "content_type": {
                                                                "type": "string"
                                                            },
                                                            "size": {
                                                                "type": "integer"
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "data": {
                                        "id": 123,
                                        "folder": "inbox",
                                        "subject": "Example message",
                                        "from": [
                                            {
                                                "address": "contact@example.net",
                                                "name": "Example Contact"
                                            }
                                        ],
                                        "to": [
                                            {
                                                "address": "usuario@ace.email"
                                            }
                                        ],
                                        "date": "2026-11-24T12:00:00Z",
                                        "is_read": false,
                                        "is_starred": false,
                                        "has_attachments": true,
                                        "version": 1,
                                        "body_text": "Example message body.",
                                        "body_html": "<p>Example message body.</p>",
                                        "cc": [],
                                        "bcc": [],
                                        "reply_to": [],
                                        "attachments": [
                                            {
                                                "id": 456,
                                                "name": "example.txt",
                                                "content_type": "text/plain",
                                                "size": 4
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "invalid_credentials / invalid_token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "conflict",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "410": {
                        "description": "export_expired / message_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "payload_too_large",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "423": {
                        "description": "security_check_failed",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                },
                                "example": 30
                            }
                        }
                    },
                    "503": {
                        "description": "mail_server_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 123
                    }
                ]
            }
        },
        "/messages/{id}/attachments/{attachment_id}": {
            "get": {
                "operationId": "attachment",
                "tags": [
                    "Folders and messages"
                ],
                "summary": "Get a complete Base64 attachment",
                "description": "This reference defines the API integration contract. The endpoints described are not enabled yet; the examples illustrate the intended requests and responses.",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Example response for the proposed API contract.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "name": {
                                                    "type": "string"
                                                },
                                                "content_type": {
                                                    "type": "string"
                                                },
                                                "size": {
                                                    "type": "integer"
                                                },
                                                "encoding": {
                                                    "type": "string"
                                                },
                                                "content": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "data": {
                                        "id": 456,
                                        "name": "example.txt",
                                        "content_type": "text/plain",
                                        "size": 4,
                                        "encoding": "base64",
                                        "content": "SG9sYQ=="
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "invalid_credentials / invalid_token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "conflict",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "410": {
                        "description": "export_expired / message_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "payload_too_large",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "423": {
                        "description": "security_check_failed",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                },
                                "example": 30
                            }
                        }
                    },
                    "503": {
                        "description": "mail_server_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 123
                    },
                    {
                        "name": "attachment_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 456
                    }
                ]
            }
        },
        "/messages/{id}/original": {
            "get": {
                "operationId": "original",
                "tags": [
                    "Folders and messages"
                ],
                "summary": "Get the EML original as JSON with Base64",
                "description": "This reference defines the API integration contract. The endpoints described are not enabled yet; the examples illustrate the intended requests and responses.",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Example response for the proposed API contract.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "content_type": {
                                                    "type": "string"
                                                },
                                                "encoding": {
                                                    "type": "string"
                                                },
                                                "content": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "data": {
                                        "id": 123,
                                        "content_type": "message/rfc822",
                                        "encoding": "base64",
                                        "content": "RnJvbTogY29udGFjdEBleGFtcGxlLm5ldA0KVG86IHVzdWFyaW9AYWNlLmVtYWlsDQpTdWJqZWN0OiBFeGFtcGxlDQoNCkhlbGxvDQo="
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "invalid_credentials / invalid_token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "conflict",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "410": {
                        "description": "export_expired / message_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "payload_too_large",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "423": {
                        "description": "security_check_failed",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                },
                                "example": 30
                            }
                        }
                    },
                    "503": {
                        "description": "mail_server_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 123
                    }
                ]
            }
        },
        "/messages/{id}/actions": {
            "post": {
                "operationId": "action",
                "tags": [
                    "Actions"
                ],
                "summary": "Apply an action to one message",
                "description": "This reference defines the API integration contract. The endpoints described are not enabled yet; the examples illustrate the intended requests and responses.",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Example response for the proposed API contract.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "is_read": {
                                                    "type": "boolean"
                                                },
                                                "version": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "data": {
                                        "id": 123,
                                        "is_read": true,
                                        "version": 2
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "invalid_credentials / invalid_token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "conflict",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "410": {
                        "description": "export_expired / message_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "payload_too_large",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "423": {
                        "description": "security_check_failed",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                },
                                "example": 30
                            }
                        }
                    },
                    "503": {
                        "description": "mail_server_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 123
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "action": {
                                        "type": "string",
                                        "enum": [
                                            "read",
                                            "unread",
                                            "star",
                                            "unstar",
                                            "archive",
                                            "inbox",
                                            "spam",
                                            "trash",
                                            "snooze",
                                            "labels"
                                        ]
                                    },
                                    "version": {
                                        "type": "integer",
                                        "minimum": 1
                                    },
                                    "snoozed_until": {
                                        "type": "string",
                                        "format": "date-time",
                                        "description": "Required for snooze; a future date no more than one year ahead."
                                    },
                                    "label_ids": {
                                        "type": "array",
                                        "items": {
                                            "type": "integer",
                                            "minimum": 1
                                        },
                                        "description": "Required for labels; only labels belonging to the mailbox."
                                    }
                                },
                                "required": [
                                    "action",
                                    "version"
                                ]
                            },
                            "example": {
                                "action": "read",
                                "version": 1
                            }
                        }
                    }
                }
            }
        },
        "/messages/actions": {
            "post": {
                "operationId": "bulk-actions",
                "tags": [
                    "Actions"
                ],
                "summary": "Run a batch with individual results",
                "description": "This reference defines the API integration contract. The endpoints described are not enabled yet; the examples illustrate the intended requests and responses.",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Example response for the proposed API contract.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer"
                                                    },
                                                    "success": {
                                                        "type": "boolean"
                                                    },
                                                    "version": {
                                                        "type": "integer"
                                                    }
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "data": [
                                        {
                                            "id": 123,
                                            "success": true,
                                            "version": 2
                                        },
                                        {
                                            "id": 124,
                                            "success": false,
                                            "error": {
                                                "code": "not_found",
                                                "message": "Message unavailable."
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "invalid_credentials / invalid_token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "conflict",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "410": {
                        "description": "export_expired / message_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "payload_too_large",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "423": {
                        "description": "security_check_failed",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                },
                                "example": 30
                            }
                        }
                    },
                    "503": {
                        "description": "mail_server_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "action": {
                                        "type": "string",
                                        "enum": [
                                            "read",
                                            "unread",
                                            "star",
                                            "unstar",
                                            "archive",
                                            "inbox",
                                            "spam",
                                            "trash",
                                            "snooze",
                                            "labels"
                                        ]
                                    },
                                    "messages": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "version": {
                                                    "type": "integer"
                                                }
                                            },
                                            "required": [
                                                "id",
                                                "version"
                                            ]
                                        },
                                        "maxItems": 100,
                                        "minItems": 1
                                    },
                                    "snoozed_until": {
                                        "type": "string",
                                        "format": "date-time",
                                        "description": "Required for snooze; a future date no more than one year ahead."
                                    },
                                    "label_ids": {
                                        "type": "array",
                                        "items": {
                                            "type": "integer",
                                            "minimum": 1
                                        },
                                        "description": "Required for labels; only labels belonging to the mailbox."
                                    }
                                },
                                "required": [
                                    "action",
                                    "messages"
                                ]
                            },
                            "example": {
                                "action": "archive",
                                "messages": [
                                    {
                                        "id": 123,
                                        "version": 1
                                    },
                                    {
                                        "id": 124,
                                        "version": 2
                                    }
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/drafts": {
            "post": {
                "operationId": "create-draft",
                "tags": [
                    "Drafts and delivery"
                ],
                "summary": "Create a draft with recipients and attachments",
                "description": "This reference defines the API integration contract. The endpoints described are not enabled yet; the examples illustrate the intended requests and responses.",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Example response for the proposed API contract.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "status": {
                                                    "type": "string"
                                                },
                                                "version": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "data": {
                                        "id": 789,
                                        "status": "draft",
                                        "version": 1
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "invalid_credentials / invalid_token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "conflict",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "410": {
                        "description": "export_expired / message_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "payload_too_large",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "423": {
                        "description": "security_check_failed",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                },
                                "example": 30
                            }
                        }
                    },
                    "503": {
                        "description": "mail_server_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "to": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "address": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    },
                                    "cc": {
                                        "type": "array",
                                        "items": {}
                                    },
                                    "bcc": {
                                        "type": "array",
                                        "items": {}
                                    },
                                    "subject": {
                                        "type": "string"
                                    },
                                    "body_text": {
                                        "type": "string"
                                    },
                                    "body_html": {
                                        "type": "string"
                                    },
                                    "attachments": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "name": {
                                                    "type": "string"
                                                },
                                                "content_type": {
                                                    "type": "string"
                                                },
                                                "size": {
                                                    "type": "integer"
                                                },
                                                "encoding": {
                                                    "type": "string",
                                                    "enum": [
                                                        "base64"
                                                    ]
                                                },
                                                "content": {
                                                    "type": "string",
                                                    "contentEncoding": "base64"
                                                }
                                            },
                                            "required": [
                                                "name",
                                                "content_type",
                                                "encoding",
                                                "content"
                                            ]
                                        },
                                        "maxItems": 20
                                    }
                                }
                            },
                            "example": {
                                "to": [
                                    {
                                        "address": "contact@example.net"
                                    }
                                ],
                                "cc": [],
                                "bcc": [],
                                "subject": "Example subject",
                                "body_text": "Hello.",
                                "body_html": "<p>Hello.</p>",
                                "attachments": [
                                    {
                                        "name": "example.txt",
                                        "content_type": "text/plain",
                                        "size": 4,
                                        "encoding": "base64",
                                        "content": "SG9sYQ=="
                                    }
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/drafts/{id}": {
            "patch": {
                "operationId": "update-draft",
                "tags": [
                    "Drafts and delivery"
                ],
                "summary": "Update draft fields",
                "description": "This reference defines the API integration contract. The endpoints described are not enabled yet; the examples illustrate the intended requests and responses.",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Example response for the proposed API contract.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "status": {
                                                    "type": "string"
                                                },
                                                "version": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "data": {
                                        "id": 789,
                                        "status": "draft",
                                        "version": 2
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "invalid_credentials / invalid_token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "conflict",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "410": {
                        "description": "export_expired / message_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "payload_too_large",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "423": {
                        "description": "security_check_failed",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                },
                                "example": 30
                            }
                        }
                    },
                    "503": {
                        "description": "mail_server_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 123
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "to": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "address": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    },
                                    "cc": {
                                        "type": "array",
                                        "items": {}
                                    },
                                    "bcc": {
                                        "type": "array",
                                        "items": {}
                                    },
                                    "subject": {
                                        "type": "string"
                                    },
                                    "body_text": {
                                        "type": "string"
                                    },
                                    "body_html": {
                                        "type": "string"
                                    },
                                    "attachments": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "name": {
                                                    "type": "string"
                                                },
                                                "content_type": {
                                                    "type": "string"
                                                },
                                                "size": {
                                                    "type": "integer"
                                                },
                                                "encoding": {
                                                    "type": "string",
                                                    "enum": [
                                                        "base64"
                                                    ]
                                                },
                                                "content": {
                                                    "type": "string",
                                                    "contentEncoding": "base64"
                                                }
                                            },
                                            "required": [
                                                "name",
                                                "content_type",
                                                "encoding",
                                                "content"
                                            ]
                                        },
                                        "maxItems": 20
                                    },
                                    "version": {
                                        "type": "integer",
                                        "minimum": 1
                                    }
                                },
                                "required": [
                                    "version"
                                ]
                            },
                            "example": {
                                "version": 1,
                                "subject": "Updated subject",
                                "body_text": "Updated body."
                            }
                        }
                    }
                }
            }
        },
        "/drafts/{id}/send": {
            "post": {
                "operationId": "send-draft",
                "tags": [
                    "Drafts and delivery"
                ],
                "summary": "Request delivery with Idempotency-Key",
                "description": "This reference defines the API integration contract. The endpoints described are not enabled yet; the examples illustrate the intended requests and responses.",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Example response for the proposed API contract.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "status": {
                                                    "type": "string"
                                                },
                                                "version": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "data": {
                                        "id": 789,
                                        "status": "queued",
                                        "version": 3
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "invalid_credentials / invalid_token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "conflict",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "410": {
                        "description": "export_expired / message_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "payload_too_large",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "423": {
                        "description": "security_check_failed",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                },
                                "example": 30
                            }
                        }
                    },
                    "503": {
                        "description": "mail_server_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 123
                    },
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 128
                        },
                        "example": "send-example-789"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "version": {
                                        "type": "integer",
                                        "minimum": 1
                                    }
                                },
                                "required": [
                                    "version"
                                ]
                            },
                            "example": {
                                "version": 2
                            }
                        }
                    }
                }
            }
        },
        "/messages/{id}/reply": {
            "post": {
                "operationId": "reply",
                "tags": [
                    "Drafts and delivery"
                ],
                "summary": "Create a reply draft without sending it",
                "description": "This reference defines the API integration contract. The endpoints described are not enabled yet; the examples illustrate the intended requests and responses.",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Example response for the proposed API contract.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "status": {
                                                    "type": "string"
                                                },
                                                "in_reply_to": {
                                                    "type": "string"
                                                },
                                                "version": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "data": {
                                        "id": 790,
                                        "status": "draft",
                                        "in_reply_to": "<example@example.net>",
                                        "version": 1
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "invalid_credentials / invalid_token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "conflict",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "410": {
                        "description": "export_expired / message_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "payload_too_large",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "423": {
                        "description": "security_check_failed",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                },
                                "example": 30
                            }
                        }
                    },
                    "503": {
                        "description": "mail_server_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 123
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "body_text": {
                                        "type": "string"
                                    },
                                    "reply_all": {
                                        "type": "boolean"
                                    }
                                }
                            },
                            "example": {
                                "body_text": "Thank you.",
                                "reply_all": false
                            }
                        }
                    }
                }
            }
        },
        "/messages/{id}/forward": {
            "post": {
                "operationId": "forward",
                "tags": [
                    "Drafts and delivery"
                ],
                "summary": "Create a forward draft without sending it",
                "description": "This reference defines the API integration contract. The endpoints described are not enabled yet; the examples illustrate the intended requests and responses.",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Example response for the proposed API contract.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "status": {
                                                    "type": "string"
                                                },
                                                "version": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "data": {
                                        "id": 791,
                                        "status": "draft",
                                        "version": 1
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "invalid_credentials / invalid_token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "conflict",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "410": {
                        "description": "export_expired / message_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "payload_too_large",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "423": {
                        "description": "security_check_failed",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                },
                                "example": 30
                            }
                        }
                    },
                    "503": {
                        "description": "mail_server_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "example": 123
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "to": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "address": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    },
                                    "body_text": {
                                        "type": "string"
                                    },
                                    "include_attachments": {
                                        "type": "boolean"
                                    }
                                }
                            },
                            "example": {
                                "to": [
                                    {
                                        "address": "colleague@example.net"
                                    }
                                ],
                                "body_text": "For your review.",
                                "include_attachments": true
                            }
                        }
                    }
                }
            }
        },
        "/exports": {
            "post": {
                "operationId": "create-export",
                "tags": [
                    "Exports"
                ],
                "summary": "Request one JSON with all messages",
                "description": "This reference defines the API integration contract. The endpoints described are not enabled yet; the examples illustrate the intended requests and responses.",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Example response for the proposed API contract.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "string"
                                                },
                                                "status": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "data": {
                                        "id": "exp_example_123",
                                        "status": "pending"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "invalid_credentials / invalid_token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "conflict",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "410": {
                        "description": "export_expired / message_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "payload_too_large",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "423": {
                        "description": "security_check_failed",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                },
                                "example": 30
                            }
                        }
                    },
                    "503": {
                        "description": "mail_server_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "folder": {
                                        "type": "string"
                                    },
                                    "q": {
                                        "type": "string"
                                    },
                                    "has_attachments": {
                                        "type": "boolean"
                                    },
                                    "unread": {
                                        "type": "boolean"
                                    },
                                    "starred": {
                                        "type": "boolean"
                                    },
                                    "label_id": {
                                        "type": "integer"
                                    }
                                },
                                "required": [
                                    "folder"
                                ]
                            },
                            "example": {
                                "folder": "unread",
                                "q": "invoice",
                                "has_attachments": true
                            }
                        }
                    }
                }
            }
        },
        "/exports/{id}": {
            "get": {
                "operationId": "export-status",
                "tags": [
                    "Exports"
                ],
                "summary": "Check progress and expiry",
                "description": "This reference defines the API integration contract. The endpoints described are not enabled yet; the examples illustrate the intended requests and responses.",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Example response for the proposed API contract.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "string"
                                                },
                                                "status": {
                                                    "type": "string"
                                                },
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "exported": {
                                                    "type": "integer"
                                                },
                                                "skipped": {
                                                    "type": "integer"
                                                },
                                                "expires_at": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "data": {
                                        "id": "exp_example_123",
                                        "status": "completed",
                                        "total": 143,
                                        "exported": 142,
                                        "skipped": 1,
                                        "expires_at": "2026-11-25T12:00:00Z"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "invalid_credentials / invalid_token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "conflict",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "410": {
                        "description": "export_expired / message_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "payload_too_large",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "423": {
                        "description": "security_check_failed",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                },
                                "example": 30
                            }
                        }
                    },
                    "503": {
                        "description": "mail_server_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "example": "exp_example_123"
                    }
                ]
            }
        },
        "/exports/{id}/result": {
            "get": {
                "operationId": "export-result",
                "tags": [
                    "Exports"
                ],
                "summary": "Get the full JSON using the owner’s token",
                "description": "This reference defines the API integration contract. The endpoints described are not enabled yet; the examples illustrate the intended requests and responses.",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Example response for the proposed API contract.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "schema_version": {
                                            "type": "string"
                                        },
                                        "folder": {
                                            "type": "string"
                                        },
                                        "total": {
                                            "type": "integer"
                                        },
                                        "exported": {
                                            "type": "integer"
                                        },
                                        "skipped": {
                                            "type": "integer"
                                        },
                                        "messages": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer"
                                                    },
                                                    "folder": {
                                                        "type": "string"
                                                    },
                                                    "subject": {
                                                        "type": "string"
                                                    },
                                                    "from": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "object",
                                                            "properties": {
                                                                "address": {
                                                                    "type": "string"
                                                                },
                                                                "name": {
                                                                    "type": "string"
                                                                }
                                                            }
                                                        }
                                                    },
                                                    "to": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "object",
                                                            "properties": {
                                                                "address": {
                                                                    "type": "string"
                                                                }
                                                            }
                                                        }
                                                    },
                                                    "date": {
                                                        "type": "string"
                                                    },
                                                    "is_read": {
                                                        "type": "boolean"
                                                    },
                                                    "is_starred": {
                                                        "type": "boolean"
                                                    },
                                                    "has_attachments": {
                                                        "type": "boolean"
                                                    },
                                                    "version": {
                                                        "type": "integer"
                                                    },
                                                    "body_text": {
                                                        "type": "string"
                                                    },
                                                    "body_html": {
                                                        "type": "string"
                                                    },
                                                    "attachments": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "object",
                                                            "properties": {
                                                                "id": {
                                                                    "type": "integer"
                                                                },
                                                                "name": {
                                                                    "type": "string"
                                                                },
                                                                "content_type": {
                                                                    "type": "string"
                                                                },
                                                                "size": {
                                                                    "type": "integer"
                                                                },
                                                                "encoding": {
                                                                    "type": "string"
                                                                },
                                                                "content": {
                                                                    "type": "string"
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "errors": {
                                            "type": "array",
                                            "items": {}
                                        }
                                    }
                                },
                                "example": {
                                    "schema_version": "1.0",
                                    "folder": "inbox",
                                    "total": 1,
                                    "exported": 1,
                                    "skipped": 0,
                                    "messages": [
                                        {
                                            "id": 123,
                                            "folder": "inbox",
                                            "subject": "Example message",
                                            "from": [
                                                {
                                                    "address": "contact@example.net",
                                                    "name": "Example Contact"
                                                }
                                            ],
                                            "to": [
                                                {
                                                    "address": "usuario@ace.email"
                                                }
                                            ],
                                            "date": "2026-11-24T12:00:00Z",
                                            "is_read": false,
                                            "is_starred": false,
                                            "has_attachments": true,
                                            "version": 1,
                                            "body_text": "Example message body.",
                                            "body_html": "<p>Example message body.</p>",
                                            "attachments": [
                                                {
                                                    "id": 456,
                                                    "name": "example.txt",
                                                    "content_type": "text/plain",
                                                    "size": 4,
                                                    "encoding": "base64",
                                                    "content": "SG9sYQ=="
                                                }
                                            ]
                                        }
                                    ],
                                    "errors": []
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "invalid_credentials / invalid_token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "not_found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "conflict",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "410": {
                        "description": "export_expired / message_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "payload_too_large",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "validation_error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "423": {
                        "description": "security_check_failed",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "rate_limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                },
                                "example": 30
                            }
                        }
                    },
                    "503": {
                        "description": "mail_server_unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "example": "exp_example_123"
                    }
                ]
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer",
                "description": "Mailbox token obtained with the normal web login credentials. Valid for 365 days and revocable."
            }
        },
        "schemas": {
            "Error": {
                "type": "object",
                "required": [
                    "error"
                ],
                "properties": {
                    "error": {
                        "type": "object",
                        "required": [
                            "code",
                            "message",
                            "request_id"
                        ],
                        "properties": {
                            "code": {
                                "type": "string"
                            },
                            "message": {
                                "type": "string"
                            },
                            "details": {
                                "type": "object",
                                "additionalProperties": {
                                    "type": "array",
                                    "items": {
                                        "type": "string"
                                    }
                                }
                            },
                            "request_id": {
                                "type": "string"
                            }
                        }
                    }
                },
                "example": {
                    "error": {
                        "code": "validation_error",
                        "message": "Invalid request.",
                        "details": {
                            "email": [
                                "A valid email address is required."
                            ]
                        },
                        "request_id": "req_example_123"
                    }
                }
            }
        }
    }
}