{
  "openapi": "3.1.0",
  "info": {
    "title": "AgentMail API",
    "version": "1.0.0",
    "description": "AgentMail email API endpoints exposed through the AIsa unified gateway. Adapted from the upstream docs.agentmail.to OpenAPI spec."
  },
  "servers": [
    {
      "url": "https://api.aisa.one/apis/v1"
    }
  ],
  "security": [
    {
      "Bearer": []
    }
  ],
  "components": {
    "schemas": {
      "type_agent_AgentSignupRequest": {
        "type": "object",
        "properties": {
          "human_email": {
            "type": "string",
            "description": "Email address of the human who owns the agent. A 6-digit OTP will be sent to this address."
          },
          "username": {
            "type": "string",
            "description": "Username for the auto-created inbox (e.g. \"my-agent\" creates my-agent@agentmail.to)."
          },
          "source": {
            "type": "string",
            "description": "The SDK, framework, or platform issuing this sign-up (e.g. `agentmail-python`, `agentmail-cli`, `agentmail-mcp`).\nIdentifies the caller — answers \"who is signing up\".\nMax 2048 characters."
          },
          "referrer": {
            "type": "string",
            "description": "The channel that drove this sign-up — where the agent or its developer discovered AgentMail\n(e.g. `agent.email`, a partner URL, a campaign tag). Answers \"where did this sign-up come from\".\nMax 2048 characters."
          }
        },
        "required": [
          "human_email",
          "username"
        ],
        "description": "Request body to sign up an agent.",
        "title": "AgentSignupRequest"
      },
      "type_agent_AgentSignupResponse": {
        "type": "object",
        "properties": {
          "organization_id": {
            "type": "string",
            "description": "ID of the created organization."
          },
          "inbox_id": {
            "type": "string",
            "description": "ID of the auto-created inbox."
          },
          "api_key": {
            "type": "string",
            "description": "API key for authenticating subsequent requests. Store this securely, it cannot be retrieved again."
          }
        },
        "required": [
          "organization_id",
          "inbox_id",
          "api_key"
        ],
        "description": "Response after successful agent sign-up.",
        "title": "AgentSignupResponse"
      },
      "type__ErrorName": {
        "type": "string",
        "description": "Name of error.",
        "title": "ErrorName"
      },
      "type__ValidationErrorResponse": {
        "type": "object",
        "properties": {
          "name": {
            "$ref": "#/components/schemas/type__ErrorName"
          },
          "errors": {
            "description": "Validation errors."
          }
        },
        "required": [
          "name",
          "errors"
        ],
        "title": "ValidationErrorResponse"
      },
      "type_agent_AgentVerifyRequest": {
        "type": "object",
        "properties": {
          "otp_code": {
            "type": "string",
            "description": "6-digit verification code sent to the human's email address."
          }
        },
        "required": [
          "otp_code"
        ],
        "description": "Request body to verify an agent with an OTP code.",
        "title": "AgentVerifyRequest"
      },
      "type_agent_AgentVerifyResponse": {
        "type": "object",
        "properties": {
          "verified": {
            "type": "boolean",
            "description": "Whether the organization was verified."
          }
        },
        "required": [
          "verified"
        ],
        "description": "Response after successful agent verification.",
        "title": "AgentVerifyResponse"
      },
      "type__Limit": {
        "type": "integer",
        "description": "Limit of number of items returned.",
        "title": "Limit"
      },
      "type__PageToken": {
        "type": "string",
        "description": "Page token for pagination.",
        "title": "PageToken"
      },
      "type__Ascending": {
        "type": "boolean",
        "description": "Sort in ascending temporal order.",
        "title": "Ascending"
      },
      "type__Count": {
        "type": "integer",
        "description": "Number of items returned.",
        "title": "Count"
      },
      "type_pods_PodId": {
        "type": "string",
        "description": "ID of pod.",
        "title": "PodId"
      },
      "type_inboxes_InboxId": {
        "type": "string",
        "description": "The ID of the inbox.",
        "title": "InboxId"
      },
      "type_inboxes_Email": {
        "type": "string",
        "description": "Email address of the inbox.",
        "title": "Email"
      },
      "type_inboxes_DisplayName": {
        "type": "string",
        "description": "Display name: `Display Name <username@domain.com>`.",
        "title": "DisplayName"
      },
      "type_inboxes_ClientId": {
        "type": "string",
        "description": "Client ID of inbox.",
        "title": "ClientId"
      },
      "type_inboxes_MetadataValue": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "number",
            "format": "double"
          },
          {
            "type": "boolean"
          }
        ],
        "description": "A metadata value. May be a string, number, or boolean.",
        "title": "MetadataValue"
      },
      "type_inboxes_Metadata": {
        "type": "object",
        "additionalProperties": {
          "$ref": "#/components/schemas/type_inboxes_MetadataValue"
        },
        "description": "Custom key-value pairs attached to the inbox. Up to 256 keys. Keys and\nstring values are each limited to 256 characters. When updating metadata,\nsend a key with a null value to remove that key.",
        "title": "Metadata"
      },
      "type_inboxes_Inbox": {
        "type": "object",
        "properties": {
          "pod_id": {
            "$ref": "#/components/schemas/type_pods_PodId"
          },
          "inbox_id": {
            "$ref": "#/components/schemas/type_inboxes_InboxId"
          },
          "email": {
            "$ref": "#/components/schemas/type_inboxes_Email"
          },
          "display_name": {
            "$ref": "#/components/schemas/type_inboxes_DisplayName"
          },
          "client_id": {
            "$ref": "#/components/schemas/type_inboxes_ClientId"
          },
          "metadata": {
            "$ref": "#/components/schemas/type_inboxes_Metadata",
            "description": "Custom metadata attached to the inbox."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time at which inbox was last updated."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time at which inbox was created."
          }
        },
        "required": [
          "pod_id",
          "inbox_id",
          "email",
          "updated_at",
          "created_at"
        ],
        "title": "Inbox"
      },
      "type_inboxes_ListInboxesResponse": {
        "type": "object",
        "properties": {
          "count": {
            "$ref": "#/components/schemas/type__Count"
          },
          "limit": {
            "$ref": "#/components/schemas/type__Limit"
          },
          "next_page_token": {
            "$ref": "#/components/schemas/type__PageToken"
          },
          "inboxes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/type_inboxes_Inbox"
            },
            "description": "Ordered by `created_at` descending."
          }
        },
        "required": [
          "count",
          "inboxes"
        ],
        "title": "ListInboxesResponse"
      },
      "type__ErrorMessage": {
        "type": "string",
        "description": "Error message.",
        "title": "ErrorMessage"
      },
      "type__ErrorResponse": {
        "type": "object",
        "properties": {
          "name": {
            "$ref": "#/components/schemas/type__ErrorName"
          },
          "message": {
            "$ref": "#/components/schemas/type__ErrorMessage"
          }
        },
        "required": [
          "name",
          "message"
        ],
        "title": "ErrorResponse"
      },
      "type_inboxes_CreateInboxRequest": {
        "type": "object",
        "properties": {
          "username": {
            "type": "string",
            "description": "Username of address. Randomly generated if not specified."
          },
          "domain": {
            "type": "string",
            "description": "Domain of address. Must be verified domain. Defaults to `agentmail.to`."
          },
          "display_name": {
            "$ref": "#/components/schemas/type_inboxes_DisplayName"
          },
          "client_id": {
            "$ref": "#/components/schemas/type_inboxes_ClientId"
          },
          "metadata": {
            "$ref": "#/components/schemas/type_inboxes_Metadata",
            "description": "Custom metadata to attach to the inbox."
          }
        },
        "title": "CreateInboxRequest"
      },
      "type_inboxes_UpdateMetadata": {
        "type": "object",
        "additionalProperties": {
          "allOf": [
            {
              "$ref": "#/components/schemas/type_inboxes_MetadataValue"
            }
          ],
          "nullable": true
        },
        "description": "Custom key-value pairs to merge into the inbox's existing metadata. A\nvalue may be a string, number, boolean, or null. Setting a key to null\nremoves it. Up to 256 keys; keys and string values are each limited to\n256 characters.",
        "title": "UpdateMetadata"
      },
      "type_inboxes_UpdateInboxRequest": {
        "type": "object",
        "properties": {
          "display_name": {
            "$ref": "#/components/schemas/type_inboxes_DisplayName"
          },
          "metadata": {
            "description": "Metadata to merge into the inbox's existing metadata. Keys you include\nare added or overwritten; keys you omit are left unchanged. To remove a\nsingle key, send it with a null value. To clear all metadata, send\n`metadata` as null. Sending an empty object is rejected; use null to\nclear. Each update must include at least one of `display_name` or\n`metadata`.",
            "allOf": [
              {
                "$ref": "#/components/schemas/type_inboxes_UpdateMetadata"
              }
            ],
            "nullable": true
          }
        },
        "title": "UpdateInboxRequest"
      },
      "type__Labels": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "Labels to filter by.",
        "title": "Labels"
      },
      "type__Before": {
        "type": "string",
        "format": "date-time",
        "description": "Timestamp before which to filter by.",
        "title": "Before"
      },
      "type__After": {
        "type": "string",
        "format": "date-time",
        "description": "Timestamp after which to filter by.",
        "title": "After"
      },
      "type__IncludeSpam": {
        "type": "boolean",
        "description": "Include spam in results.",
        "title": "IncludeSpam"
      },
      "type__IncludeBlocked": {
        "type": "boolean",
        "description": "Include blocked in results.",
        "title": "IncludeBlocked"
      },
      "type__IncludeUnauthenticated": {
        "type": "boolean",
        "description": "Include unauthenticated in results.",
        "title": "IncludeUnauthenticated"
      },
      "type__IncludeTrash": {
        "type": "boolean",
        "description": "Include trash in results.",
        "title": "IncludeTrash"
      },
      "type_threads_ThreadId": {
        "type": "string",
        "description": "ID of thread.",
        "title": "ThreadId"
      },
      "type_threads_ThreadLabels": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "Labels of thread.",
        "title": "ThreadLabels"
      },
      "type_threads_ThreadTimestamp": {
        "type": "string",
        "format": "date-time",
        "description": "Timestamp of last sent or received message.",
        "title": "ThreadTimestamp"
      },
      "type_threads_ThreadReceivedTimestamp": {
        "type": "string",
        "format": "date-time",
        "description": "Timestamp of last received message.",
        "title": "ThreadReceivedTimestamp"
      },
      "type_threads_ThreadSentTimestamp": {
        "type": "string",
        "format": "date-time",
        "description": "Timestamp of last sent message.",
        "title": "ThreadSentTimestamp"
      },
      "type_threads_ThreadSenders": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "Senders in thread. In format `username@domain.com` or `Display Name <username@domain.com>`.",
        "title": "ThreadSenders"
      },
      "type_threads_ThreadRecipients": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "Recipients in thread. In format `username@domain.com` or `Display Name <username@domain.com>`.",
        "title": "ThreadRecipients"
      },
      "type_threads_ThreadSubject": {
        "type": "string",
        "description": "Subject of thread.",
        "title": "ThreadSubject"
      },
      "type_threads_ThreadPreview": {
        "type": "string",
        "description": "Text preview of last message in thread.",
        "title": "ThreadPreview"
      },
      "type_attachments_AttachmentId": {
        "type": "string",
        "description": "ID of attachment.",
        "title": "AttachmentId"
      },
      "type_attachments_AttachmentFilename": {
        "type": "string",
        "description": "Filename of attachment.",
        "title": "AttachmentFilename"
      },
      "type_attachments_AttachmentSize": {
        "type": "integer",
        "description": "Size of attachment in bytes.",
        "title": "AttachmentSize"
      },
      "type_attachments_AttachmentContentType": {
        "type": "string",
        "description": "Content type of attachment.",
        "title": "AttachmentContentType"
      },
      "type_attachments_AttachmentContentDisposition": {
        "type": "string",
        "enum": [
          "inline",
          "attachment"
        ],
        "description": "Content disposition of attachment.",
        "title": "AttachmentContentDisposition"
      },
      "type_attachments_AttachmentContentId": {
        "type": "string",
        "description": "Content ID of attachment.",
        "title": "AttachmentContentId"
      },
      "type_attachments_Attachment": {
        "type": "object",
        "properties": {
          "attachment_id": {
            "$ref": "#/components/schemas/type_attachments_AttachmentId"
          },
          "filename": {
            "$ref": "#/components/schemas/type_attachments_AttachmentFilename"
          },
          "size": {
            "$ref": "#/components/schemas/type_attachments_AttachmentSize"
          },
          "content_type": {
            "$ref": "#/components/schemas/type_attachments_AttachmentContentType"
          },
          "content_disposition": {
            "$ref": "#/components/schemas/type_attachments_AttachmentContentDisposition"
          },
          "content_id": {
            "$ref": "#/components/schemas/type_attachments_AttachmentContentId"
          }
        },
        "required": [
          "attachment_id",
          "size"
        ],
        "title": "Attachment"
      },
      "type_threads_ThreadAttachments": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/type_attachments_Attachment"
        },
        "description": "Attachments in thread.",
        "title": "ThreadAttachments"
      },
      "type_threads_ThreadLastMessageId": {
        "type": "string",
        "description": "ID of last message in thread.",
        "title": "ThreadLastMessageId"
      },
      "type_threads_ThreadMessageCount": {
        "type": "integer",
        "description": "Number of messages in thread.",
        "title": "ThreadMessageCount"
      },
      "type_threads_ThreadSize": {
        "type": "integer",
        "description": "Size of thread in bytes.",
        "title": "ThreadSize"
      },
      "type_threads_ThreadUpdatedAt": {
        "type": "string",
        "format": "date-time",
        "description": "Time at which thread was last updated.",
        "title": "ThreadUpdatedAt"
      },
      "type_threads_ThreadCreatedAt": {
        "type": "string",
        "format": "date-time",
        "description": "Time at which thread was created.",
        "title": "ThreadCreatedAt"
      },
      "type_threads_ThreadItem": {
        "type": "object",
        "properties": {
          "inbox_id": {
            "$ref": "#/components/schemas/type_inboxes_InboxId"
          },
          "thread_id": {
            "$ref": "#/components/schemas/type_threads_ThreadId"
          },
          "labels": {
            "$ref": "#/components/schemas/type_threads_ThreadLabels"
          },
          "timestamp": {
            "$ref": "#/components/schemas/type_threads_ThreadTimestamp"
          },
          "received_timestamp": {
            "$ref": "#/components/schemas/type_threads_ThreadReceivedTimestamp"
          },
          "sent_timestamp": {
            "$ref": "#/components/schemas/type_threads_ThreadSentTimestamp"
          },
          "senders": {
            "$ref": "#/components/schemas/type_threads_ThreadSenders"
          },
          "recipients": {
            "$ref": "#/components/schemas/type_threads_ThreadRecipients"
          },
          "subject": {
            "$ref": "#/components/schemas/type_threads_ThreadSubject"
          },
          "preview": {
            "$ref": "#/components/schemas/type_threads_ThreadPreview"
          },
          "attachments": {
            "$ref": "#/components/schemas/type_threads_ThreadAttachments"
          },
          "last_message_id": {
            "$ref": "#/components/schemas/type_threads_ThreadLastMessageId"
          },
          "message_count": {
            "$ref": "#/components/schemas/type_threads_ThreadMessageCount"
          },
          "size": {
            "$ref": "#/components/schemas/type_threads_ThreadSize"
          },
          "updated_at": {
            "$ref": "#/components/schemas/type_threads_ThreadUpdatedAt"
          },
          "created_at": {
            "$ref": "#/components/schemas/type_threads_ThreadCreatedAt"
          }
        },
        "required": [
          "inbox_id",
          "thread_id",
          "labels",
          "timestamp",
          "senders",
          "recipients",
          "last_message_id",
          "message_count",
          "size",
          "updated_at",
          "created_at"
        ],
        "title": "ThreadItem"
      },
      "type_threads_ListThreadsResponse": {
        "type": "object",
        "properties": {
          "count": {
            "$ref": "#/components/schemas/type__Count"
          },
          "limit": {
            "$ref": "#/components/schemas/type__Limit"
          },
          "next_page_token": {
            "$ref": "#/components/schemas/type__PageToken"
          },
          "threads": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/type_threads_ThreadItem"
            },
            "description": "Ordered by `timestamp` descending."
          }
        },
        "required": [
          "count",
          "threads"
        ],
        "title": "ListThreadsResponse"
      },
      "type_messages_MessageId": {
        "type": "string",
        "description": "ID of message.",
        "title": "MessageId"
      },
      "type_messages_MessageLabels": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "Labels of message.",
        "title": "MessageLabels"
      },
      "type_messages_MessageTimestamp": {
        "type": "string",
        "format": "date-time",
        "description": "Time at which message was sent or drafted.",
        "title": "MessageTimestamp"
      },
      "type_messages_MessageFrom": {
        "type": "string",
        "description": "Address of sender. In format `username@domain.com` or `Display Name <username@domain.com>`.",
        "title": "MessageFrom"
      },
      "type_messages_MessageTo": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "Addresses of recipients. In format `username@domain.com` or `Display Name <username@domain.com>`.",
        "title": "MessageTo"
      },
      "type_messages_MessageCc": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "Addresses of CC recipients. In format `username@domain.com` or `Display Name <username@domain.com>`.",
        "title": "MessageCc"
      },
      "type_messages_MessageBcc": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "Addresses of BCC recipients. In format `username@domain.com` or `Display Name <username@domain.com>`.",
        "title": "MessageBcc"
      },
      "type_messages_MessageSubject": {
        "type": "string",
        "description": "Subject of message.",
        "title": "MessageSubject"
      },
      "type_messages_MessagePreview": {
        "type": "string",
        "description": "Text preview of message.",
        "title": "MessagePreview"
      },
      "type_messages_MessageText": {
        "type": "string",
        "description": "Plain text body of message.",
        "title": "MessageText"
      },
      "type_messages_MessageHtml": {
        "type": "string",
        "description": "HTML body of message.",
        "title": "MessageHtml"
      },
      "type_messages_MessageAttachments": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/type_attachments_Attachment"
        },
        "description": "Attachments in message.",
        "title": "MessageAttachments"
      },
      "type_messages_MessageInReplyTo": {
        "type": "string",
        "description": "ID of message being replied to.",
        "title": "MessageInReplyTo"
      },
      "type_messages_MessageReferences": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "IDs of previous messages in thread.",
        "title": "MessageReferences"
      },
      "type_messages_MessageHeaders": {
        "type": "object",
        "additionalProperties": {
          "type": "string"
        },
        "description": "Headers in message.",
        "title": "MessageHeaders"
      },
      "type_messages_MessageSize": {
        "type": "integer",
        "description": "Size of message in bytes.",
        "title": "MessageSize"
      },
      "type_messages_MessageUpdatedAt": {
        "type": "string",
        "format": "date-time",
        "description": "Time at which message was last updated.",
        "title": "MessageUpdatedAt"
      },
      "type_messages_MessageCreatedAt": {
        "type": "string",
        "format": "date-time",
        "description": "Time at which message was created.",
        "title": "MessageCreatedAt"
      },
      "type_messages_Message": {
        "type": "object",
        "properties": {
          "inbox_id": {
            "$ref": "#/components/schemas/type_inboxes_InboxId"
          },
          "thread_id": {
            "$ref": "#/components/schemas/type_threads_ThreadId"
          },
          "message_id": {
            "$ref": "#/components/schemas/type_messages_MessageId"
          },
          "labels": {
            "$ref": "#/components/schemas/type_messages_MessageLabels"
          },
          "timestamp": {
            "$ref": "#/components/schemas/type_messages_MessageTimestamp"
          },
          "from": {
            "$ref": "#/components/schemas/type_messages_MessageFrom"
          },
          "reply_to": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Reply-to addresses. In format `username@domain.com` or `Display Name <username@domain.com>`."
          },
          "to": {
            "$ref": "#/components/schemas/type_messages_MessageTo"
          },
          "cc": {
            "$ref": "#/components/schemas/type_messages_MessageCc"
          },
          "bcc": {
            "$ref": "#/components/schemas/type_messages_MessageBcc"
          },
          "subject": {
            "$ref": "#/components/schemas/type_messages_MessageSubject"
          },
          "preview": {
            "$ref": "#/components/schemas/type_messages_MessagePreview"
          },
          "text": {
            "$ref": "#/components/schemas/type_messages_MessageText"
          },
          "html": {
            "$ref": "#/components/schemas/type_messages_MessageHtml"
          },
          "extracted_text": {
            "type": "string",
            "description": "Extracted new text content."
          },
          "extracted_html": {
            "type": "string",
            "description": "Extracted new HTML content."
          },
          "attachments": {
            "$ref": "#/components/schemas/type_messages_MessageAttachments"
          },
          "in_reply_to": {
            "$ref": "#/components/schemas/type_messages_MessageInReplyTo"
          },
          "references": {
            "$ref": "#/components/schemas/type_messages_MessageReferences"
          },
          "headers": {
            "$ref": "#/components/schemas/type_messages_MessageHeaders"
          },
          "size": {
            "$ref": "#/components/schemas/type_messages_MessageSize"
          },
          "updated_at": {
            "$ref": "#/components/schemas/type_messages_MessageUpdatedAt"
          },
          "created_at": {
            "$ref": "#/components/schemas/type_messages_MessageCreatedAt"
          }
        },
        "required": [
          "inbox_id",
          "thread_id",
          "message_id",
          "labels",
          "timestamp",
          "from",
          "to",
          "size",
          "updated_at",
          "created_at"
        ],
        "title": "Message"
      },
      "type_threads_Thread": {
        "type": "object",
        "properties": {
          "inbox_id": {
            "$ref": "#/components/schemas/type_inboxes_InboxId"
          },
          "thread_id": {
            "$ref": "#/components/schemas/type_threads_ThreadId"
          },
          "labels": {
            "$ref": "#/components/schemas/type_threads_ThreadLabels"
          },
          "timestamp": {
            "$ref": "#/components/schemas/type_threads_ThreadTimestamp"
          },
          "received_timestamp": {
            "$ref": "#/components/schemas/type_threads_ThreadReceivedTimestamp"
          },
          "sent_timestamp": {
            "$ref": "#/components/schemas/type_threads_ThreadSentTimestamp"
          },
          "senders": {
            "$ref": "#/components/schemas/type_threads_ThreadSenders"
          },
          "recipients": {
            "$ref": "#/components/schemas/type_threads_ThreadRecipients"
          },
          "subject": {
            "$ref": "#/components/schemas/type_threads_ThreadSubject"
          },
          "preview": {
            "$ref": "#/components/schemas/type_threads_ThreadPreview"
          },
          "attachments": {
            "$ref": "#/components/schemas/type_threads_ThreadAttachments"
          },
          "last_message_id": {
            "$ref": "#/components/schemas/type_threads_ThreadLastMessageId"
          },
          "message_count": {
            "$ref": "#/components/schemas/type_threads_ThreadMessageCount"
          },
          "size": {
            "$ref": "#/components/schemas/type_threads_ThreadSize"
          },
          "updated_at": {
            "$ref": "#/components/schemas/type_threads_ThreadUpdatedAt"
          },
          "created_at": {
            "$ref": "#/components/schemas/type_threads_ThreadCreatedAt"
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/type_messages_Message"
            },
            "description": "Messages in thread. Ordered by `timestamp` ascending."
          }
        },
        "required": [
          "inbox_id",
          "thread_id",
          "labels",
          "timestamp",
          "senders",
          "recipients",
          "last_message_id",
          "message_count",
          "size",
          "updated_at",
          "created_at",
          "messages"
        ],
        "title": "Thread"
      },
      "type_attachments_AttachmentResponse": {
        "type": "object",
        "properties": {
          "attachment_id": {
            "$ref": "#/components/schemas/type_attachments_AttachmentId"
          },
          "filename": {
            "$ref": "#/components/schemas/type_attachments_AttachmentFilename"
          },
          "size": {
            "$ref": "#/components/schemas/type_attachments_AttachmentSize"
          },
          "content_type": {
            "$ref": "#/components/schemas/type_attachments_AttachmentContentType"
          },
          "content_disposition": {
            "$ref": "#/components/schemas/type_attachments_AttachmentContentDisposition"
          },
          "content_id": {
            "$ref": "#/components/schemas/type_attachments_AttachmentContentId"
          },
          "download_url": {
            "type": "string",
            "description": "URL to download the attachment."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time at which the download URL expires."
          }
        },
        "required": [
          "attachment_id",
          "size",
          "download_url",
          "expires_at"
        ],
        "title": "AttachmentResponse"
      },
      "type_threads_UpdateThreadRequest": {
        "type": "object",
        "properties": {
          "add_labels": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Labels to add to thread. Cannot be system labels."
          },
          "remove_labels": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Labels to remove from thread. Cannot be system labels. Takes priority over `add_labels` (in the event of duplicate labels passed in)."
          }
        },
        "title": "UpdateThreadRequest"
      },
      "type_threads_UpdateThreadResponse": {
        "type": "object",
        "properties": {
          "thread_id": {
            "$ref": "#/components/schemas/type_threads_ThreadId"
          },
          "labels": {
            "$ref": "#/components/schemas/type_threads_ThreadLabels"
          }
        },
        "required": [
          "thread_id",
          "labels"
        ],
        "title": "UpdateThreadResponse"
      },
      "type_messages_MessageItem": {
        "type": "object",
        "properties": {
          "inbox_id": {
            "$ref": "#/components/schemas/type_inboxes_InboxId"
          },
          "thread_id": {
            "$ref": "#/components/schemas/type_threads_ThreadId"
          },
          "message_id": {
            "$ref": "#/components/schemas/type_messages_MessageId"
          },
          "labels": {
            "$ref": "#/components/schemas/type_messages_MessageLabels"
          },
          "timestamp": {
            "$ref": "#/components/schemas/type_messages_MessageTimestamp"
          },
          "from": {
            "$ref": "#/components/schemas/type_messages_MessageFrom"
          },
          "to": {
            "$ref": "#/components/schemas/type_messages_MessageTo"
          },
          "cc": {
            "$ref": "#/components/schemas/type_messages_MessageCc"
          },
          "bcc": {
            "$ref": "#/components/schemas/type_messages_MessageBcc"
          },
          "subject": {
            "$ref": "#/components/schemas/type_messages_MessageSubject"
          },
          "preview": {
            "$ref": "#/components/schemas/type_messages_MessagePreview"
          },
          "attachments": {
            "$ref": "#/components/schemas/type_messages_MessageAttachments"
          },
          "in_reply_to": {
            "$ref": "#/components/schemas/type_messages_MessageInReplyTo"
          },
          "references": {
            "$ref": "#/components/schemas/type_messages_MessageReferences"
          },
          "headers": {
            "$ref": "#/components/schemas/type_messages_MessageHeaders"
          },
          "size": {
            "$ref": "#/components/schemas/type_messages_MessageSize"
          },
          "updated_at": {
            "$ref": "#/components/schemas/type_messages_MessageUpdatedAt"
          },
          "created_at": {
            "$ref": "#/components/schemas/type_messages_MessageCreatedAt"
          }
        },
        "required": [
          "inbox_id",
          "thread_id",
          "message_id",
          "labels",
          "timestamp",
          "from",
          "to",
          "size",
          "updated_at",
          "created_at"
        ],
        "title": "MessageItem"
      },
      "type_messages_ListMessagesResponse": {
        "type": "object",
        "properties": {
          "count": {
            "$ref": "#/components/schemas/type__Count"
          },
          "limit": {
            "$ref": "#/components/schemas/type__Limit"
          },
          "next_page_token": {
            "$ref": "#/components/schemas/type__PageToken"
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/type_messages_MessageItem"
            },
            "description": "Ordered by `timestamp` descending."
          }
        },
        "required": [
          "count",
          "messages"
        ],
        "title": "ListMessagesResponse"
      },
      "type_messages_BatchGetMessagesMessageIds": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/type_messages_MessageId"
        },
        "description": "IDs of messages to fetch. Maximum 500 ids per request. Duplicates are\nrejected with a validation error. IDs not found in the inbox (including\ncross-inbox or permission-restricted) are silently omitted from the\nresponse; callers detect misses by comparing `count` against `limit`.",
        "title": "BatchGetMessagesMessageIds"
      },
      "type_messages_BatchGetMessagesRequest": {
        "type": "object",
        "properties": {
          "message_ids": {
            "$ref": "#/components/schemas/type_messages_BatchGetMessagesMessageIds"
          }
        },
        "required": [
          "message_ids"
        ],
        "title": "BatchGetMessagesRequest"
      },
      "type_messages_BatchGetMessagesResponse": {
        "type": "object",
        "properties": {
          "limit": {
            "$ref": "#/components/schemas/type__Limit"
          },
          "count": {
            "$ref": "#/components/schemas/type__Count"
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/type_messages_Message"
            },
            "description": "Found messages. Order matches `message_ids` in the request. Body\nfields (`text`, `html`, `extracted_text`, `extracted_html`) are\nnever populated; use the single-message endpoint to retrieve bodies."
          }
        },
        "required": [
          "limit",
          "count",
          "messages"
        ],
        "title": "BatchGetMessagesResponse"
      },
      "type_messages_RawMessageResponse": {
        "type": "object",
        "properties": {
          "message_id": {
            "$ref": "#/components/schemas/type_messages_MessageId",
            "description": "ID of the message."
          },
          "size": {
            "$ref": "#/components/schemas/type_messages_MessageSize",
            "description": "Size of the raw message in bytes."
          },
          "download_url": {
            "type": "string",
            "description": "S3 presigned URL to download the raw message. Expires at expires_at."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time at which the download URL expires."
          }
        },
        "required": [
          "message_id",
          "size",
          "download_url",
          "expires_at"
        ],
        "description": "S3 presigned URL to download the raw .eml file.",
        "title": "RawMessageResponse"
      },
      "type_messages_UpdateMessageLabels": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        ],
        "description": "Label or list of labels.",
        "title": "UpdateMessageLabels"
      },
      "type_messages_UpdateMessageRequest": {
        "type": "object",
        "properties": {
          "add_labels": {
            "$ref": "#/components/schemas/type_messages_UpdateMessageLabels",
            "description": "Label or labels to add to message."
          },
          "remove_labels": {
            "$ref": "#/components/schemas/type_messages_UpdateMessageLabels",
            "description": "Label or labels to remove from message."
          }
        },
        "title": "UpdateMessageRequest"
      },
      "type_messages_UpdateMessageResponse": {
        "type": "object",
        "properties": {
          "message_id": {
            "$ref": "#/components/schemas/type_messages_MessageId"
          },
          "labels": {
            "$ref": "#/components/schemas/type_messages_MessageLabels"
          }
        },
        "required": [
          "message_id",
          "labels"
        ],
        "title": "UpdateMessageResponse"
      },
      "type_messages_Addresses": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        ],
        "title": "Addresses"
      },
      "type_messages_SendMessageReplyTo": {
        "$ref": "#/components/schemas/type_messages_Addresses",
        "description": "Reply-to address or addresses.",
        "title": "SendMessageReplyTo"
      },
      "type_messages_SendMessageTo": {
        "$ref": "#/components/schemas/type_messages_Addresses",
        "description": "Recipient address or addresses.",
        "title": "SendMessageTo"
      },
      "type_messages_SendMessageCc": {
        "$ref": "#/components/schemas/type_messages_Addresses",
        "description": "CC recipient address or addresses.",
        "title": "SendMessageCc"
      },
      "type_messages_SendMessageBcc": {
        "$ref": "#/components/schemas/type_messages_Addresses",
        "description": "BCC recipient address or addresses.",
        "title": "SendMessageBcc"
      },
      "type_attachments_SendAttachment": {
        "type": "object",
        "properties": {
          "filename": {
            "$ref": "#/components/schemas/type_attachments_AttachmentFilename"
          },
          "content_type": {
            "$ref": "#/components/schemas/type_attachments_AttachmentContentType"
          },
          "content_disposition": {
            "$ref": "#/components/schemas/type_attachments_AttachmentContentDisposition"
          },
          "content_id": {
            "$ref": "#/components/schemas/type_attachments_AttachmentContentId"
          },
          "content": {
            "type": "string",
            "description": "Base64 encoded content of attachment."
          },
          "url": {
            "type": "string",
            "description": "URL to the attachment."
          }
        },
        "title": "SendAttachment"
      },
      "type_messages_SendMessageAttachments": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/type_attachments_SendAttachment"
        },
        "description": "Attachments to include in message.",
        "title": "SendMessageAttachments"
      },
      "type_messages_SendMessageHeaders": {
        "type": "object",
        "additionalProperties": {
          "type": "string"
        },
        "description": "Headers to include in message.",
        "title": "SendMessageHeaders"
      },
      "type_messages_SendMessageRequest": {
        "type": "object",
        "properties": {
          "labels": {
            "$ref": "#/components/schemas/type_messages_MessageLabels"
          },
          "reply_to": {
            "$ref": "#/components/schemas/type_messages_SendMessageReplyTo"
          },
          "to": {
            "$ref": "#/components/schemas/type_messages_SendMessageTo"
          },
          "cc": {
            "$ref": "#/components/schemas/type_messages_SendMessageCc"
          },
          "bcc": {
            "$ref": "#/components/schemas/type_messages_SendMessageBcc"
          },
          "subject": {
            "$ref": "#/components/schemas/type_messages_MessageSubject"
          },
          "text": {
            "$ref": "#/components/schemas/type_messages_MessageText"
          },
          "html": {
            "$ref": "#/components/schemas/type_messages_MessageHtml"
          },
          "attachments": {
            "$ref": "#/components/schemas/type_messages_SendMessageAttachments"
          },
          "headers": {
            "$ref": "#/components/schemas/type_messages_SendMessageHeaders"
          }
        },
        "title": "SendMessageRequest"
      },
      "type_messages_SendMessageResponse": {
        "type": "object",
        "properties": {
          "message_id": {
            "$ref": "#/components/schemas/type_messages_MessageId"
          },
          "thread_id": {
            "$ref": "#/components/schemas/type_threads_ThreadId"
          }
        },
        "required": [
          "message_id",
          "thread_id"
        ],
        "title": "SendMessageResponse"
      },
      "type_messages_ReplyAll": {
        "type": "boolean",
        "description": "Reply to all recipients of the original message.",
        "title": "ReplyAll"
      },
      "type_messages_ReplyToMessageRequest": {
        "type": "object",
        "properties": {
          "labels": {
            "$ref": "#/components/schemas/type_messages_MessageLabels"
          },
          "reply_to": {
            "$ref": "#/components/schemas/type_messages_SendMessageReplyTo"
          },
          "to": {
            "$ref": "#/components/schemas/type_messages_SendMessageTo"
          },
          "cc": {
            "$ref": "#/components/schemas/type_messages_SendMessageCc"
          },
          "bcc": {
            "$ref": "#/components/schemas/type_messages_SendMessageBcc"
          },
          "reply_all": {
            "$ref": "#/components/schemas/type_messages_ReplyAll"
          },
          "text": {
            "$ref": "#/components/schemas/type_messages_MessageText"
          },
          "html": {
            "$ref": "#/components/schemas/type_messages_MessageHtml"
          },
          "attachments": {
            "$ref": "#/components/schemas/type_messages_SendMessageAttachments"
          },
          "headers": {
            "$ref": "#/components/schemas/type_messages_SendMessageHeaders"
          }
        },
        "title": "ReplyToMessageRequest"
      },
      "type_messages_ReplyAllMessageRequest": {
        "type": "object",
        "properties": {
          "labels": {
            "$ref": "#/components/schemas/type_messages_MessageLabels"
          },
          "reply_to": {
            "$ref": "#/components/schemas/type_messages_SendMessageReplyTo"
          },
          "text": {
            "$ref": "#/components/schemas/type_messages_MessageText"
          },
          "html": {
            "$ref": "#/components/schemas/type_messages_MessageHtml"
          },
          "attachments": {
            "$ref": "#/components/schemas/type_messages_SendMessageAttachments"
          },
          "headers": {
            "$ref": "#/components/schemas/type_messages_SendMessageHeaders"
          }
        },
        "title": "ReplyAllMessageRequest"
      },
      "type_drafts_DraftId": {
        "type": "string",
        "description": "ID of draft.",
        "title": "DraftId"
      },
      "type_drafts_DraftLabels": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "Labels of draft.",
        "title": "DraftLabels"
      },
      "type_drafts_DraftTo": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "Addresses of recipients. In format `username@domain.com` or `Display Name <username@domain.com>`.",
        "title": "DraftTo"
      },
      "type_drafts_DraftCc": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "Addresses of CC recipients. In format `username@domain.com` or `Display Name <username@domain.com>`.",
        "title": "DraftCc"
      },
      "type_drafts_DraftBcc": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "Addresses of BCC recipients. In format `username@domain.com` or `Display Name <username@domain.com>`.",
        "title": "DraftBcc"
      },
      "type_drafts_DraftSubject": {
        "type": "string",
        "description": "Subject of draft.",
        "title": "DraftSubject"
      },
      "type_drafts_DraftPreview": {
        "type": "string",
        "description": "Text preview of draft.",
        "title": "DraftPreview"
      },
      "type_drafts_DraftAttachments": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/type_attachments_Attachment"
        },
        "description": "Attachments in draft.",
        "title": "DraftAttachments"
      },
      "type_drafts_DraftInReplyTo": {
        "type": "string",
        "description": "ID of message being replied to.",
        "title": "DraftInReplyTo"
      },
      "type_drafts_DraftSendStatus": {
        "type": "string",
        "enum": [
          "scheduled",
          "sending",
          "failed"
        ],
        "description": "Schedule send status of draft.",
        "title": "DraftSendStatus"
      },
      "type_drafts_DraftSendAt": {
        "type": "string",
        "format": "date-time",
        "description": "Time at which to schedule send draft.",
        "title": "DraftSendAt"
      },
      "type_drafts_DraftUpdatedAt": {
        "type": "string",
        "format": "date-time",
        "description": "Time at which draft was last updated.",
        "title": "DraftUpdatedAt"
      },
      "type_drafts_DraftItem": {
        "type": "object",
        "properties": {
          "inbox_id": {
            "$ref": "#/components/schemas/type_inboxes_InboxId"
          },
          "draft_id": {
            "$ref": "#/components/schemas/type_drafts_DraftId"
          },
          "labels": {
            "$ref": "#/components/schemas/type_drafts_DraftLabels"
          },
          "to": {
            "$ref": "#/components/schemas/type_drafts_DraftTo"
          },
          "cc": {
            "$ref": "#/components/schemas/type_drafts_DraftCc"
          },
          "bcc": {
            "$ref": "#/components/schemas/type_drafts_DraftBcc"
          },
          "subject": {
            "$ref": "#/components/schemas/type_drafts_DraftSubject"
          },
          "preview": {
            "$ref": "#/components/schemas/type_drafts_DraftPreview"
          },
          "attachments": {
            "$ref": "#/components/schemas/type_drafts_DraftAttachments"
          },
          "in_reply_to": {
            "$ref": "#/components/schemas/type_drafts_DraftInReplyTo"
          },
          "send_status": {
            "$ref": "#/components/schemas/type_drafts_DraftSendStatus"
          },
          "send_at": {
            "$ref": "#/components/schemas/type_drafts_DraftSendAt"
          },
          "updated_at": {
            "$ref": "#/components/schemas/type_drafts_DraftUpdatedAt"
          }
        },
        "required": [
          "inbox_id",
          "draft_id",
          "labels",
          "updated_at"
        ],
        "title": "DraftItem"
      },
      "type_drafts_ListDraftsResponse": {
        "type": "object",
        "properties": {
          "count": {
            "$ref": "#/components/schemas/type__Count"
          },
          "limit": {
            "$ref": "#/components/schemas/type__Limit"
          },
          "next_page_token": {
            "$ref": "#/components/schemas/type__PageToken"
          },
          "drafts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/type_drafts_DraftItem"
            },
            "description": "Ordered by `updated_at` descending."
          }
        },
        "required": [
          "count",
          "drafts"
        ],
        "title": "ListDraftsResponse"
      },
      "type_drafts_DraftClientId": {
        "type": "string",
        "description": "Client ID of draft.",
        "title": "DraftClientId"
      },
      "type_drafts_DraftReplyTo": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "Reply-to addresses. In format `username@domain.com` or `Display Name <username@domain.com>`.",
        "title": "DraftReplyTo"
      },
      "type_drafts_DraftText": {
        "type": "string",
        "description": "Plain text body of draft.",
        "title": "DraftText"
      },
      "type_drafts_DraftHtml": {
        "type": "string",
        "description": "HTML body of draft.",
        "title": "DraftHtml"
      },
      "type_drafts_Draft": {
        "type": "object",
        "properties": {
          "inbox_id": {
            "$ref": "#/components/schemas/type_inboxes_InboxId"
          },
          "draft_id": {
            "$ref": "#/components/schemas/type_drafts_DraftId"
          },
          "client_id": {
            "$ref": "#/components/schemas/type_drafts_DraftClientId"
          },
          "labels": {
            "$ref": "#/components/schemas/type_drafts_DraftLabels"
          },
          "reply_to": {
            "$ref": "#/components/schemas/type_drafts_DraftReplyTo"
          },
          "to": {
            "$ref": "#/components/schemas/type_drafts_DraftTo"
          },
          "cc": {
            "$ref": "#/components/schemas/type_drafts_DraftCc"
          },
          "bcc": {
            "$ref": "#/components/schemas/type_drafts_DraftBcc"
          },
          "subject": {
            "$ref": "#/components/schemas/type_drafts_DraftSubject"
          },
          "preview": {
            "$ref": "#/components/schemas/type_drafts_DraftPreview"
          },
          "text": {
            "$ref": "#/components/schemas/type_drafts_DraftText"
          },
          "html": {
            "$ref": "#/components/schemas/type_drafts_DraftHtml"
          },
          "attachments": {
            "$ref": "#/components/schemas/type_drafts_DraftAttachments"
          },
          "in_reply_to": {
            "$ref": "#/components/schemas/type_drafts_DraftInReplyTo"
          },
          "references": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "IDs of previous messages in thread."
          },
          "send_status": {
            "$ref": "#/components/schemas/type_drafts_DraftSendStatus"
          },
          "send_at": {
            "$ref": "#/components/schemas/type_drafts_DraftSendAt"
          },
          "updated_at": {
            "$ref": "#/components/schemas/type_drafts_DraftUpdatedAt"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time at which draft was created."
          }
        },
        "required": [
          "inbox_id",
          "draft_id",
          "labels",
          "updated_at",
          "created_at"
        ],
        "title": "Draft"
      },
      "type_drafts_CreateDraftRequest": {
        "type": "object",
        "properties": {
          "labels": {
            "$ref": "#/components/schemas/type_drafts_DraftLabels"
          },
          "reply_to": {
            "$ref": "#/components/schemas/type_drafts_DraftReplyTo"
          },
          "to": {
            "$ref": "#/components/schemas/type_drafts_DraftTo"
          },
          "cc": {
            "$ref": "#/components/schemas/type_drafts_DraftCc"
          },
          "bcc": {
            "$ref": "#/components/schemas/type_drafts_DraftBcc"
          },
          "subject": {
            "$ref": "#/components/schemas/type_drafts_DraftSubject"
          },
          "text": {
            "$ref": "#/components/schemas/type_drafts_DraftText"
          },
          "html": {
            "$ref": "#/components/schemas/type_drafts_DraftHtml"
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/type_attachments_SendAttachment"
            },
            "description": "Attachments to include in draft."
          },
          "in_reply_to": {
            "$ref": "#/components/schemas/type_drafts_DraftInReplyTo"
          },
          "send_at": {
            "$ref": "#/components/schemas/type_drafts_DraftSendAt"
          },
          "client_id": {
            "$ref": "#/components/schemas/type_drafts_DraftClientId"
          }
        },
        "title": "CreateDraftRequest"
      },
      "type_drafts_UpdateDraftRequest": {
        "type": "object",
        "properties": {
          "reply_to": {
            "$ref": "#/components/schemas/type_drafts_DraftReplyTo"
          },
          "to": {
            "$ref": "#/components/schemas/type_drafts_DraftTo"
          },
          "cc": {
            "$ref": "#/components/schemas/type_drafts_DraftCc"
          },
          "bcc": {
            "$ref": "#/components/schemas/type_drafts_DraftBcc"
          },
          "subject": {
            "$ref": "#/components/schemas/type_drafts_DraftSubject"
          },
          "text": {
            "$ref": "#/components/schemas/type_drafts_DraftText"
          },
          "html": {
            "$ref": "#/components/schemas/type_drafts_DraftHtml"
          },
          "send_at": {
            "$ref": "#/components/schemas/type_drafts_DraftSendAt"
          }
        },
        "title": "UpdateDraftRequest"
      },
      "type_lists_Direction": {
        "type": "string",
        "enum": [
          "send",
          "receive",
          "reply"
        ],
        "description": "Direction of list entry.",
        "title": "Direction"
      },
      "type_lists_ListType": {
        "type": "string",
        "enum": [
          "allow",
          "block"
        ],
        "description": "Type of list entry.",
        "title": "ListType"
      },
      "type__OrganizationId": {
        "type": "string",
        "description": "ID of organization.",
        "title": "OrganizationId"
      },
      "type_lists_EntryType": {
        "type": "string",
        "enum": [
          "email",
          "domain"
        ],
        "description": "Whether the entry is an email address or domain.",
        "title": "EntryType"
      },
      "type_lists_PodListEntry": {
        "type": "object",
        "properties": {
          "entry": {
            "type": "string",
            "description": "Email address or domain of list entry."
          },
          "organization_id": {
            "$ref": "#/components/schemas/type__OrganizationId"
          },
          "reason": {
            "type": "string",
            "description": "Reason for adding the entry."
          },
          "direction": {
            "$ref": "#/components/schemas/type_lists_Direction"
          },
          "list_type": {
            "$ref": "#/components/schemas/type_lists_ListType"
          },
          "entry_type": {
            "$ref": "#/components/schemas/type_lists_EntryType"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time at which entry was created."
          },
          "read_only": {
            "type": "boolean",
            "description": "Whether the entry is read-only and cannot be deleted via the API."
          },
          "pod_id": {
            "type": "string",
            "description": "ID of pod."
          },
          "inbox_id": {
            "type": "string",
            "description": "ID of inbox, if entry is inbox-scoped."
          }
        },
        "required": [
          "entry",
          "organization_id",
          "direction",
          "list_type",
          "entry_type",
          "created_at",
          "pod_id"
        ],
        "title": "PodListEntry"
      },
      "type_lists_PodListListEntriesResponse": {
        "type": "object",
        "properties": {
          "count": {
            "$ref": "#/components/schemas/type__Count"
          },
          "limit": {
            "$ref": "#/components/schemas/type__Limit"
          },
          "next_page_token": {
            "$ref": "#/components/schemas/type__PageToken"
          },
          "entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/type_lists_PodListEntry"
            },
            "description": "Ordered by entry ascending."
          }
        },
        "required": [
          "count",
          "entries"
        ],
        "title": "PodListListEntriesResponse"
      },
      "type_lists_CreateListEntryRequest": {
        "type": "object",
        "properties": {
          "entry": {
            "type": "string",
            "description": "Email address or domain to add."
          },
          "reason": {
            "type": "string",
            "description": "Reason for adding the entry."
          }
        },
        "required": [
          "entry"
        ],
        "title": "CreateListEntryRequest"
      },
      "type_metrics_MetricEventType": {
        "type": "string",
        "enum": [
          "message.sent",
          "message.delivered",
          "message.bounced",
          "message.delayed",
          "message.rejected",
          "message.complained",
          "message.received"
        ],
        "description": "Type of metric event.",
        "title": "MetricEventType"
      },
      "type_metrics_MetricEventTypes": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/type_metrics_MetricEventType"
        },
        "description": "List of metric event types to query.",
        "title": "MetricEventTypes"
      },
      "type_metrics_Start": {
        "type": "string",
        "format": "date-time",
        "description": "Start timestamp for the query.",
        "title": "Start"
      },
      "type_metrics_End": {
        "type": "string",
        "format": "date-time",
        "description": "End timestamp for the query.",
        "title": "End"
      },
      "type_metrics_Period": {
        "type": "string",
        "description": "Period in number of seconds for the query.",
        "title": "Period"
      },
      "type_metrics_MetricLimit": {
        "type": "integer",
        "description": "Limit on number of buckets to return.",
        "title": "MetricLimit"
      },
      "type_metrics_Descending": {
        "type": "boolean",
        "description": "Sort in descending order.",
        "title": "Descending"
      },
      "type_metrics_MetricBucket": {
        "type": "object",
        "properties": {
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp of the bucket."
          },
          "count": {
            "type": "integer",
            "description": "Count of events in the bucket."
          }
        },
        "required": [
          "timestamp",
          "count"
        ],
        "title": "MetricBucket"
      },
      "type_metrics_QueryMetricsResponse": {
        "type": "object",
        "additionalProperties": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/type_metrics_MetricBucket"
          }
        },
        "description": "Metrics grouped by event type.",
        "title": "QueryMetricsResponse"
      },
      "type_inbox-events_InboxEventId": {
        "type": "string",
        "description": "ID of event.",
        "title": "InboxEventId"
      },
      "type_inbox-events_InboxEventType": {
        "type": "string",
        "enum": [
          "label.added",
          "label.removed"
        ],
        "description": "Type of inbox event. Wire format is dot.case to match the\nconvention used by webhook events (`message.received`,\n`domain.verified`, etc. in events.yml). Pre-2026-04 these were\n`label_added`/`label_removed` (snake_case). The Fern enum's `name`\nfield stays uppercase-snake (Fern convention); only the wire\n`value` changed.",
        "title": "InboxEventType"
      },
      "type_inbox-events_InboxEvent": {
        "type": "object",
        "properties": {
          "organization_id": {
            "$ref": "#/components/schemas/type__OrganizationId"
          },
          "pod_id": {
            "type": "string",
            "description": "ID of pod."
          },
          "inbox_id": {
            "$ref": "#/components/schemas/type_inboxes_InboxId"
          },
          "event_id": {
            "$ref": "#/components/schemas/type_inbox-events_InboxEventId"
          },
          "event_type": {
            "$ref": "#/components/schemas/type_inbox-events_InboxEventType"
          },
          "message_id": {
            "type": "string",
            "description": "ID of message."
          },
          "label": {
            "type": "string",
            "description": "Label added or removed."
          },
          "event_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time at which the event occurred."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time at which the event was recorded."
          }
        },
        "required": [
          "organization_id",
          "pod_id",
          "inbox_id",
          "event_id",
          "event_type",
          "message_id",
          "label",
          "event_at",
          "created_at"
        ],
        "title": "InboxEvent"
      },
      "type_inbox-events_ListInboxEventsResponse": {
        "type": "object",
        "properties": {
          "count": {
            "$ref": "#/components/schemas/type__Count"
          },
          "limit": {
            "$ref": "#/components/schemas/type__Limit"
          },
          "next_page_token": {
            "$ref": "#/components/schemas/type__PageToken"
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/type_inbox-events_InboxEvent"
            },
            "description": "Ordered by `event_id` descending."
          }
        },
        "required": [
          "count",
          "events"
        ],
        "title": "ListInboxEventsResponse"
      },
      "type_api-keys_ApiKeyId": {
        "type": "string",
        "description": "ID of api key.",
        "title": "ApiKeyId"
      },
      "type_api-keys_Prefix": {
        "type": "string",
        "description": "Prefix of api key.",
        "title": "Prefix"
      },
      "type_api-keys_Name": {
        "type": "string",
        "description": "Name of api key.",
        "title": "Name"
      },
      "type_api-keys_ApiKeyPermissions": {
        "type": "object",
        "properties": {
          "inbox_read": {
            "type": "boolean",
            "description": "Read inbox details."
          },
          "inbox_create": {
            "type": "boolean",
            "description": "Create new inboxes."
          },
          "inbox_update": {
            "type": "boolean",
            "description": "Update inbox settings."
          },
          "inbox_delete": {
            "type": "boolean",
            "description": "Delete inboxes."
          },
          "thread_read": {
            "type": "boolean",
            "description": "Read threads."
          },
          "thread_delete": {
            "type": "boolean",
            "description": "Delete threads."
          },
          "message_read": {
            "type": "boolean",
            "description": "Read messages."
          },
          "message_send": {
            "type": "boolean",
            "description": "Send messages."
          },
          "message_update": {
            "type": "boolean",
            "description": "Update message labels."
          },
          "label_spam_read": {
            "type": "boolean",
            "description": "Access messages labeled spam."
          },
          "label_blocked_read": {
            "type": "boolean",
            "description": "Access messages labeled blocked."
          },
          "label_trash_read": {
            "type": "boolean",
            "description": "Access messages labeled trash."
          },
          "draft_read": {
            "type": "boolean",
            "description": "Read drafts."
          },
          "draft_create": {
            "type": "boolean",
            "description": "Create drafts."
          },
          "draft_update": {
            "type": "boolean",
            "description": "Update drafts."
          },
          "draft_delete": {
            "type": "boolean",
            "description": "Delete drafts."
          },
          "draft_send": {
            "type": "boolean",
            "description": "Send drafts."
          },
          "webhook_read": {
            "type": "boolean",
            "description": "Read webhook configurations."
          },
          "webhook_create": {
            "type": "boolean",
            "description": "Create webhooks."
          },
          "webhook_update": {
            "type": "boolean",
            "description": "Update webhooks."
          },
          "webhook_delete": {
            "type": "boolean",
            "description": "Delete webhooks."
          },
          "domain_read": {
            "type": "boolean",
            "description": "Read domain details."
          },
          "domain_create": {
            "type": "boolean",
            "description": "Create domains."
          },
          "domain_update": {
            "type": "boolean",
            "description": "Update domains."
          },
          "domain_delete": {
            "type": "boolean",
            "description": "Delete domains."
          },
          "list_entry_read": {
            "type": "boolean",
            "description": "Read list entries."
          },
          "list_entry_create": {
            "type": "boolean",
            "description": "Create list entries."
          },
          "list_entry_delete": {
            "type": "boolean",
            "description": "Delete list entries."
          },
          "metrics_read": {
            "type": "boolean",
            "description": "Read metrics."
          },
          "api_key_read": {
            "type": "boolean",
            "description": "Read API keys."
          },
          "api_key_create": {
            "type": "boolean",
            "description": "Create API keys."
          },
          "api_key_delete": {
            "type": "boolean",
            "description": "Delete API keys."
          },
          "pod_read": {
            "type": "boolean",
            "description": "Read pods."
          },
          "pod_create": {
            "type": "boolean",
            "description": "Create pods."
          },
          "pod_delete": {
            "type": "boolean",
            "description": "Delete pods."
          }
        },
        "description": "Granular permissions for the API key. When ommitted all permissions are granted. Otherwise, only permissions set to true are granted.",
        "title": "ApiKeyPermissions"
      },
      "type_api-keys_CreatedAt": {
        "type": "string",
        "format": "date-time",
        "description": "Time at which api key was created.",
        "title": "CreatedAt"
      },
      "type_api-keys_ApiKey": {
        "type": "object",
        "properties": {
          "api_key_id": {
            "$ref": "#/components/schemas/type_api-keys_ApiKeyId"
          },
          "prefix": {
            "$ref": "#/components/schemas/type_api-keys_Prefix"
          },
          "name": {
            "$ref": "#/components/schemas/type_api-keys_Name"
          },
          "pod_id": {
            "type": "string",
            "description": "Pod ID the api key is scoped to. If set, the key can only access resources within this pod."
          },
          "inbox_id": {
            "type": "string",
            "description": "Inbox ID the api key is scoped to. If set, the key can only access resources within this inbox."
          },
          "used_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time at which api key was last used."
          },
          "permissions": {
            "$ref": "#/components/schemas/type_api-keys_ApiKeyPermissions"
          },
          "created_at": {
            "$ref": "#/components/schemas/type_api-keys_CreatedAt"
          }
        },
        "required": [
          "api_key_id",
          "prefix",
          "name",
          "created_at"
        ],
        "title": "ApiKey"
      },
      "type_api-keys_ListApiKeysResponse": {
        "type": "object",
        "properties": {
          "count": {
            "$ref": "#/components/schemas/type__Count"
          },
          "next_page_token": {
            "$ref": "#/components/schemas/type__PageToken"
          },
          "api_keys": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/type_api-keys_ApiKey"
            },
            "description": "Ordered by `created_at` descending."
          }
        },
        "required": [
          "count",
          "api_keys"
        ],
        "title": "ListApiKeysResponse"
      },
      "type_api-keys_CreateApiKeyRequest": {
        "type": "object",
        "properties": {
          "name": {
            "$ref": "#/components/schemas/type_api-keys_Name"
          },
          "permissions": {
            "$ref": "#/components/schemas/type_api-keys_ApiKeyPermissions"
          }
        },
        "title": "CreateApiKeyRequest"
      },
      "type_api-keys_CreateApiKeyResponse": {
        "type": "object",
        "properties": {
          "api_key_id": {
            "$ref": "#/components/schemas/type_api-keys_ApiKeyId"
          },
          "api_key": {
            "type": "string",
            "description": "API key."
          },
          "prefix": {
            "$ref": "#/components/schemas/type_api-keys_Prefix"
          },
          "name": {
            "$ref": "#/components/schemas/type_api-keys_Name"
          },
          "pod_id": {
            "type": "string",
            "description": "Pod ID the api key is scoped to."
          },
          "inbox_id": {
            "type": "string",
            "description": "Inbox ID the api key is scoped to."
          },
          "permissions": {
            "$ref": "#/components/schemas/type_api-keys_ApiKeyPermissions"
          },
          "created_at": {
            "$ref": "#/components/schemas/type_api-keys_CreatedAt"
          }
        },
        "required": [
          "api_key_id",
          "api_key",
          "prefix",
          "name",
          "created_at"
        ],
        "title": "CreateApiKeyResponse"
      },
      "type_webhooks_WebhookId": {
        "type": "string",
        "description": "ID of webhook.",
        "title": "WebhookId"
      },
      "type_webhooks_Url": {
        "type": "string",
        "description": "URL of webhook endpoint.",
        "title": "Url"
      },
      "type_events_EventType": {
        "type": "string",
        "enum": [
          "message.received",
          "message.received.spam",
          "message.received.blocked",
          "message.received.unauthenticated",
          "message.sent",
          "message.delivered",
          "message.bounced",
          "message.complained",
          "message.rejected",
          "domain.verified"
        ],
        "title": "EventType"
      },
      "type_events_EventTypes": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/type_events_EventType"
        },
        "description": "Event types for which to send events.",
        "title": "EventTypes"
      },
      "type_events_PodIds": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "Pods for which to send events. Maximum 10 per webhook.",
        "title": "PodIds"
      },
      "type_events_InboxIds": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "Inboxes for which to send events. Maximum 10 per webhook.",
        "title": "InboxIds"
      },
      "type_webhooks_ClientId": {
        "type": "string",
        "description": "Client ID of webhook.",
        "title": "ClientId"
      },
      "type_webhooks_Webhook": {
        "type": "object",
        "properties": {
          "webhook_id": {
            "$ref": "#/components/schemas/type_webhooks_WebhookId"
          },
          "url": {
            "$ref": "#/components/schemas/type_webhooks_Url"
          },
          "event_types": {
            "$ref": "#/components/schemas/type_events_EventTypes"
          },
          "pod_ids": {
            "$ref": "#/components/schemas/type_events_PodIds"
          },
          "inbox_ids": {
            "$ref": "#/components/schemas/type_events_InboxIds"
          },
          "secret": {
            "type": "string",
            "description": "Secret for webhook signature verification."
          },
          "enabled": {
            "type": "boolean",
            "description": "Webhook is enabled."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time at which webhook was last updated."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time at which webhook was created."
          },
          "client_id": {
            "$ref": "#/components/schemas/type_webhooks_ClientId"
          }
        },
        "required": [
          "webhook_id",
          "url",
          "secret",
          "enabled",
          "updated_at",
          "created_at"
        ],
        "title": "Webhook"
      },
      "type_webhooks_ListWebhooksResponse": {
        "type": "object",
        "properties": {
          "count": {
            "$ref": "#/components/schemas/type__Count"
          },
          "limit": {
            "$ref": "#/components/schemas/type__Limit"
          },
          "next_page_token": {
            "$ref": "#/components/schemas/type__PageToken"
          },
          "webhooks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/type_webhooks_Webhook"
            },
            "description": "Ordered by `created_at` descending."
          }
        },
        "required": [
          "count",
          "webhooks"
        ],
        "title": "ListWebhooksResponse"
      },
      "type_webhooks_CreateWebhookRequest": {
        "type": "object",
        "properties": {
          "url": {
            "$ref": "#/components/schemas/type_webhooks_Url"
          },
          "event_types": {
            "$ref": "#/components/schemas/type_events_EventTypes",
            "description": "Full list of event types this webhook should receive. At least one type is required. Send every type you\nwant in this array (not incremental). See [Webhooks overview](https://docs.agentmail.to/webhooks-overview)\nfor spam, blocked, and unauthenticated events and required permissions."
          },
          "pod_ids": {
            "$ref": "#/components/schemas/type_events_PodIds"
          },
          "inbox_ids": {
            "$ref": "#/components/schemas/type_events_InboxIds"
          },
          "client_id": {
            "$ref": "#/components/schemas/type_webhooks_ClientId"
          }
        },
        "required": [
          "url",
          "event_types"
        ],
        "title": "CreateWebhookRequest"
      },
      "type_webhooks_UpdateWebhookRequest": {
        "type": "object",
        "properties": {
          "add_inbox_ids": {
            "$ref": "#/components/schemas/type_events_InboxIds",
            "description": "Inbox IDs to subscribe to the webhook."
          },
          "remove_inbox_ids": {
            "$ref": "#/components/schemas/type_events_InboxIds",
            "description": "Inbox IDs to unsubscribe from the webhook."
          },
          "add_pod_ids": {
            "$ref": "#/components/schemas/type_events_PodIds",
            "description": "Pod IDs to subscribe to the webhook."
          },
          "remove_pod_ids": {
            "$ref": "#/components/schemas/type_events_PodIds",
            "description": "Pod IDs to unsubscribe from the webhook."
          },
          "event_types": {
            "$ref": "#/components/schemas/type_events_EventTypes",
            "description": "When you send a non-empty list, it replaces the webhook's subscribed event types in full (the same\n\"set the list\" behavior as create). It is not a merge or diff: include every event type you want after\nthe update. Sending a one-element array means the webhook will only receive that one type afterward.\nOmit this field or send an empty array to leave event types unchanged. Clearing all types with an empty\nlist is not supported. Subscribing to `message.received.spam`, `message.received.blocked`, or\n`message.received.unauthenticated` requires the matching label permission on the API key."
          }
        },
        "title": "UpdateWebhookRequest"
      },
      "type_domains_DomainId": {
        "type": "string",
        "description": "The ID of the domain.",
        "title": "DomainId"
      },
      "type_domains_DomainName": {
        "type": "string",
        "description": "The name of the domain (e.g., `example.com`).",
        "title": "DomainName"
      },
      "type_domains_FeedbackEnabled": {
        "type": "boolean",
        "description": "Bounce and complaint notifications are sent to your inboxes.",
        "title": "FeedbackEnabled"
      },
      "type_domains_ClientId": {
        "type": "string",
        "description": "Client ID of domain.",
        "title": "ClientId"
      },
      "type_domains_DomainItem": {
        "type": "object",
        "properties": {
          "pod_id": {
            "$ref": "#/components/schemas/type_pods_PodId"
          },
          "domain_id": {
            "$ref": "#/components/schemas/type_domains_DomainId"
          },
          "domain": {
            "$ref": "#/components/schemas/type_domains_DomainName"
          },
          "feedback_enabled": {
            "$ref": "#/components/schemas/type_domains_FeedbackEnabled"
          },
          "client_id": {
            "$ref": "#/components/schemas/type_domains_ClientId"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time at which the domain was last updated."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time at which the domain was created."
          }
        },
        "required": [
          "domain_id",
          "domain",
          "feedback_enabled",
          "updated_at",
          "created_at"
        ],
        "title": "DomainItem"
      },
      "type_domains_ListDomainsResponse": {
        "type": "object",
        "properties": {
          "count": {
            "$ref": "#/components/schemas/type__Count"
          },
          "limit": {
            "$ref": "#/components/schemas/type__Limit"
          },
          "next_page_token": {
            "$ref": "#/components/schemas/type__PageToken"
          },
          "domains": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/type_domains_DomainItem"
            },
            "description": "Ordered by `created_at` descending."
          }
        },
        "required": [
          "count",
          "domains"
        ],
        "title": "ListDomainsResponse"
      },
      "type_domains_VerificationStatus": {
        "type": "string",
        "enum": [
          "NOT_STARTED",
          "PENDING",
          "INVALID",
          "FAILED",
          "VERIFYING",
          "VERIFIED"
        ],
        "title": "VerificationStatus"
      },
      "type_domains_Status": {
        "$ref": "#/components/schemas/type_domains_VerificationStatus",
        "description": "The verification status of the domain.",
        "title": "Status"
      },
      "type_domains_RecordType": {
        "type": "string",
        "enum": [
          "TXT",
          "CNAME",
          "MX"
        ],
        "title": "RecordType"
      },
      "type_domains_RecordStatus": {
        "type": "string",
        "enum": [
          "MISSING",
          "INVALID",
          "VALID"
        ],
        "title": "RecordStatus"
      },
      "type_domains_VerificationRecord": {
        "type": "object",
        "properties": {
          "type": {
            "$ref": "#/components/schemas/type_domains_RecordType",
            "description": "The type of the DNS record."
          },
          "name": {
            "type": "string",
            "description": "The name or host of the record."
          },
          "value": {
            "type": "string",
            "description": "The value of the record."
          },
          "status": {
            "$ref": "#/components/schemas/type_domains_RecordStatus",
            "description": "The verification status of this specific record."
          },
          "priority": {
            "type": "integer",
            "description": "The priority of the MX record."
          }
        },
        "required": [
          "type",
          "name",
          "value",
          "status"
        ],
        "title": "VerificationRecord"
      },
      "type_domains_Domain": {
        "type": "object",
        "properties": {
          "pod_id": {
            "$ref": "#/components/schemas/type_pods_PodId"
          },
          "domain_id": {
            "$ref": "#/components/schemas/type_domains_DomainId"
          },
          "domain": {
            "$ref": "#/components/schemas/type_domains_DomainName"
          },
          "status": {
            "$ref": "#/components/schemas/type_domains_Status"
          },
          "feedback_enabled": {
            "$ref": "#/components/schemas/type_domains_FeedbackEnabled"
          },
          "records": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/type_domains_VerificationRecord"
            },
            "description": "A list of DNS records required to verify the domain."
          },
          "client_id": {
            "$ref": "#/components/schemas/type_domains_ClientId"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time at which the domain was last updated."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time at which the domain was created."
          }
        },
        "required": [
          "domain_id",
          "domain",
          "status",
          "feedback_enabled",
          "records",
          "updated_at",
          "created_at"
        ],
        "title": "Domain"
      },
      "type_domains_CreateDomainRequest": {
        "type": "object",
        "properties": {
          "domain": {
            "$ref": "#/components/schemas/type_domains_DomainName"
          },
          "feedback_enabled": {
            "$ref": "#/components/schemas/type_domains_FeedbackEnabled"
          }
        },
        "required": [
          "domain",
          "feedback_enabled"
        ],
        "title": "CreateDomainRequest"
      },
      "type_domains_UpdateDomainRequest": {
        "type": "object",
        "properties": {
          "feedback_enabled": {
            "$ref": "#/components/schemas/type_domains_FeedbackEnabled"
          }
        },
        "title": "UpdateDomainRequest"
      },
      "type_lists_ListEntry": {
        "type": "object",
        "properties": {
          "entry": {
            "type": "string",
            "description": "Email address or domain of list entry."
          },
          "organization_id": {
            "$ref": "#/components/schemas/type__OrganizationId"
          },
          "reason": {
            "type": "string",
            "description": "Reason for adding the entry."
          },
          "direction": {
            "$ref": "#/components/schemas/type_lists_Direction"
          },
          "list_type": {
            "$ref": "#/components/schemas/type_lists_ListType"
          },
          "entry_type": {
            "$ref": "#/components/schemas/type_lists_EntryType"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time at which entry was created."
          },
          "read_only": {
            "type": "boolean",
            "description": "Whether the entry is read-only and cannot be deleted via the API."
          }
        },
        "required": [
          "entry",
          "organization_id",
          "direction",
          "list_type",
          "entry_type",
          "created_at"
        ],
        "title": "ListEntry"
      },
      "type_lists_ListListEntriesResponse": {
        "type": "object",
        "properties": {
          "count": {
            "$ref": "#/components/schemas/type__Count"
          },
          "limit": {
            "$ref": "#/components/schemas/type__Limit"
          },
          "next_page_token": {
            "$ref": "#/components/schemas/type__PageToken"
          },
          "entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/type_lists_ListEntry"
            },
            "description": "Ordered by entry ascending."
          }
        },
        "required": [
          "count",
          "entries"
        ],
        "title": "ListListEntriesResponse"
      },
      "type_pods_Name": {
        "type": "string",
        "description": "Name of pod.",
        "title": "Name"
      },
      "type_pods_ClientId": {
        "type": "string",
        "description": "Client ID of pod.",
        "title": "ClientId"
      },
      "type_pods_Pod": {
        "type": "object",
        "properties": {
          "pod_id": {
            "$ref": "#/components/schemas/type_pods_PodId"
          },
          "name": {
            "$ref": "#/components/schemas/type_pods_Name"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time at which pod was last updated."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time at which pod was created."
          },
          "client_id": {
            "$ref": "#/components/schemas/type_pods_ClientId"
          }
        },
        "required": [
          "pod_id",
          "name",
          "updated_at",
          "created_at"
        ],
        "title": "Pod"
      },
      "type_pods_ListPodsResponse": {
        "type": "object",
        "properties": {
          "count": {
            "$ref": "#/components/schemas/type__Count"
          },
          "limit": {
            "$ref": "#/components/schemas/type__Limit"
          },
          "next_page_token": {
            "$ref": "#/components/schemas/type__PageToken"
          },
          "pods": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/type_pods_Pod"
            },
            "description": "Ordered by `created_at` descending."
          }
        },
        "required": [
          "count",
          "pods"
        ],
        "title": "ListPodsResponse"
      },
      "type_pods_CreatePodRequest": {
        "type": "object",
        "properties": {
          "name": {
            "$ref": "#/components/schemas/type_pods_Name"
          },
          "client_id": {
            "$ref": "#/components/schemas/type_pods_ClientId"
          }
        },
        "title": "CreatePodRequest"
      },
      "type_organizations_Organization": {
        "type": "object",
        "properties": {
          "organization_id": {
            "$ref": "#/components/schemas/type__OrganizationId"
          },
          "inbox_count": {
            "type": "integer",
            "description": "Current number of inboxes."
          },
          "domain_count": {
            "type": "integer",
            "description": "Current number of domains."
          },
          "inbox_limit": {
            "type": "integer",
            "description": "Maximum number of inboxes allowed."
          },
          "domain_limit": {
            "type": "integer",
            "description": "Maximum number of domains allowed."
          },
          "billing_id": {
            "type": "string",
            "description": "Provider-agnostic billing customer ID."
          },
          "billing_type": {
            "type": "string",
            "description": "Billing provider type (e.g. \"stripe\")."
          },
          "billing_subscription_id": {
            "type": "string",
            "description": "Active billing subscription ID."
          },
          "authentication_id": {
            "type": "string",
            "description": "Provider-agnostic authentication ID."
          },
          "authentication_type": {
            "type": "string",
            "description": "Authentication provider type."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time at which organization was last updated."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time at which organization was created."
          }
        },
        "required": [
          "organization_id",
          "inbox_count",
          "domain_count",
          "updated_at",
          "created_at"
        ],
        "description": "Organization details with usage limits and counts.",
        "title": "Organization"
      },
      "type_webhooks_events_SvixId": {
        "type": "string",
        "description": "ID of webhook message.",
        "title": "SvixId"
      },
      "type_webhooks_events_SvixSignature": {
        "type": "string",
        "description": "Signature of webhook message.",
        "title": "SvixSignature"
      },
      "type_webhooks_events_SvixTimestamp": {
        "type": "string",
        "format": "date-time",
        "description": "Timestamp of webhook message.",
        "title": "SvixTimestamp"
      },
      "type_events_MessageReceivedEventType": {
        "type": "string",
        "enum": [
          "message.received",
          "message.received.spam",
          "message.received.blocked",
          "message.received.unauthenticated"
        ],
        "title": "MessageReceivedEventType"
      },
      "type_events_EventId": {
        "type": "string",
        "description": "ID of event.",
        "title": "EventId"
      },
      "type_events_MessageReceivedEvent": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "event"
            ]
          },
          "event_type": {
            "$ref": "#/components/schemas/type_events_MessageReceivedEventType"
          },
          "event_id": {
            "$ref": "#/components/schemas/type_events_EventId"
          },
          "message": {
            "$ref": "#/components/schemas/type_messages_Message"
          },
          "thread": {
            "$ref": "#/components/schemas/type_threads_ThreadItem"
          }
        },
        "required": [
          "type",
          "event_type",
          "event_id",
          "message",
          "thread"
        ],
        "description": "A message was received. Spam, blocked, and unauthenticated received-message events use the same payload shape with different `event_type` values.",
        "title": "MessageReceivedEvent"
      },
      "type_events_Timestamp": {
        "type": "string",
        "format": "date-time",
        "description": "Timestamp of event.",
        "title": "Timestamp"
      },
      "type_events_Send": {
        "type": "object",
        "properties": {
          "inbox_id": {
            "$ref": "#/components/schemas/type_inboxes_InboxId"
          },
          "thread_id": {
            "$ref": "#/components/schemas/type_threads_ThreadId"
          },
          "message_id": {
            "$ref": "#/components/schemas/type_messages_MessageId"
          },
          "timestamp": {
            "$ref": "#/components/schemas/type_events_Timestamp"
          },
          "recipients": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Sent recipients."
          }
        },
        "required": [
          "inbox_id",
          "thread_id",
          "message_id",
          "timestamp",
          "recipients"
        ],
        "title": "Send"
      },
      "type_events_MessageSentEvent": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "event"
            ]
          },
          "event_type": {
            "type": "string",
            "enum": [
              "message.sent"
            ]
          },
          "event_id": {
            "$ref": "#/components/schemas/type_events_EventId"
          },
          "send": {
            "$ref": "#/components/schemas/type_events_Send"
          }
        },
        "required": [
          "type",
          "event_type",
          "event_id",
          "send"
        ],
        "title": "MessageSentEvent"
      },
      "type_events_Delivery": {
        "type": "object",
        "properties": {
          "inbox_id": {
            "$ref": "#/components/schemas/type_inboxes_InboxId"
          },
          "thread_id": {
            "$ref": "#/components/schemas/type_threads_ThreadId"
          },
          "message_id": {
            "$ref": "#/components/schemas/type_messages_MessageId"
          },
          "timestamp": {
            "$ref": "#/components/schemas/type_events_Timestamp"
          },
          "recipients": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Delivered recipients."
          }
        },
        "required": [
          "inbox_id",
          "thread_id",
          "message_id",
          "timestamp",
          "recipients"
        ],
        "title": "Delivery"
      },
      "type_events_MessageDeliveredEvent": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "event"
            ]
          },
          "event_type": {
            "type": "string",
            "enum": [
              "message.delivered"
            ]
          },
          "event_id": {
            "$ref": "#/components/schemas/type_events_EventId"
          },
          "delivery": {
            "$ref": "#/components/schemas/type_events_Delivery"
          }
        },
        "required": [
          "type",
          "event_type",
          "event_id",
          "delivery"
        ],
        "title": "MessageDeliveredEvent"
      },
      "type_events_Recipient": {
        "type": "object",
        "properties": {
          "address": {
            "type": "string",
            "description": "Recipient address."
          },
          "status": {
            "type": "string",
            "description": "Recipient status."
          }
        },
        "required": [
          "address",
          "status"
        ],
        "title": "Recipient"
      },
      "type_events_Bounce": {
        "type": "object",
        "properties": {
          "inbox_id": {
            "$ref": "#/components/schemas/type_inboxes_InboxId"
          },
          "thread_id": {
            "$ref": "#/components/schemas/type_threads_ThreadId"
          },
          "message_id": {
            "$ref": "#/components/schemas/type_messages_MessageId"
          },
          "timestamp": {
            "$ref": "#/components/schemas/type_events_Timestamp"
          },
          "type": {
            "type": "string",
            "description": "Bounce type."
          },
          "sub_type": {
            "type": "string",
            "description": "Bounce sub-type."
          },
          "recipients": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/type_events_Recipient"
            },
            "description": "Bounced recipients."
          }
        },
        "required": [
          "inbox_id",
          "thread_id",
          "message_id",
          "timestamp",
          "type",
          "sub_type",
          "recipients"
        ],
        "title": "Bounce"
      },
      "type_events_MessageBouncedEvent": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "event"
            ]
          },
          "event_type": {
            "type": "string",
            "enum": [
              "message.bounced"
            ]
          },
          "event_id": {
            "$ref": "#/components/schemas/type_events_EventId"
          },
          "bounce": {
            "$ref": "#/components/schemas/type_events_Bounce"
          }
        },
        "required": [
          "type",
          "event_type",
          "event_id",
          "bounce"
        ],
        "title": "MessageBouncedEvent"
      },
      "type_events_Complaint": {
        "type": "object",
        "properties": {
          "inbox_id": {
            "$ref": "#/components/schemas/type_inboxes_InboxId"
          },
          "thread_id": {
            "$ref": "#/components/schemas/type_threads_ThreadId"
          },
          "message_id": {
            "$ref": "#/components/schemas/type_messages_MessageId"
          },
          "timestamp": {
            "$ref": "#/components/schemas/type_events_Timestamp"
          },
          "type": {
            "type": "string",
            "description": "Complaint type."
          },
          "sub_type": {
            "type": "string",
            "description": "Complaint sub-type."
          },
          "recipients": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Complained recipients."
          }
        },
        "required": [
          "inbox_id",
          "thread_id",
          "message_id",
          "timestamp",
          "type",
          "sub_type",
          "recipients"
        ],
        "title": "Complaint"
      },
      "type_events_MessageComplainedEvent": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "event"
            ]
          },
          "event_type": {
            "type": "string",
            "enum": [
              "message.complained"
            ]
          },
          "event_id": {
            "$ref": "#/components/schemas/type_events_EventId"
          },
          "complaint": {
            "$ref": "#/components/schemas/type_events_Complaint"
          }
        },
        "required": [
          "type",
          "event_type",
          "event_id",
          "complaint"
        ],
        "title": "MessageComplainedEvent"
      },
      "type_events_Reject": {
        "type": "object",
        "properties": {
          "inbox_id": {
            "$ref": "#/components/schemas/type_inboxes_InboxId"
          },
          "thread_id": {
            "$ref": "#/components/schemas/type_threads_ThreadId"
          },
          "message_id": {
            "$ref": "#/components/schemas/type_messages_MessageId"
          },
          "timestamp": {
            "$ref": "#/components/schemas/type_events_Timestamp"
          },
          "reason": {
            "type": "string",
            "description": "Reject reason."
          }
        },
        "required": [
          "inbox_id",
          "thread_id",
          "message_id",
          "timestamp",
          "reason"
        ],
        "title": "Reject"
      },
      "type_events_MessageRejectedEvent": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "event"
            ]
          },
          "event_type": {
            "type": "string",
            "enum": [
              "message.rejected"
            ]
          },
          "event_id": {
            "$ref": "#/components/schemas/type_events_EventId"
          },
          "reject": {
            "$ref": "#/components/schemas/type_events_Reject"
          }
        },
        "required": [
          "type",
          "event_type",
          "event_id",
          "reject"
        ],
        "title": "MessageRejectedEvent"
      },
      "type_events_DomainVerifiedEvent": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "event"
            ]
          },
          "event_type": {
            "type": "string",
            "enum": [
              "domain.verified"
            ]
          },
          "event_id": {
            "$ref": "#/components/schemas/type_events_EventId"
          },
          "domain": {
            "$ref": "#/components/schemas/type_domains_Domain"
          }
        },
        "required": [
          "type",
          "event_type",
          "event_id",
          "domain"
        ],
        "title": "DomainVerifiedEvent"
      },
      "type__Query": {
        "type": "string",
        "description": "Full-text search query. Matched against the sender, recipients, and\nsubject (substring) and the message body (tokenized full text).",
        "title": "Query"
      },
      "type_threads_SearchThreadsResponse": {
        "type": "object",
        "properties": {
          "count": {
            "$ref": "#/components/schemas/type__Count"
          },
          "limit": {
            "$ref": "#/components/schemas/type__Limit"
          },
          "next_page_token": {
            "$ref": "#/components/schemas/type__PageToken"
          },
          "threads": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/type_threads_SearchThreadItem"
            },
            "description": "Ordered by relevance, best match first."
          }
        },
        "required": [
          "count",
          "threads"
        ],
        "title": "SearchThreadsResponse"
      },
      "type_messages_SearchMessagesResponse": {
        "type": "object",
        "properties": {
          "count": {
            "$ref": "#/components/schemas/type__Count"
          },
          "limit": {
            "$ref": "#/components/schemas/type__Limit"
          },
          "next_page_token": {
            "$ref": "#/components/schemas/type__PageToken"
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/type_messages_SearchMessageItem"
            },
            "description": "Ordered by relevance, best match first."
          }
        },
        "required": [
          "count",
          "messages"
        ],
        "title": "SearchMessagesResponse"
      },
      "type_threads_SearchThreadItem": {
        "type": "object",
        "properties": {
          "inbox_id": {
            "$ref": "#/components/schemas/type_inboxes_InboxId"
          },
          "thread_id": {
            "$ref": "#/components/schemas/type_threads_ThreadId"
          },
          "labels": {
            "$ref": "#/components/schemas/type_threads_ThreadLabels"
          },
          "timestamp": {
            "$ref": "#/components/schemas/type_threads_ThreadTimestamp"
          },
          "received_timestamp": {
            "$ref": "#/components/schemas/type_threads_ThreadReceivedTimestamp"
          },
          "sent_timestamp": {
            "$ref": "#/components/schemas/type_threads_ThreadSentTimestamp"
          },
          "senders": {
            "$ref": "#/components/schemas/type_threads_ThreadSenders"
          },
          "recipients": {
            "$ref": "#/components/schemas/type_threads_ThreadRecipients"
          },
          "subject": {
            "$ref": "#/components/schemas/type_threads_ThreadSubject"
          },
          "preview": {
            "$ref": "#/components/schemas/type_threads_ThreadPreview"
          },
          "attachments": {
            "$ref": "#/components/schemas/type_threads_ThreadAttachments"
          },
          "last_message_id": {
            "$ref": "#/components/schemas/type_threads_ThreadLastMessageId"
          },
          "message_count": {
            "$ref": "#/components/schemas/type_threads_ThreadMessageCount"
          },
          "size": {
            "$ref": "#/components/schemas/type_threads_ThreadSize"
          },
          "updated_at": {
            "$ref": "#/components/schemas/type_threads_ThreadUpdatedAt"
          },
          "created_at": {
            "$ref": "#/components/schemas/type_threads_ThreadCreatedAt"
          },
          "highlights": {
            "$ref": "#/components/schemas/type_threads_SearchThreadHighlights",
            "description": "Matched fragments per field. Present only when the query matched an indexed field."
          }
        },
        "required": [
          "inbox_id",
          "thread_id",
          "labels",
          "timestamp",
          "senders",
          "recipients",
          "last_message_id",
          "message_count",
          "size",
          "updated_at",
          "created_at"
        ],
        "title": "SearchThreadItem"
      },
      "type_messages_SearchMessageItem": {
        "type": "object",
        "properties": {
          "inbox_id": {
            "$ref": "#/components/schemas/type_inboxes_InboxId"
          },
          "thread_id": {
            "$ref": "#/components/schemas/type_threads_ThreadId"
          },
          "message_id": {
            "$ref": "#/components/schemas/type_messages_MessageId"
          },
          "labels": {
            "$ref": "#/components/schemas/type_messages_MessageLabels"
          },
          "timestamp": {
            "$ref": "#/components/schemas/type_messages_MessageTimestamp"
          },
          "from": {
            "$ref": "#/components/schemas/type_messages_MessageFrom"
          },
          "to": {
            "$ref": "#/components/schemas/type_messages_MessageTo"
          },
          "cc": {
            "$ref": "#/components/schemas/type_messages_MessageCc"
          },
          "bcc": {
            "$ref": "#/components/schemas/type_messages_MessageBcc"
          },
          "subject": {
            "$ref": "#/components/schemas/type_messages_MessageSubject"
          },
          "preview": {
            "$ref": "#/components/schemas/type_messages_MessagePreview"
          },
          "attachments": {
            "$ref": "#/components/schemas/type_messages_MessageAttachments"
          },
          "in_reply_to": {
            "$ref": "#/components/schemas/type_messages_MessageInReplyTo"
          },
          "references": {
            "$ref": "#/components/schemas/type_messages_MessageReferences"
          },
          "headers": {
            "$ref": "#/components/schemas/type_messages_MessageHeaders"
          },
          "size": {
            "$ref": "#/components/schemas/type_messages_MessageSize"
          },
          "updated_at": {
            "$ref": "#/components/schemas/type_messages_MessageUpdatedAt"
          },
          "created_at": {
            "$ref": "#/components/schemas/type_messages_MessageCreatedAt"
          },
          "highlights": {
            "$ref": "#/components/schemas/type_messages_SearchMessageHighlights",
            "description": "Matched fragments per field. Present only when the query matched an indexed field."
          }
        },
        "required": [
          "inbox_id",
          "thread_id",
          "message_id",
          "labels",
          "timestamp",
          "from",
          "to",
          "size",
          "updated_at",
          "created_at"
        ],
        "title": "SearchMessageItem"
      },
      "type_threads_SearchThreadHighlights": {
        "type": "object",
        "properties": {
          "from": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Matched fragments from a sender address in the thread."
          },
          "recipients": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Matched fragments from a recipient address in the thread (to, cc, or bcc)."
          },
          "subject": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Matched fragments from the subject."
          },
          "text": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Matched fragments from a message body in the thread."
          }
        },
        "description": "Matched fragments per field on a thread search result, with matched terms\nwrapped in `**`. A field key is present only when the query matched that\nfield, so the present keys also tell you which fields produced the hit.",
        "title": "SearchThreadHighlights"
      },
      "type_messages_SearchMessageHighlights": {
        "type": "object",
        "properties": {
          "from": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Matched fragments from the sender address."
          },
          "recipients": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Matched fragments from the recipient addresses (to, cc, or bcc)."
          },
          "subject": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Matched fragments from the subject."
          },
          "text": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Matched fragments from the message body."
          }
        },
        "description": "Matched fragments per field on a message search result, with matched terms\nwrapped in `**`. A field key is present only when the query matched that\nfield, so the present keys also tell you which fields produced the hit.",
        "title": "SearchMessageHighlights"
      }
    },
    "securitySchemes": {
      "Bearer": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  },
  "paths": {
    "/agentmail/threads/{thread_id}": {
      "get": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "get_agentmail_thread",
        "summary": "Get Any Thread",
        "description": "Fetches one thread by id without naming an inbox: `thread_id`, `inbox_id`, `labels`, `timestamp`, `received_timestamp`, `sent_timestamp`, `senders`, `recipients`, `subject`, `preview`, attachments and messages. Because no inbox is named, this resolves against the whole account. Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created, so a thread id that is not yours still resolves — check the returned `inbox_id`. The scoped twin is `get_agentmail_inbox_thread`.",
        "tags": [
          "subpackage_threads"
        ],
        "parameters": [
          {
            "name": "thread_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_threads_ThreadId"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_threads_Thread"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        }
      },
      "patch": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "patch_agentmail_thread",
        "summary": "Update Any Thread Labels",
        "description": "Adds or removes labels on a thread addressed by id alone, returning `thread_id` and the resulting `labels`. No inbox is named, so it resolves account-wide. Writes to the shared AgentMail workspace: Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created, and what you write here is visible and editable by the next caller. The scoped twin is `patch_agentmail_inbox_thread`.",
        "tags": [
          "subpackage_threads"
        ],
        "parameters": [
          {
            "name": "thread_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_threads_ThreadId"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_threads_UpdateThreadResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response with status 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ValidationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Error response with status 422",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/type_threads_UpdateThreadRequest"
              }
            }
          }
        }
      },
      "delete": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "delete_agentmail_thread",
        "summary": "Delete Any Thread",
        "description": "Permanently deletes a thread addressed by id alone, and every message in it. Returns no body. **This cannot be undone, deletes more than one message, and names no inbox** — Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created, so it can destroy a conversation belonging to another caller. Read it first with `get_agentmail_thread`; the scoped twin is `delete_agentmail_inbox_thread`.",
        "tags": [
          "subpackage_threads"
        ],
        "parameters": [
          {
            "name": "thread_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_threads_ThreadId"
            }
          },
          {
            "name": "permanent",
            "in": "query",
            "description": "If true, permanently delete the thread instead of moving to trash.",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/agentmail/inboxes/{inbox_id}/drafts/{draft_id}": {
      "get": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "get_agentmail_inbox_draft",
        "summary": "Get Draft",
        "description": "Fetches one unsent draft in full: `draft_id`, `inbox_id`, `client_id`, `labels`, `reply_to`, `to`, `cc`, `bcc`, `subject`, `preview`, `text`, `html`, `attachments`, `in_reply_to` and `references`. Edit it with `patch_agentmail_inbox_draft`, send it with `post_agentmail_inbox_draft_send`.",
        "tags": [
          "subpackage_inboxes.subpackage_inboxes/drafts"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "draft_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_drafts_DraftId"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_drafts_Draft"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        }
      },
      "patch": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "patch_agentmail_inbox_draft",
        "summary": "Update Draft",
        "description": "Rewrites an unsent draft's recipients, subject, body or attachments and returns the full draft after the change. Still sends nothing — `post_agentmail_inbox_draft_send` does that. Writes to the shared AgentMail workspace: Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created, and what you write here is visible and editable by the next caller.",
        "tags": [
          "subpackage_inboxes.subpackage_inboxes/drafts"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "draft_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_drafts_DraftId"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_drafts_Draft"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/type_drafts_UpdateDraftRequest"
              }
            }
          }
        }
      },
      "delete": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "delete_agentmail_inbox_draft",
        "summary": "Delete Draft",
        "description": "Permanently deletes an unsent draft. Returns no body. Nothing was ever sent, so this is the least destructive delete in this API — but it cannot be undone and Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created. Read it first with `get_agentmail_inbox_draft` if unsure.",
        "tags": [
          "subpackage_inboxes.subpackage_inboxes/drafts"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "draft_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_drafts_DraftId"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/agentmail/inboxes/{inbox_id}": {
      "get": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "get_agentmail_inbox",
        "summary": "Get Inbox",
        "description": "Fetches one inbox by `inbox_id`. Returns `inbox_id`, `email`, `display_name`, `client_id`, `pod_id`, `metadata`, `created_at` and `updated_at` — settings only, no mail. For the messages in it use `get_agentmail_inbox_messages`, for conversations `get_agentmail_inbox_threads`. Discover ids with `get_agentmail_inboxes`.",
        "tags": [
          "subpackage_inboxes"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_inboxes_Inbox"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        }
      },
      "patch": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "patch_agentmail_inbox",
        "summary": "Update Inbox",
        "description": "Updates one inbox's `display_name` and `metadata`; the address itself cannot change. Returns the full inbox after the update. Writes to the shared AgentMail workspace: Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created, and what you write here is visible and editable by the next caller. To read without changing anything use `get_agentmail_inbox`.",
        "tags": [
          "subpackage_inboxes"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_inboxes_Inbox"
                }
              }
            }
          },
          "400": {
            "description": "Error response with status 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ValidationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        },
        "requestBody": {
          "description": "Expects an object; provide at least one of `display_name` or `metadata`.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/type_inboxes_UpdateInboxRequest"
              }
            }
          }
        }
      },
      "delete": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "delete_agentmail_inbox",
        "summary": "Delete Inbox",
        "description": "Permanently deletes an inbox and the mail in it. Returns no body. **This cannot be undone, and the inbox may not be yours** — Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created, so confirm ownership from `get_agentmail_inbox` before calling. To stop using an inbox without destroying it, simply leave it alone.",
        "tags": [
          "subpackage_inboxes"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/agentmail/lists/{direction}/{type}": {
      "get": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "get_agentmail_list_entries",
        "summary": "List Account List Entries",
        "description": "Lists the account-wide allow or block entries that apply to every inbox. `direction` selects inbound or outbound and `type` the list kind. Returns `count`, `limit`, `next_page_token` and `entries`; page with `next_page_token`. Each entry carries `entry`, `entry_type`, `reason`, `direction`, `list_type`, `created_at` and `read_only`. This is the organization-wide view spanning every inbox in the account. Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created; the inbox-scoped twin `get_agentmail_inbox_list_entries` is the one to use when a single inbox is meant.",
        "tags": [
          "subpackage_lists"
        ],
        "parameters": [
          {
            "name": "direction",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_lists_Direction"
            }
          },
          {
            "name": "type",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_lists_ListType"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Limit"
            }
          },
          {
            "name": "page_token",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__PageToken"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_lists_ListListEntriesResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "post_agentmail_list_entry",
        "summary": "Create Account List Entry",
        "description": "Adds one address or domain to an **account-wide** allow or block list and returns the created entry. 🔴 This is a standing rule that changes mail handling for **every inbox in the account, including other callers'** — the inbox-scoped `post_agentmail_inbox_list_entry` affects only one inbox and is almost always the one you want. Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created.",
        "tags": [
          "subpackage_lists"
        ],
        "parameters": [
          {
            "name": "direction",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_lists_Direction"
            }
          },
          {
            "name": "type",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_lists_ListType"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_lists_ListEntry"
                }
              }
            }
          },
          "400": {
            "description": "Error response with status 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ValidationErrorResponse"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/type_lists_CreateListEntryRequest"
              }
            }
          }
        }
      }
    },
    "/agentmail/inboxes/{inbox_id}/messages/{message_id}/reply-all": {
      "post": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "post_agentmail_inbox_message_reply_all",
        "summary": "Reply All To Message",
        "description": "Replies to one message and **every other recipient on it**, returning `message_id` and `thread_id`. 🔴 **This sends real email to everyone in the thread and it cannot be recalled.** Use `post_agentmail_inbox_message_reply` when only the sender should receive the answer — that is the safer default and the two differ only in recipients. Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created.",
        "tags": [
          "subpackage_inboxes.subpackage_inboxes/messages"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "message_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_messages_MessageId"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_messages_SendMessageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response with status 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ValidationErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Error response with status 403",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/type_messages_ReplyAllMessageRequest"
              }
            }
          }
        }
      }
    },
    "/agentmail/inboxes/{inbox_id}/messages/send": {
      "post": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "post_agentmail_inbox_message_send",
        "summary": "Send Message",
        "description": "Sends a new email from one inbox and returns `message_id` and `thread_id`. Takes `to`, `cc`, `bcc`, `subject`, `text`, `html`, `labels` and `attachments`. 🔴 **This sends real email and it cannot be recalled.** Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created, so the sending address may not be one you created — check `get_agentmail_inbox` first. To answer an existing message use `post_agentmail_inbox_message_reply`; to write without sending, `post_agentmail_inbox_draft`.",
        "tags": [
          "subpackage_inboxes.subpackage_inboxes/messages"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_messages_SendMessageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response with status 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ValidationErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Error response with status 403",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/type_messages_SendMessageRequest"
              }
            }
          }
        }
      }
    },
    "/agentmail/inboxes/{inbox_id}/threads/{thread_id}": {
      "get": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "get_agentmail_inbox_thread",
        "summary": "Get Thread",
        "description": "Fetches one thread with its full message list: `thread_id`, `inbox_id`, `labels`, `timestamp`, `received_timestamp`, `sent_timestamp`, `senders`, `recipients`, `subject`, `preview`, attachments and the messages themselves. For a single message use `get_agentmail_inbox_message`.",
        "tags": [
          "subpackage_inboxes.subpackage_inboxes/threads"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "thread_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_threads_ThreadId"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_threads_Thread"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        }
      },
      "patch": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "patch_agentmail_inbox_thread",
        "summary": "Update Thread Labels",
        "description": "Adds or removes labels on a whole thread and returns `thread_id` with the resulting `labels`. Applies to every message in the thread at once; the per-message twin is `patch_agentmail_inbox_message`. Writes to the shared AgentMail workspace: Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created, and what you write here is visible and editable by the next caller.",
        "tags": [
          "subpackage_inboxes.subpackage_inboxes/threads"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "thread_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_threads_ThreadId"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_threads_UpdateThreadResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response with status 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ValidationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Error response with status 422",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/type_threads_UpdateThreadRequest"
              }
            }
          }
        }
      },
      "delete": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "delete_agentmail_inbox_thread",
        "summary": "Delete Thread",
        "description": "Permanently deletes a thread and every message in it. Returns no body. **This cannot be undone and it removes more than one message** — Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created, so read the thread with `get_agentmail_inbox_thread` first. To hide it instead, relabel with `patch_agentmail_inbox_thread`.",
        "tags": [
          "subpackage_inboxes.subpackage_inboxes/threads"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "thread_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_threads_ThreadId"
            }
          },
          {
            "name": "permanent",
            "in": "query",
            "description": "If true, permanently delete the thread instead of moving to trash.",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/agentmail/threads": {
      "get": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "get_agentmail_threads",
        "summary": "List All Threads",
        "description": "Lists conversation threads across **every inbox in the account**. Returns `count`, `limit`, `next_page_token` and `threads`; page with `next_page_token`. Each thread carries `thread_id`, `inbox_id`, `labels`, `timestamp`, `senders`, `recipients`, `subject`, `preview`, `message_count` and `last_message_id`. This is the organization-wide view spanning every inbox in the account. Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created; the inbox-scoped twin `get_agentmail_inbox_threads` is the one to use when a single inbox is meant.",
        "tags": [
          "subpackage_threads"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Limit"
            }
          },
          {
            "name": "page_token",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__PageToken"
            }
          },
          {
            "name": "labels",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Labels"
            }
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Before"
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__After"
            }
          },
          {
            "name": "ascending",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Ascending"
            }
          },
          {
            "name": "include_spam",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__IncludeSpam"
            }
          },
          {
            "name": "include_blocked",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__IncludeBlocked"
            }
          },
          {
            "name": "include_unauthenticated",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__IncludeUnauthenticated"
            }
          },
          {
            "name": "include_trash",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__IncludeTrash"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_threads_ListThreadsResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/agentmail/inboxes/{inbox_id}/threads": {
      "get": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "get_agentmail_inbox_threads",
        "summary": "List Threads",
        "description": "Lists conversation threads in one inbox, newest first. Returns `count`, `limit`, `next_page_token` and `threads`; page with `next_page_token`. Each thread carries `thread_id`, `labels`, `timestamp`, `senders`, `recipients`, `subject`, `preview`, `message_count`, `last_message_id`, `size` and attachment metadata. Threads group messages; for the individual messages use `get_agentmail_inbox_messages`. To query rather than page, `get_agentmail_inbox_threads_search`.",
        "tags": [
          "subpackage_inboxes.subpackage_inboxes/threads"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Limit"
            }
          },
          {
            "name": "page_token",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__PageToken"
            }
          },
          {
            "name": "labels",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Labels"
            }
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Before"
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__After"
            }
          },
          {
            "name": "ascending",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Ascending"
            }
          },
          {
            "name": "include_spam",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__IncludeSpam"
            }
          },
          {
            "name": "include_blocked",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__IncludeBlocked"
            }
          },
          {
            "name": "include_unauthenticated",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__IncludeUnauthenticated"
            }
          },
          {
            "name": "include_trash",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__IncludeTrash"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_threads_ListThreadsResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/agentmail/drafts/{draft_id}/attachments/{attachment_id}": {
      "get": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "get_agentmail_draft_attachment",
        "summary": "Get Any Draft Attachment",
        "description": "Fetches metadata for one attachment on a draft addressed by id alone. Returns `attachment_id`, `filename`, `size`, `content_type`, `content_disposition`, `content_id` and a short-lived `download_url` with `expires_at`. The bytes are not inlined — fetch `download_url` before it expires. This is the organization-wide view spanning every inbox in the account. Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created; the inbox-scoped twin `get_agentmail_inbox_draft_attachment` is the one to use when a single inbox is meant.",
        "tags": [
          "subpackage_drafts"
        ],
        "parameters": [
          {
            "name": "draft_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_drafts_DraftId"
            }
          },
          {
            "name": "attachment_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_attachments_AttachmentId"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_attachments_AttachmentResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/agentmail/inboxes/{inbox_id}/events": {
      "get": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "get_agentmail_inbox_events",
        "summary": "List Inbox Events",
        "description": "Lists delivery and activity events for one inbox — the audit trail behind sends and receipts. Returns `count`, `limit`, `next_page_token` and `events`; page with `next_page_token`. Each event carries `event_id`, `event_type`, `message_id`, `label`, `event_at` and `inbox_id`. Use this to find out what happened to a message after `post_agentmail_inbox_message_send` returned, which the send call itself cannot tell you. For aggregate counts rather than individual events use `get_agentmail_inbox_metrics`.",
        "tags": [
          "subpackage_inboxes.subpackage_inboxes/events"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Limit"
            }
          },
          {
            "name": "page_token",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__PageToken"
            }
          },
          {
            "name": "ascending",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Ascending"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_inbox-events_ListInboxEventsResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/agentmail/inboxes/{inbox_id}/messages/{message_id}": {
      "get": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "get_agentmail_inbox_message",
        "summary": "Get Message",
        "description": "Fetches one message in full: `message_id`, `thread_id`, `labels`, `timestamp`, `from`, `reply_to`, `to`, `cc`, `bcc`, `subject`, `preview`, `text`, `html`, `extracted_text` and attachment metadata. For the original MIME source use `get_agentmail_inbox_message_raw`; for an attachment's download URL, `get_agentmail_inbox_message_attachment`.",
        "tags": [
          "subpackage_inboxes.subpackage_inboxes/messages"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "message_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_messages_MessageId"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_messages_Message"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        }
      },
      "patch": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "patch_agentmail_inbox_message",
        "summary": "Update Message Labels",
        "description": "Adds or removes labels on one message and returns `message_id` with the resulting `labels`. Labels are the only mutable part of a received message. Writes to the shared AgentMail workspace: Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created, and what you write here is visible and editable by the next caller. Read the current labels with `get_agentmail_inbox_message`.",
        "tags": [
          "subpackage_inboxes.subpackage_inboxes/messages"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "message_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_messages_MessageId"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_messages_UpdateMessageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response with status 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ValidationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/type_messages_UpdateMessageRequest"
              }
            }
          }
        }
      },
      "delete": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "delete_agentmail_inbox_message",
        "summary": "Delete Message",
        "description": "Permanently deletes one message. Returns no body. **This cannot be undone** and Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created, so the message may not be yours. To hide a message from a workflow without destroying it, relabel it with `patch_agentmail_inbox_message` instead.",
        "tags": [
          "subpackage_inboxes.subpackage_inboxes/messages"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "message_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_messages_MessageId"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/agentmail/inboxes/{inbox_id}/drafts": {
      "get": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "get_agentmail_inbox_drafts",
        "summary": "List Drafts",
        "description": "Lists unsent drafts in one inbox. Returns `count`, `limit`, `next_page_token` and `drafts`; page with `next_page_token`. Each draft carries `draft_id`, `labels`, `to`, `cc`, `bcc`, `subject`, `preview`, `attachments`, `in_reply_to`, `send_status`, `send_at` and `updated_at`. List items carry `preview` only — `text` and `html` come from `get_agentmail_inbox_draft`. Drafts are not sent until `post_agentmail_inbox_draft_send`. The account-wide view is `get_agentmail_drafts`.",
        "tags": [
          "subpackage_inboxes.subpackage_inboxes/drafts"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Limit"
            }
          },
          {
            "name": "page_token",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__PageToken"
            }
          },
          {
            "name": "labels",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Labels"
            }
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Before"
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__After"
            }
          },
          {
            "name": "ascending",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Ascending"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_drafts_ListDraftsResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "post_agentmail_inbox_draft",
        "summary": "Create Draft",
        "description": "Composes a draft in one inbox without sending it. Takes `to`, `cc`, `bcc`, `subject`, `text`, `html`, `labels`, `attachments`, and `in_reply_to` / `references` to thread it. Returns the full draft including `draft_id`. Nothing leaves the account until you call `post_agentmail_inbox_draft_send`, which makes this the safe way to stage outbound mail for review. Writes to the shared AgentMail workspace: Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created, and what you write here is visible and editable by the next caller.",
        "tags": [
          "subpackage_inboxes.subpackage_inboxes/drafts"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_drafts_Draft"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/type_drafts_CreateDraftRequest"
              }
            }
          }
        }
      }
    },
    "/agentmail/threads/{thread_id}/attachments/{attachment_id}": {
      "get": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "get_agentmail_thread_attachment",
        "summary": "Get Any Thread Attachment",
        "description": "Fetches metadata for one attachment in a thread addressed by id alone. Returns `attachment_id`, `filename`, `size`, `content_type`, `content_disposition`, `content_id` and a short-lived `download_url` with `expires_at`. The bytes are not inlined — fetch `download_url` before it expires. This is the organization-wide view spanning every inbox in the account. Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created; the inbox-scoped twin `get_agentmail_inbox_thread_attachment` is the one to use when a single inbox is meant.",
        "tags": [
          "subpackage_threads"
        ],
        "parameters": [
          {
            "name": "thread_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_threads_ThreadId"
            }
          },
          {
            "name": "attachment_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_attachments_AttachmentId"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_attachments_AttachmentResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/agentmail/inboxes/{inbox_id}/messages": {
      "get": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "get_agentmail_inbox_messages",
        "summary": "List Messages",
        "description": "Lists messages in one inbox, newest first. Returns `count`, `limit`, `next_page_token` and `messages`; page with `next_page_token`. Each message carries `message_id`, `thread_id`, `labels`, `timestamp`, `from`, `to`, `cc`, `bcc`, `subject` and a `preview`; full bodies come from `get_agentmail_inbox_message`. To search rather than page, use `get_agentmail_inbox_messages_search`; to group by conversation, `get_agentmail_inbox_threads`.",
        "tags": [
          "subpackage_inboxes.subpackage_inboxes/messages"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Limit"
            }
          },
          {
            "name": "page_token",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__PageToken"
            }
          },
          {
            "name": "labels",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Labels"
            }
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Before"
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__After"
            }
          },
          {
            "name": "ascending",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Ascending"
            }
          },
          {
            "name": "include_spam",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__IncludeSpam"
            }
          },
          {
            "name": "include_blocked",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__IncludeBlocked"
            }
          },
          {
            "name": "include_unauthenticated",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__IncludeUnauthenticated"
            }
          },
          {
            "name": "include_trash",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__IncludeTrash"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_messages_ListMessagesResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/agentmail/inboxes/{inbox_id}/lists/{direction}/{type}/{entry}": {
      "get": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "get_agentmail_inbox_list_entry",
        "summary": "Get Inbox List Entry",
        "description": "Fetches one allow or block entry on an inbox: `entry`, `entry_type`, `reason`, `direction`, `list_type`, `created_at`, `read_only`, `inbox_id`, `pod_id` and `organization_id`. `read_only` marks entries the platform manages, which cannot be deleted. List them all with `get_agentmail_inbox_list_entries`.",
        "tags": [
          "subpackage_inboxes.subpackage_inboxes/lists"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "direction",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_lists_Direction"
            }
          },
          {
            "name": "type",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_lists_ListType"
            }
          },
          {
            "name": "entry",
            "in": "path",
            "description": "Email address or domain.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_lists_PodListEntry"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "delete_agentmail_inbox_list_entry",
        "summary": "Delete Inbox List Entry",
        "description": "Removes one entry from an inbox's allow or block list. Returns no body. This changes what the inbox will accept or send from that point on. Entries whose `read_only` is true are platform managed and cannot be removed — check with `get_agentmail_inbox_list_entry` first. Writes to the shared AgentMail workspace: Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created, and what you write here is visible and editable by the next caller.",
        "tags": [
          "subpackage_inboxes.subpackage_inboxes/lists"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "direction",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_lists_Direction"
            }
          },
          {
            "name": "type",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_lists_ListType"
            }
          },
          {
            "name": "entry",
            "in": "path",
            "description": "Email address or domain.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/agentmail/metrics": {
      "get": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "get_agentmail_metrics",
        "summary": "Query Account Metrics",
        "description": "Returns aggregate counters for the whole account as a flat map of counter name to an array of data points. Measured live on 2026-08-24 the keys are `message.received`, `message.received.spam`, `message.received.blocked`, `message.received.unauthenticated`, `message.sent`, `message.delivered`, `message.bounced`, `message.complained`, `message.rejected`, `message.opened` and `domain.verified`, each an empty array on an account with no traffic — an empty array means no activity, not an error. The shape is not pinned in this spec, so read the keys actually returned rather than assuming this list is closed. This is the organization-wide view spanning every inbox in the account. Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created; the inbox-scoped twin `get_agentmail_inbox_metrics` is the one to use when a single inbox is meant.",
        "tags": [
          "subpackage_metrics"
        ],
        "parameters": [
          {
            "name": "event_types",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type_metrics_MetricEventTypes"
            }
          },
          {
            "name": "start",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type_metrics_Start"
            }
          },
          {
            "name": "end",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type_metrics_End"
            }
          },
          {
            "name": "period",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type_metrics_Period"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type_metrics_MetricLimit"
            }
          },
          {
            "name": "descending",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type_metrics_Descending"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_metrics_QueryMetricsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response with status 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ValidationErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/agentmail/inboxes/{inbox_id}/drafts/{draft_id}/send": {
      "post": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "post_agentmail_inbox_draft_send",
        "summary": "Send Draft",
        "description": "Sends an existing draft and returns `message_id` and `thread_id`. 🔴 **This sends real email and it cannot be recalled** — review the draft with `get_agentmail_inbox_draft` first, since this call takes no content of its own and sends whatever the draft currently holds. Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created.",
        "tags": [
          "subpackage_inboxes.subpackage_inboxes/drafts"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "draft_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_drafts_DraftId"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_messages_SendMessageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response with status 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ValidationErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Error response with status 403",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/type_messages_UpdateMessageRequest"
              }
            }
          }
        }
      }
    },
    "/agentmail/lists/{direction}/{type}/{entry}": {
      "get": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "get_agentmail_list_entry",
        "summary": "Get Account List Entry",
        "description": "Fetches one account-wide allow or block entry: `entry`, `entry_type`, `reason`, `direction`, `list_type`, `created_at`, `read_only` and `organization_id`. `read_only` marks platform-managed entries, which cannot be deleted. This is the organization-wide view spanning every inbox in the account. Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created; the inbox-scoped twin `get_agentmail_inbox_list_entry` is the one to use when a single inbox is meant.",
        "tags": [
          "subpackage_lists"
        ],
        "parameters": [
          {
            "name": "direction",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_lists_Direction"
            }
          },
          {
            "name": "type",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_lists_ListType"
            }
          },
          {
            "name": "entry",
            "in": "path",
            "description": "Email address or domain.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_lists_ListEntry"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "delete_agentmail_list_entry",
        "summary": "Delete Account List Entry",
        "description": "Removes one entry from an **account-wide** allow or block list. Returns no body. 🔴 This changes mail handling for **every inbox in the account, including other callers'**; the inbox-scoped `delete_agentmail_inbox_list_entry` is the narrower action. Entries whose `read_only` is true are platform managed and cannot be removed — check with `get_agentmail_list_entry` first.",
        "tags": [
          "subpackage_lists"
        ],
        "parameters": [
          {
            "name": "direction",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_lists_Direction"
            }
          },
          {
            "name": "type",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_lists_ListType"
            }
          },
          {
            "name": "entry",
            "in": "path",
            "description": "Email address or domain.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/agentmail/inboxes/{inbox_id}/metrics": {
      "get": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "get_agentmail_inbox_metrics",
        "summary": "Query Inbox Metrics",
        "description": "Returns the same aggregate counters as `get_agentmail_metrics` but for one inbox: a flat map of counter name to an array of data points, keyed by `message.received`, `message.received.spam`, `message.received.blocked`, `message.received.unauthenticated`, `message.sent`, `message.delivered`, `message.bounced`, `message.complained`, `message.rejected`, `message.opened` and `domain.verified`. An empty array means no activity, not an error. The shape is not pinned in this spec, so read the keys actually returned. For individual events rather than counts use `get_agentmail_inbox_events`; for the account-wide totals, `get_agentmail_metrics`.",
        "tags": [
          "subpackage_inboxes.subpackage_inboxes/metrics"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "event_types",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type_metrics_MetricEventTypes"
            }
          },
          {
            "name": "start",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type_metrics_Start"
            }
          },
          {
            "name": "end",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type_metrics_End"
            }
          },
          {
            "name": "period",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type_metrics_Period"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type_metrics_MetricLimit"
            }
          },
          {
            "name": "descending",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type_metrics_Descending"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_metrics_QueryMetricsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response with status 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ValidationErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/agentmail/drafts": {
      "get": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "get_agentmail_drafts",
        "summary": "List All Drafts",
        "description": "Lists unsent drafts across **every inbox in the account**. Returns `count`, `limit`, `next_page_token` and `drafts`; page with `next_page_token`. Each draft carries `draft_id`, `inbox_id`, `to`, `cc`, `bcc`, `subject`, `preview`, `attachments`, `send_status` and `send_at`. List items carry `preview` only — `text` and `html` come from `get_agentmail_draft`. This is the organization-wide view spanning every inbox in the account. Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created; the inbox-scoped twin `get_agentmail_inbox_drafts` is the one to use when a single inbox is meant.",
        "tags": [
          "subpackage_drafts"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Limit"
            }
          },
          {
            "name": "page_token",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__PageToken"
            }
          },
          {
            "name": "labels",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Labels"
            }
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Before"
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__After"
            }
          },
          {
            "name": "ascending",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Ascending"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_drafts_ListDraftsResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/agentmail/inboxes/{inbox_id}/messages/{message_id}/forward": {
      "post": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "post_agentmail_inbox_message_forward",
        "summary": "Forward Message",
        "description": "Forwards one message to new recipients and returns `message_id` and `thread_id`. 🔴 **This sends real email and it cannot be recalled, and it passes along the original content including attachments** — check what you are forwarding with `get_agentmail_inbox_message` first. Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created. To answer instead of forward, use `post_agentmail_inbox_message_reply`.",
        "tags": [
          "subpackage_inboxes.subpackage_inboxes/messages"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "message_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_messages_MessageId"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_messages_SendMessageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response with status 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ValidationErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Error response with status 403",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/type_messages_SendMessageRequest"
              }
            }
          }
        }
      }
    },
    "/agentmail/inboxes/{inbox_id}/messages/{message_id}/raw": {
      "get": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "get_agentmail_inbox_message_raw",
        "summary": "Get Raw Message",
        "description": "Returns the original RFC 822 source of one message as `message_id`, `size`, a short-lived `download_url` and `expires_at`. The bytes are not inlined — fetch `download_url` before it expires. Use this for headers, DKIM or exact MIME structure; for parsed text and HTML use `get_agentmail_inbox_message`.",
        "tags": [
          "subpackage_inboxes.subpackage_inboxes/messages"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "message_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_messages_MessageId"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_messages_RawMessageResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/agentmail/inboxes/{inbox_id}/messages/{message_id}/attachments/{attachment_id}": {
      "get": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "get_agentmail_inbox_message_attachment",
        "summary": "Get Message Attachment",
        "description": "Fetches metadata for one attachment on a message. Returns `attachment_id`, `filename`, `size`, `content_type`, `content_disposition`, `content_id` and a short-lived `download_url` with `expires_at`. The bytes are not inlined — fetch `download_url` before it expires. Attachment ids come from the `attachments` array on `get_agentmail_inbox_message`. The thread-level and draft-level twins are `get_agentmail_inbox_thread_attachment` and `get_agentmail_inbox_draft_attachment`.",
        "tags": [
          "subpackage_inboxes.subpackage_inboxes/messages"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "message_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_messages_MessageId"
            }
          },
          {
            "name": "attachment_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_attachments_AttachmentId"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_attachments_AttachmentResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/agentmail/inboxes": {
      "get": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "get_agentmail_inboxes",
        "summary": "List Inboxes",
        "description": "Lists every inbox in the AgentMail account. Returns `count`, `limit`, `next_page_token` and `inboxes`; page with `next_page_token`. Each inbox carries `inbox_id`, `email`, `display_name`, `client_id`, `pod_id`, `metadata`, `created_at` and `updated_at`. Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created, so this list is not scoped to you and the inboxes it returns may belong to someone else. Use `get_agentmail_inbox` for one inbox you already know the id of, and `post_agentmail_inbox` to create one.",
        "tags": [
          "subpackage_inboxes"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Limit"
            }
          },
          {
            "name": "page_token",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__PageToken"
            }
          },
          {
            "name": "ascending",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Ascending"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_inboxes_ListInboxesResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "post_agentmail_inbox",
        "summary": "Create Inbox",
        "description": "Creates a new inbox — a real address that can send and receive. Optional `username` picks the local part (`support@agentmail.to`); omit it for a generated one such as `livelyspirit481@agentmail.to`. The domain is always `agentmail.to` here because AIsa does not expose domain management. Returns `inbox_id`, `email`, `display_name`, `client_id`, `pod_id`, `metadata` and timestamps. Writes to the shared AgentMail workspace: Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created, and what you write here is visible and editable by the next caller. Read one back with `get_agentmail_inbox`, list them with `get_agentmail_inboxes`.",
        "tags": [
          "subpackage_inboxes"
        ],
        "parameters": [
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_inboxes_Inbox"
                }
              }
            }
          },
          "400": {
            "description": "Error response with status 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ValidationErrorResponse"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/type_inboxes_CreateInboxRequest"
              }
            }
          }
        }
      }
    },
    "/agentmail/inboxes/{inbox_id}/messages/{message_id}/reply": {
      "post": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "post_agentmail_inbox_message_reply",
        "summary": "Reply To Message",
        "description": "Replies to one message, threading the response correctly, and returns `message_id` and `thread_id`. 🔴 **This sends real email and it cannot be recalled.** It answers the sender only — `post_agentmail_inbox_message_reply_all` answers every recipient, which is a materially different blast radius, so pick deliberately. Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created. To send to a fresh set of recipients use `post_agentmail_inbox_message_send`.",
        "tags": [
          "subpackage_inboxes.subpackage_inboxes/messages"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "message_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_messages_MessageId"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_messages_SendMessageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response with status 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ValidationErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Error response with status 403",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/type_messages_ReplyToMessageRequest"
              }
            }
          }
        }
      }
    },
    "/agentmail/inboxes/{inbox_id}/threads/{thread_id}/attachments/{attachment_id}": {
      "get": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "get_agentmail_inbox_thread_attachment",
        "summary": "Get Thread Attachment",
        "description": "Fetches metadata for one attachment anywhere in a thread. Returns `attachment_id`, `filename`, `size`, `content_type`, `content_disposition`, `content_id` and a short-lived `download_url` with `expires_at`. The bytes are not inlined — fetch `download_url` before it expires. Ids come from the thread's `attachments` array on `get_agentmail_inbox_thread`. The message-level twin is `get_agentmail_inbox_message_attachment`.",
        "tags": [
          "subpackage_inboxes.subpackage_inboxes/threads"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "thread_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_threads_ThreadId"
            }
          },
          {
            "name": "attachment_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_attachments_AttachmentId"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_attachments_AttachmentResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/agentmail/drafts/{draft_id}": {
      "get": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "get_agentmail_draft",
        "summary": "Get Any Draft",
        "description": "Fetches one unsent draft by id without naming an inbox: `draft_id`, `inbox_id`, `client_id`, `labels`, `reply_to`, `to`, `cc`, `bcc`, `subject`, `preview`, `text`, `html`, `attachments`, `in_reply_to` and `references`. This is the organization-wide view spanning every inbox in the account. Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created; the inbox-scoped twin `get_agentmail_inbox_draft` is the one to use when a single inbox is meant.",
        "tags": [
          "subpackage_drafts"
        ],
        "parameters": [
          {
            "name": "draft_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_drafts_DraftId"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_drafts_Draft"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/agentmail/inboxes/{inbox_id}/lists/{direction}/{type}": {
      "get": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "get_agentmail_inbox_list_entries",
        "summary": "List Inbox List Entries",
        "description": "Lists one inbox's allow or block entries. `direction` selects inbound or outbound and `type` the list kind. Returns `count`, `limit`, `next_page_token` and `entries`; page with `next_page_token`. Each entry carries `entry`, `entry_type`, `reason`, `direction`, `list_type`, `created_at`, `read_only`, `inbox_id` and `pod_id`. The account-wide twin is `get_agentmail_list_entries`.",
        "tags": [
          "subpackage_inboxes.subpackage_inboxes/lists"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "direction",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_lists_Direction"
            }
          },
          {
            "name": "type",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_lists_ListType"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Limit"
            }
          },
          {
            "name": "page_token",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__PageToken"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_lists_PodListListEntriesResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "post_agentmail_inbox_list_entry",
        "summary": "Create Inbox List Entry",
        "description": "Adds one address or domain to an inbox's allow or block list and returns the created entry. This changes which mail the inbox will accept or send from that point on, so it is a standing rule rather than a one-off action. Writes to the shared AgentMail workspace: Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created, and what you write here is visible and editable by the next caller. Remove one with `delete_agentmail_inbox_list_entry`.",
        "tags": [
          "subpackage_inboxes.subpackage_inboxes/lists"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "direction",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_lists_Direction"
            }
          },
          {
            "name": "type",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_lists_ListType"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_lists_PodListEntry"
                }
              }
            }
          },
          "400": {
            "description": "Error response with status 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ValidationErrorResponse"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/type_lists_CreateListEntryRequest"
              }
            }
          }
        }
      }
    },
    "/agentmail/inboxes/{inbox_id}/drafts/{draft_id}/attachments/{attachment_id}": {
      "get": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "get_agentmail_inbox_draft_attachment",
        "summary": "Get Draft Attachment",
        "description": "Fetches metadata for one attachment on an unsent draft. Returns `attachment_id`, `filename`, `size`, `content_type`, `content_disposition`, `content_id` and a short-lived `download_url` with `expires_at`. The bytes are not inlined — fetch `download_url` before it expires. Ids come from the draft's `attachments` array on `get_agentmail_inbox_draft`. The sent-message twin is `get_agentmail_inbox_message_attachment`.",
        "tags": [
          "subpackage_inboxes.subpackage_inboxes/drafts"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "draft_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_drafts_DraftId"
            }
          },
          {
            "name": "attachment_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_attachments_AttachmentId"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_attachments_AttachmentResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/agentmail/api-keys": {
      "get": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "get_agentmail_api_keys",
        "summary": "List Account API Keys",
        "description": "Lists API key metadata for the AgentMail account: `count`, `next_page_token` and `api_keys`, each with `api_key_id`, `prefix`, `name`, `pod_id`, `inbox_id`, `used_at`, `permissions` and `created_at`. The key secret itself is never returned, only its `prefix`. 🔴 **This is the account-management surface, not a per-caller one.** Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created, so the keys listed are the AIsa platform's own, not yours. Nothing in normal mail workflows needs this — use `get_agentmail_inboxes` to find inboxes and `get_agentmail_inbox_messages` to read mail.",
        "tags": [
          "AgentMail"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Limit"
            }
          },
          {
            "name": "page_token",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__PageToken"
            }
          },
          {
            "name": "ascending",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Ascending"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_api-keys_ListApiKeysResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          }
        ]
      }
    },
    "/agentmail/domains": {
      "get": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.012,
          "cost_tier": "med"
        },
        "operationId": "get_agentmail_domains",
        "summary": "List Account Domains",
        "description": "Lists custom sending domains configured on the AgentMail account: `count`, `limit`, `next_page_token` and `domains`. 🔴 **This is the account-management surface, not a per-caller one.** Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created, so the domains listed belong to the AIsa platform. Inboxes created through AIsa always use `agentmail.to`, so this list does not change what `post_agentmail_inbox` can do.",
        "tags": [
          "AgentMail"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Limit"
            }
          },
          {
            "name": "page_token",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__PageToken"
            }
          },
          {
            "name": "ascending",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Ascending"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_domains_ListDomainsResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          }
        ]
      }
    },
    "/agentmail/threads/search": {
      "get": {
        "operationId": "get_agentmail_threads_search",
        "summary": "Search All Threads",
        "description": "Full-text search over threads in **every inbox in the account**. Returns `count`, `limit`, `next_page_token` and `threads`; page with `next_page_token`. Same fields as `get_agentmail_threads`, which is the one to use for everything in date order. This is the organization-wide view spanning every inbox in the account. Every AIsa caller shares one AgentMail account, so this reaches inboxes other callers created; the inbox-scoped twin `get_agentmail_inbox_threads_search` is the one to use when a single inbox is meant.",
        "tags": [
          "AgentMail"
        ],
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type__Query"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Limit"
            }
          },
          {
            "name": "page_token",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__PageToken"
            }
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Before"
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__After"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_threads_SearchThreadsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response with status 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ValidationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          }
        ]
      }
    },
    "/agentmail/inboxes/{inbox_id}/threads/search": {
      "get": {
        "operationId": "get_agentmail_inbox_threads_search",
        "summary": "Search Threads",
        "description": "Full-text search across one inbox's threads. Returns `count`, `limit`, `next_page_token` and `threads`; page with `next_page_token`. Same thread fields as `get_agentmail_inbox_threads`, which is the one to use for everything in date order. To search individual messages rather than conversations use `get_agentmail_inbox_messages_search`.",
        "tags": [
          "AgentMail"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type__Query"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Limit"
            }
          },
          {
            "name": "page_token",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__PageToken"
            }
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Before"
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__After"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_threads_SearchThreadsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response with status 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ValidationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          }
        ]
      }
    },
    "/agentmail/inboxes/{inbox_id}/messages/search": {
      "get": {
        "operationId": "get_agentmail_inbox_messages_search",
        "summary": "Search Messages",
        "description": "Full-text search across one inbox's messages. Returns `count`, `limit`, `next_page_token` and `messages`; page with `next_page_token`. Same message fields as `get_agentmail_inbox_messages`, which is the one to use when you want everything in date order rather than a query. Searching conversations instead of individual messages is `get_agentmail_inbox_threads_search`.",
        "tags": [
          "AgentMail"
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type_inboxes_InboxId"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/type__Query"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Limit"
            }
          },
          {
            "name": "page_token",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__PageToken"
            }
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__Before"
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/type__After"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response with status 200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type_messages_SearchMessagesResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response with status 400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ValidationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response with status 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/type__ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          }
        ]
      }
    }
  }
}
