> ## 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.yaml get /numbers/phones/{id}/messages
openapi: 3.1.0
info:
  title: Mobilerun Numbers
  version: v1
servers:
  - description: Droidrun Cloud API
    url: https://api.mobilerun.ai/v1
security:
  - bearerAuth: []
paths:
  /numbers/phones/{id}/messages:
    get:
      tags:
        - Numbers
      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':
          description: Unauthorized
        '404':
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: string
                required:
                  - error
                type: object
          description: Not Found
        '500':
          description: Internal Server Error
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NumberErrorResponse'
          description: >-
            Service Unavailable — phone numbers are disabled for this deployment
            (see `reason`)
      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'
              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:
                enum:
                  - received
                  - queued
                  - claimed
                  - sending
                  - sent
                  - sent_unconfirmed
                  - delivered
                  - failed
                type: string
            required:
              - id
              - esimId
              - direction
              - status
              - peerNumber
              - peerKey
              - body
              - deliveryStatus
              - detectedSender
              - occurredAt
              - createdAt
            type: object
          type: array
        pagination:
          $ref: '#/components/schemas/Pagination'
      required:
        - items
        - pagination
      type: object
    NumberErrorResponse:
      properties:
        message:
          type: string
        reason:
          enum:
            - product_disabled
            - not_cancellable
          type: string
        success:
          enum:
            - false
          type: boolean
      required:
        - success
        - reason
        - message
      type: object
    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
  securitySchemes:
    bearerAuth:
      bearerFormat: Opaque
      description: Bearer token via Authorization header
      scheme: bearer
      type: http

````