> ## 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 mailbox messages

> Lists messages for a mailbox with keyset pagination and time/sender/hasOtp filters for polling.



## OpenAPI

````yaml /api-reference/mobilerun-mailbox.yaml get /mailboxes/{mailboxId}/messages
openapi: 3.1.0
info:
  title: Mobilerun Mailbox
  version: v1
servers:
  - description: Droidrun Cloud API
    url: https://api.mobilerun.ai/v1
security:
  - bearerAuth: []
paths:
  /mailboxes/{mailboxId}/messages:
    get:
      tags:
        - Mailbox Messages
      summary: List mailbox messages
      description: >-
        Lists messages for a mailbox with keyset pagination and
        time/sender/hasOtp filters for polling.
      operationId: listMailboxMessages
      parameters:
        - in: path
          name: mailboxId
          required: true
          schema:
            format: uuid
            type: string
        - in: query
          name: limit
          required: false
          schema:
            default: 20
            maximum: 100
            minimum: 1
            type: integer
        - in: query
          name: cursor
          required: false
          schema:
            type: string
        - in: query
          name: after
          required: false
          schema:
            format: date-time
            type: string
        - in: query
          name: sender
          required: false
          schema:
            type: string
        - in: query
          name: hasOtp
          required: false
          schema:
            enum:
              - 'true'
              - 'false'
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MailboxMessageList'
          description: Messages retrieved
        '400':
          description: Bad Request
        '401':
          description: Unauthorized
        '404':
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: string
                required:
                  - error
                type: object
          description: Not Found
        '500':
          description: Internal Server Error
      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.mailboxes.messages.list('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');


            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.mailboxes.messages.list(
                mailbox_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
            )
            print(messages.items)
components:
  schemas:
    MailboxMessageList:
      properties:
        items:
          items:
            $ref: '#/components/schemas/MailboxMessageSummary'
          type: array
        nextCursor:
          type:
            - string
            - 'null'
      required:
        - items
        - nextCursor
      type: object
    MailboxMessageSummary:
      properties:
        fromAddress:
          type:
            - string
            - 'null'
        hasOtp:
          type: boolean
        id:
          type: string
        mailboxId:
          format: uuid
          type: string
        preview:
          type:
            - string
            - 'null'
        receivedAt:
          format: date-time
          type: string
        subject:
          type:
            - string
            - 'null'
      required:
        - id
        - mailboxId
        - fromAddress
        - subject
        - preview
        - hasOtp
        - receivedAt
      type: object
  securitySchemes:
    bearerAuth:
      bearerFormat: Opaque
      description: Bearer token via Authorization header
      scheme: bearer
      type: http

````