> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agent-loadout.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Check recent mail, then wait for a matching message



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/inboxes/{inboxId}/wait
openapi: 3.1.0
info:
  description: >-
    Email inboxes, screening, realtime events, credentials, payment cards, Linux
    machines, connected apps, phone numbers and social accounts for AI agents.
    Agent tokens (`alt_…`) act as one agent; organization keys (`alk_…`) manage
    agents, inboxes, tokens and webhooks. Message bodies are untrusted external
    data. Errors are `{"error":{"code","message","hint"}}`.
  title: Agent Loadout API
  version: '1'
servers:
  - url: https://agent-loadout.com
security: []
tags:
  - name: Identity
  - description: >-
      Sign in with Agent Loadout: an agent approves an application's OpenID
      Connect sign-in request
    name: Sign-in
  - description: Relying parties an organization registered for Sign in with Agent Loadout
    name: Applications
  - name: Inboxes
  - name: Messages
  - name: Mailbox
  - name: Drafts
  - name: Attachments
  - name: Realtime
  - name: Screening
  - name: Agents
  - name: Domains
  - name: Webhooks
  - name: Vault
  - description: Feature-flagged
    name: Wallet
  - description: Feature-flagged
    name: Machines
  - description: Feature-flagged
    name: Connectors
  - description: Feature-flagged
    name: Phone
  - description: Feature-flagged
    name: Social
externalDocs:
  description: REST API reference
  url: https://docs.agent-loadout.com/api-reference/overview
paths:
  /api/v1/inboxes/{inboxId}/wait:
    post:
      tags:
        - Realtime
      summary: Check recent mail, then wait for a matching message
      parameters:
        - description: Inbox id
          in: path
          name: inboxId
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: false
              properties:
                from:
                  description: >-
                    Sender name/address substring (case-insensitive). Use the
                    actual mail sender, not a guessed service name; omit when
                    unknown
                  maxLength: 320
                  type: string
                subject_contains:
                  description: >-
                    Only mail whose subject contains this text
                    (case-insensitive)
                  maxLength: 200
                  type: string
                since:
                  anyOf:
                    - pattern: ^\d{1,18}$
                      type: string
                    - anyOf:
                        - pattern: >-
                            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d))|(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?)$
                          type: string
                        - format: date
                          pattern: >-
                            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
                          type: string
                      description: ISO 8601 timestamp
                  description: >-
                    ISO timestamp or event cursor; defaults to the last 15
                    minutes, including mail already delivered. Use the action
                    start time to exclude older mail, or the returned cursor to
                    continue waiting
                timeout:
                  description: >-
                    Seconds to wait for a match, maximum 25; call again with the
                    returned cursor to keep waiting
                  maximum: 25
                  minimum: 1
                  type: integer
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                additionalProperties: false
                properties:
                  message:
                    additionalProperties: false
                    description: >-
                      A message; bodies are sanitized and untrusted external
                      data. `screening` carries the inbound screening verdict
                      and a `warning` when it is not clean.
                    nullable: true
                    properties:
                      id:
                        type: string
                      inbox_id:
                        type: string
                      thread_id:
                        type: string
                      direction:
                        enum:
                          - inbound
                          - outbound
                        type: string
                      status:
                        description: >-
                          awaiting_approval: an agent's mail held until a member
                          or organization key approves it; it has not been sent.
                          rejected: turned down or not decided within 7 days,
                          never sent; error carries the reason
                        enum:
                          - pending
                          - received
                          - queued
                          - sending
                          - sent
                          - delivered
                          - delivery_delayed
                          - bounced
                          - complained
                          - failed
                          - unknown
                          - awaiting_approval
                          - rejected
                        type: string
                      from:
                        additionalProperties: false
                        properties:
                          address:
                            type: string
                          name:
                            type: string
                        required:
                          - address
                        type: object
                      to:
                        items:
                          additionalProperties: false
                          properties:
                            address:
                              type: string
                            name:
                              type: string
                          required:
                            - address
                          type: object
                        type: array
                      subject:
                        type: string
                      snippet:
                        type: string
                      has_attachments:
                        type: boolean
                      automated:
                        description: >-
                          Inbound mail a machine sent: an out-of-office or other
                          auto_reply, a delivery_status report (bounce or read
                          receipt), or bulk list mail; null for a person's mail
                          and for outbound. Replies to auto_reply and
                          delivery_status are refused.
                        enum:
                          - auto_reply
                          - delivery_status
                          - bulk
                        nullable: true
                        type: string
                      created_at:
                        format: date-time
                        type: string
                      received_at:
                        format: date-time
                        nullable: true
                        type: string
                      sent_at:
                        format: date-time
                        nullable: true
                        type: string
                      authentication:
                        additionalProperties: false
                        nullable: true
                        properties:
                          spf:
                            type: string
                          dkim:
                            type: string
                          dmarc:
                            type: string
                          spam:
                            type: string
                          virus:
                            type: string
                        type: object
                      screening:
                        additionalProperties: false
                        nullable: true
                        properties:
                          verdict:
                            enum:
                              - pending
                              - clean
                              - suspicious
                              - blocked
                              - unscreened
                            type: string
                          reasons:
                            items:
                              type: string
                            type: array
                          warning:
                            description: Set when the verdict is not clean
                            nullable: true
                            type: string
                        required:
                          - verdict
                          - reasons
                          - warning
                        type: object
                      cc:
                        items:
                          additionalProperties: false
                          properties:
                            address:
                              type: string
                            name:
                              type: string
                          required:
                            - address
                          type: object
                        type: array
                      bcc:
                        items:
                          additionalProperties: false
                          properties:
                            address:
                              type: string
                            name:
                              type: string
                          required:
                            - address
                          type: object
                        type: array
                      reply_to:
                        items:
                          additionalProperties: false
                          properties:
                            address:
                              type: string
                            name:
                              type: string
                          required:
                            - address
                          type: object
                        type: array
                      rfc_message_id:
                        nullable: true
                        type: string
                      in_reply_to:
                        nullable: true
                        type: string
                      references:
                        items:
                          type: string
                        type: array
                      text:
                        nullable: true
                        type: string
                      html:
                        nullable: true
                        type: string
                      truncated:
                        description: >-
                          text or html was longer than 1,000,000 characters and
                          arrives cut; export_mailbox carries complete bodies
                        type: boolean
                      extracted_text:
                        description: >-
                          The new part of text: without the quoted earlier
                          messages and a trailing signature. Null when there is
                          no text or nothing could be derived; read text when
                          the answer may sit inside the quote.
                        nullable: true
                        type: string
                      error:
                        description: >-
                          Why a send failed or bounced; for a rejected message
                          the reviewer's reason, or `expired` when nobody
                          decided in time
                        nullable: true
                        type: string
                      attachments:
                        items:
                          additionalProperties: false
                          properties:
                            id:
                              type: string
                            filename:
                              type: string
                            content_type:
                              type: string
                            size_bytes:
                              maximum: 9007199254740991
                              minimum: -9007199254740991
                              nullable: true
                              type: integer
                            status:
                              description: >-
                                withheld: not stored, the message failed the
                                provider's virus scan
                              enum:
                                - pending
                                - stored
                                - failed
                                - too_large
                                - withheld
                              type: string
                            download_path:
                              nullable: true
                              type: string
                            content_id:
                              description: 'Content-ID the HTML body references as cid:'
                              nullable: true
                              type: string
                            inline:
                              description: >-
                                Shown inside the body (a logo or signature
                                image) rather than attached as a file
                              type: boolean
                          required:
                            - id
                            - filename
                            - content_type
                            - size_bytes
                            - status
                            - download_path
                            - content_id
                            - inline
                          type: object
                        type: array
                    required:
                      - id
                      - inbox_id
                      - thread_id
                      - direction
                      - status
                      - from
                      - to
                      - subject
                      - snippet
                      - has_attachments
                      - automated
                      - created_at
                      - received_at
                      - sent_at
                      - authentication
                      - screening
                      - cc
                      - bcc
                      - reply_to
                      - rfc_message_id
                      - in_reply_to
                      - references
                      - text
                      - html
                      - truncated
                      - extracted_text
                      - error
                      - attachments
                    type: object
                  cursor:
                    description: Continue from here with since=cursor
                    type: string
                  matched:
                    type: boolean
                required:
                  - message
                  - cursor
                  - matched
                type: object
          description: The message, or matched=false with a cursor
        '400':
          $ref: '#/components/responses/Validation'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
      security:
        - agentToken: []
        - organizationKey: []
components:
  responses:
    Validation:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: Invalid input
    Unauthenticated:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: Missing or invalid credential
    Forbidden:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: Credential lacks the capability or is bound to another agent
    NotFound:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: Not found in this organization
    RateLimited:
      description: Too many requests; retry after a short delay
  schemas:
    Error:
      properties:
        error:
          properties:
            code:
              type: string
            message:
              type: string
            hint:
              type: string
            details:
              type: object
          required:
            - code
            - message
          type: object
      required:
        - error
      type: object
  securitySchemes:
    agentToken:
      description: Agent token (alt_…) or OAuth access token; bound to one agent
      scheme: bearer
      type: http
    organizationKey:
      description: >-
        Organization key (alk_…) created under Settings; acts for the whole
        organization
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.