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

# List threads and messages on an inbox

> Returns threads on the inbox, newest activity first, each with its messages
and stored per-thread metrics. Paging is over **threads**, not individual
messages.

The window filters on the thread's last message time and `dateTo` is
exclusive. Automated/junk threads are excluded unless `includeJunk=true`.

`sentVia` indicates whether an outbound was composed in Aptly (`aptly`) or
sent from the user's own mail client and synced in (`native`). Inbound
messages are always `null`.




## OpenAPI

````yaml /openapi.yaml get /api/inboxes/{channelId}/messages
openapi: 3.0.3
info:
  title: Aptly API
  version: '1.0'
  description: >
    The Aptly API lets you read and write cards on any Aptly board from external
    systems.


    All requests require an API key passed as the `x-token` header.

    API keys are scoped to your company and work across all boards.
servers:
  - url: https://core-api.getaptly.com
    description: Production
security:
  - ApiKeyHeader: []
paths:
  /api/inboxes/{channelId}/messages:
    get:
      tags:
        - Inboxes
      summary: List threads and messages on an inbox
      description: >
        Returns threads on the inbox, newest activity first, each with its
        messages

        and stored per-thread metrics. Paging is over **threads**, not
        individual

        messages.


        The window filters on the thread's last message time and `dateTo` is

        exclusive. Automated/junk threads are excluded unless
        `includeJunk=true`.


        `sentVia` indicates whether an outbound was composed in Aptly (`aptly`)
        or

        sent from the user's own mail client and synced in (`native`). Inbound

        messages are always `null`.
      operationId: listInboxMessages
      parameters:
        - name: channelId
          in: path
          required: true
          schema:
            type: string
          description: External channel meta ID (`meta.id`) of the inbox.
        - name: dateFrom
          in: query
          schema:
            type: string
            format: date-time
          description: ISO date. Only threads with activity at or after this time.
        - name: dateTo
          in: query
          schema:
            type: string
            format: date-time
          description: ISO date, exclusive. Range must not exceed 400 days.
        - name: direction
          in: query
          schema:
            type: string
            enum:
              - in
              - out
          description: Filter to threads whose most recent message went this way.
        - name: includeJunk
          in: query
          schema:
            type: boolean
            default: false
          description: Include threads classified as junk/automated.
        - name: page
          in: query
          schema:
            type: integer
            default: 0
          description: Zero-based page number (0–9999).
        - name: pageSize
          in: query
          schema:
            type: integer
            default: 20
            maximum: 200
          description: Threads per page.
      responses:
        '200':
          description: Threads with their messages and metrics.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/InboxThread'
                  count:
                    type: integer
                    description: Total matching threads across all pages.
                  page:
                    type: integer
                  pageSize:
                    type: integer
        '400':
          description: Invalid date range, paging, or direction value.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Invalid or missing credential.
        '403':
          description: The authenticated user cannot reach this inbox.
        '404':
          description: Inbox not found in your company.
      security:
        - ApiKeyHeader: []
        - DelegateToken: []
        - PartnerBearer: []
components:
  schemas:
    InboxThread:
      type: object
      properties:
        threadId:
          type: string
        subject:
          type: string
          nullable: true
        status:
          type: string
          enum:
            - open
            - closed
        assignee:
          type: string
          nullable: true
          description: Assigned Aptly user id, or null when unassigned.
        type:
          type: string
          nullable: true
        participants:
          type: array
          items:
            type: string
          description: Email addresses / phone numbers taking part in the thread.
        metrics:
          $ref: '#/components/schemas/InboxThreadMetrics'
        messages:
          type: array
          items:
            $ref: '#/components/schemas/InboxMessage'
    Error:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
    InboxThreadMetrics:
      type: object
      description: >-
        Stored metrics for one thread. Response times are in business hours,
        using the company's configured business hours and holidays.
      properties:
        firstResponseHrs:
          type: number
          nullable: true
          description: Time to the first reply. Null when nobody has replied.
        avgResponseHrs:
          type: number
          nullable: true
        responseCount:
          type: integer
          description: Replies the averages were computed from.
        reopened:
          type: boolean
          description: True when an inbound arrived after the thread was closed.
        touchCount:
          type: integer
          description: Total messages in the thread, both directions.
        inboundCount:
          type: integer
        outboundCount:
          type: integer
        lastMessageAt:
          type: string
          format: date-time
          nullable: true
        lastMessageDirection:
          type: string
          nullable: true
          enum:
            - in
            - out
    InboxMessage:
      type: object
      properties:
        messageId:
          type: string
        threadId:
          type: string
        subject:
          type: string
          nullable: true
        body:
          type: string
          nullable: true
        type:
          type: string
          nullable: true
          description: e.g. `email`, `sms`, `voice`.
        timestamp:
          type: string
          format: date-time
        direction:
          type: string
          enum:
            - in
            - out
        from:
          type: object
          nullable: true
          description: >-
            Sender, as `{ id, name }` where `id` is an email address or phone
            number.
        to:
          type: array
          items:
            type: object
          description: Recipients, each as `{ id, name }`.
        sentByUser:
          type: string
          nullable: true
          description: Aptly user id that sent an outbound, when known.
        sentVia:
          type: string
          nullable: true
          enum:
            - aptly
            - native
          description: >-
            How an outbound message was sent: `aptly` when it was composed in
            Aptly, `native` when the user sent it from their own mail client and
            it synced in. Always `null` on inbound messages.
  securitySchemes:
    ApiKeyHeader:
      type: apiKey
      in: header
      name: x-token
    DelegateToken:
      type: apiKey
      in: header
      name: Authorization
      description: 'Delegate token issued by the platform. Format: `DelegateToken <token>`'
    PartnerBearer:
      type: http
      scheme: bearer
      description: 'Partner token. Format: `Authorization: Bearer <token>`'

````