> ## 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 texts, then wait for a matching SMS

> Long-polls up to 25 seconds. The answer carries `code`, a verification code copied from the text when one is found.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/phone-numbers/{phoneNumberId}/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/phone-numbers/{phoneNumberId}/wait:
    post:
      tags:
        - Phone
      summary: Check recent texts, then wait for a matching SMS
      description: >-
        Long-polls up to 25 seconds. The answer carries `code`, a verification
        code copied from the text when one is found.
      parameters:
        - description: Phone number id
          in: path
          name: phoneNumberId
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: false
              properties:
                from:
                  description: Only texts from this sender
                  maxLength: 20
                  minLength: 8
                  type: string
                contains:
                  description: Only texts whose body 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
                timeout:
                  description: >-
                    Seconds to wait for a match, maximum 25; call again with the
                    returned cursor to keep waiting
                  maximum: 25
                  minimum: 0
                  type: integer
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                additionalProperties: false
                properties:
                  matched:
                    type: boolean
                  cursor:
                    description: Continue from here with since=cursor
                    type: string
                  message:
                    additionalProperties: false
                    nullable: true
                    properties:
                      id:
                        type: string
                      phone_number_id:
                        type: string
                      agent_id:
                        type: string
                      direction:
                        enum:
                          - inbound
                          - outbound
                        type: string
                      from:
                        nullable: true
                        type: string
                      to:
                        nullable: true
                        type: string
                      counterparty:
                        type: string
                      body:
                        type: string
                      segments:
                        maximum: 9007199254740991
                        minimum: -9007199254740991
                        type: integer
                      status:
                        enum:
                          - received
                          - quarantined
                          - queued
                          - sent
                          - delivered
                          - undelivered
                          - failed
                        type: string
                      error_code:
                        nullable: true
                        type: string
                      error_message:
                        nullable: true
                        type: string
                      screening:
                        additionalProperties: false
                        nullable: true
                        properties:
                          verdict:
                            type: string
                          reasons:
                            items:
                              type: string
                            type: array
                        required:
                          - verdict
                          - reasons
                        type: object
                      delivered_at:
                        format: date-time
                        nullable: true
                        type: string
                      created_at:
                        format: date-time
                        type: string
                      code:
                        description: A verification code copied from the text
                        nullable: true
                        type: string
                      link:
                        nullable: true
                        type: string
                    required:
                      - id
                      - phone_number_id
                      - agent_id
                      - direction
                      - from
                      - to
                      - counterparty
                      - body
                      - segments
                      - status
                      - error_code
                      - error_message
                      - screening
                      - delivered_at
                      - created_at
                      - code
                      - link
                    type: object
                required:
                  - matched
                  - cursor
                  - message
                type: object
          description: The text with any code, 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.