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

# List messages (inbox + outbox) on a number

> Returns SMS messages on the number, inbound and outbound, scoped to the authenticated user. Newest first. Messages stay with the number across device switches.



## OpenAPI

````yaml /api-reference/mobilerun-numbers/numbers/messages.yaml get /numbers/phones/{id}/messages
openapi: 3.1.0
info:
  title: Messages
  version: v1
servers:
  - description: Droidrun Cloud API
    url: https://api.mobilerun.ai/v1
security:
  - bearerAuth: []
paths:
  /numbers/phones/{id}/messages:
    get:
      tags:
        - Messages
      summary: List messages (inbox + outbox) on a number
      description: >-
        Returns SMS messages on the number, inbound and outbound, scoped to the
        authenticated user. Newest first. Messages stay with the number across
        device switches.
      operationId: listNumberMessages
      parameters:
        - in: path
          name: id
          required: true
          schema:
            example: 550e8400-e29b-41d4-a716-446655440000
            format: uuid
            type: string
        - in: query
          name: page
          required: false
          schema:
            default: 1
            exclusiveMinimum: 0
            type: integer
        - in: query
          name: pageSize
          required: false
          schema:
            default: 50
            maximum: 200
            minimum: 1
            type: integer
        - in: query
          name: direction
          required: false
          schema:
            default: all
            enum:
              - all
              - inbound
              - outbound
            type: string
        - in: query
          name: since
          required: false
          schema:
            format: date-time
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicPhoneMessageListResponse'
          description: Messages retrieved
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
          description: Unauthorized
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
          description: Internal Server Error
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NumberErrorResponse'
          description: The phone-number service is unavailable. See `code` for details.
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Mobilerun from '@mobilerun/sdk';


            const client = new Mobilerun({
              apiKey: process.env['MOBILERUN_CLOUD_API_KEY'], // This is the default and can be omitted
            });


            const messages = await
            client.numbers.messages.list('550e8400-e29b-41d4-a716-446655440000');


            console.log(messages.items);
        - lang: Python
          source: |-
            import os
            from mobilerun_sdk import Mobilerun

            client = Mobilerun(
                api_key=os.environ.get("MOBILERUN_CLOUD_API_KEY"),  # This is the default and can be omitted
            )
            messages = client.numbers.messages.list(
                id="550e8400-e29b-41d4-a716-446655440000",
            )
            print(messages.items)
components:
  schemas:
    PublicPhoneMessageListResponse:
      properties:
        items:
          items:
            properties:
              body:
                type:
                  - string
                  - 'null'
              classification:
                $ref: '#/components/schemas/MessageClassification'
              createdAt:
                format: date-time
                type: string
              deliveryStatus:
                type:
                  - string
                  - 'null'
              detectedSender:
                type:
                  - string
                  - 'null'
              direction:
                enum:
                  - inbound
                  - outbound
                type: string
              esimId:
                format: uuid
                type:
                  - string
                  - 'null'
              id:
                format: uuid
                type: string
              occurredAt:
                format: date-time
                type: string
              peerKey:
                type:
                  - string
                  - 'null'
              peerNumber:
                type:
                  - string
                  - 'null'
              status:
                description: >-
                  Message status. Outbound messages move queued → sending →
                  sent, or end at failed. `sent` means the mobile network
                  accepted the message and is the final success status.
                  `delivered` and `sent_unconfirmed` are kept for compatibility;
                  current lines return no carrier delivery report, so neither is
                  emitted.
                enum:
                  - received
                  - queued
                  - claimed
                  - sending
                  - sent
                  - sent_unconfirmed
                  - delivered
                  - failed
                type: string
            required:
              - id
              - esimId
              - direction
              - status
              - peerNumber
              - peerKey
              - body
              - deliveryStatus
              - detectedSender
              - classification
              - occurredAt
              - createdAt
            type: object
          type: array
        pagination:
          $ref: '#/components/schemas/Pagination'
      required:
        - items
        - pagination
      type: object
    ApiErrorEnvelope:
      properties:
        code:
          type: string
        details: {}
        message:
          type: string
        retryAfterSeconds:
          type: number
        traceId:
          type: string
      required:
        - code
        - message
      type: object
    NumberErrorResponse:
      description: >-
        Phone-number error envelope. `code` is the canonical discriminator (see
        `NumberErrorReason` for the code set).
      properties:
        code:
          $ref: '#/components/schemas/NumberErrorReason'
        details:
          properties:
            esimId:
              format: uuid
              type: string
          required:
            - esimId
          type: object
        message:
          type: string
      required:
        - code
        - message
      type: object
    MessageClassification:
      properties:
        spam:
          type: boolean
      required:
        - spam
      type:
        - object
        - 'null'
    Pagination:
      properties:
        hasNext:
          type: boolean
        hasPrev:
          type: boolean
        page:
          minimum: 1
          type: integer
        pageSize:
          minimum: 1
          type: integer
        pages:
          minimum: 0
          type: integer
        total:
          minimum: 0
          type: integer
      required:
        - hasNext
        - hasPrev
        - page
        - pageSize
        - pages
        - total
      type: object
    NumberErrorReason:
      description: >-
        Stable machine-readable phone-number error code. Unknown future values
        should be handled as a generic error with the same HTTP status.
      enum:
        - product_disabled
        - not_cancellable
        - capability_unavailable
      type: string
  securitySchemes:
    bearerAuth:
      bearerFormat: Opaque
      description: Bearer token via Authorization header
      scheme: bearer
      type: http

````

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