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

# Get a conversation

> Read a conversation's messages and tool calls, newest first, a page of turns at a time.



## OpenAPI

````yaml api-reference/openapi.yaml GET /v1/conversations/{conversation_id}/items
openapi: 3.0.3
info:
  title: QX API
  version: '1.0'
  description: >-
    Run what you build in QX from your own code. Message agents, execute flows
    and grids, and read their results.
servers:
  - url: https://api.qxlabs.com
security:
  - bearerAuth: []
tags:
  - name: Agents
    description: >-
      Message agents through OpenAI's Responses API, so OpenAI's SDKs work with
      a QX API key.
  - name: Flows
    description: Execute flows and follow their executions.
  - name: Grids
    description: Execute grids, follow their executions and read their rows.
paths:
  /v1/conversations/{conversation_id}/items:
    get:
      tags:
        - Agents
      summary: Get a conversation
      description: >
        Returns a conversation's messages and tool calls, newest first, a page
        of turns at a time. A turn is a user message and everything after it.

        Items have the same shapes and IDs as in the responses. To get the next
        page, send the page's `last_id` as `after`.
      operationId: getConversation
      parameters:
        - name: conversation_id
          in: path
          required: true
          schema:
            type: string
          description: The conversation's ID, from a response's `conversation`
          example: 8d2c4e6f8a0b1c3d5e7f9a1b3c5d7e9f
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            default: 20
          description: Turns per page, from 1 to 100
        - name: after
          in: query
          required: false
          schema:
            type: string
          description: The previous page's `last_id`
        - name: order
          in: query
          required: false
          schema:
            type: string
            enum:
              - desc
            default: desc
          description: Only newest first
      responses:
        '200':
          description: A page of the conversation
          content:
            application/json:
              schema:
                type: object
                properties:
                  object:
                    type: string
                  data:
                    type: array
                    description: >-
                      `message` items for your and the agent's messages,
                      `reasoning` items for the agent's thinking, `mcp_call`
                      items for tool calls, and `mcp_approval_request` items for
                      approval requests still open. Newest first
                    items:
                      $ref: '#/components/schemas/Item'
                  first_id:
                    type: string
                  last_id:
                    type: string
                  has_more:
                    type: boolean
                    description: Whether there are earlier turns
              example:
                object: list
                data:
                  - type: message
                    id: msg_77c0a1b2c3d4
                    role: assistant
                    status: completed
                    content:
                      - type: output_text
                        text: You have 3 unread emails today...
                        annotations: []
                  - type: message
                    id: 3f9a1c2b4d5e6f708192a3b4
                    role: user
                    status: completed
                    content:
                      - type: input_text
                        text: Summarise my unread emails from today
                first_id: msg_77c0a1b2c3d4
                last_id: 3f9a1c2b4d5e6f708192a3b4
                has_more: false
        '400':
          description: '`limit` or `order` isn''t valid'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentsError'
              example:
                error:
                  message: limit must be from 1 to 100.
                  type: invalid_request_error
                  param: null
                  code: null
        '404':
          description: There's no such conversation for you
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentsError'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentsError'
      x-codeSamples:
        - lang: bash
          label: cURL
          source: >
            curl
            "https://api.qxlabs.com/v1/conversations/8d2c4e6f8a0b1c3d5e7f9a1b3c5d7e9f/items?limit=20"
            \
              -H "Authorization: Bearer <YOUR_QX_API_KEY>"
        - lang: python
          label: Python
          source: >
            from openai import OpenAI


            client = OpenAI(base_url="https://api.qxlabs.com/v1",
            api_key="<YOUR_QX_API_KEY>")


            # The SDK fetches the next pages as you go

            for item in
            client.conversations.items.list("8d2c4e6f8a0b1c3d5e7f9a1b3c5d7e9f",
            limit=20):
                print(item.type, item.id)
        - lang: typescript
          label: TypeScript
          source: >
            import OpenAI from "openai";


            const client = new OpenAI({ baseURL: "https://api.qxlabs.com/v1",
            apiKey: "<YOUR_QX_API_KEY>" });


            // The SDK fetches the next pages as you go

            for await (const item of
            client.conversations.items.list("8d2c4e6f8a0b1c3d5e7f9a1b3c5d7e9f",
            { limit: 20 })) {
              console.log(item.type, item.id);
            }
components:
  schemas:
    Item:
      type: object
      title: Item
      description: >-
        One thing in a turn. `type` says which kind it is, and the other fields
        go with it
      properties:
        type:
          type: string
          enum:
            - reasoning
            - message
            - mcp_call
            - mcp_approval_request
          description: >-
            `reasoning` for the agent's thinking, `message` for a message,
            `mcp_call` for a tool call, `mcp_approval_request` for a call
            waiting for your approval
        id:
          type: string
          description: >-
            An approval request's ID goes back as `approval_request_id` in your
            answer
          example: msg_77c0a1b2c3d4
        status:
          type: string
          enum:
            - in_progress
            - completed
            - failed
            - incomplete
          description: >-
            For reasoning, messages and tool calls. A tool call that failed is
            `failed`, and one that was stopped is `incomplete`
        role:
          type: string
          enum:
            - assistant
            - user
          description: >-
            For messages. `assistant` for the agent's, `user` for yours, which
            only a conversation's items hold
        content:
          type: array
          description: >-
            For messages. The agent's message is an `output_text` part with its
            text and the sources it cites. Your message is an `input_text` part,
            then an `input_file` part per file
          items:
            type: object
            properties:
              type:
                type: string
                enum:
                  - output_text
                  - input_text
                  - input_file
              text:
                type: string
                description: For `output_text` and `input_text`
              filename:
                type: string
                description: For `input_file`
              annotations:
                type: array
                description: >-
                  For `output_text`. A `url_citation` for each source with a
                  link
                items:
                  type: object
                  properties:
                    type:
                      type: string
                      enum:
                        - url_citation
                    url:
                      type: string
                    title:
                      type: string
                    start_index:
                      type: integer
                      description: >-
                        Where the citation's `[n]` marker starts in the text. 0
                        when the text doesn't cite it
                    end_index:
                      type: integer
                      description: Where the marker ends. 0 when the text doesn't cite it
        summary:
          type: array
          description: For reasoning. The thinking as `summary_text` parts
          items:
            type: object
            properties:
              type:
                type: string
                enum:
                  - summary_text
              text:
                type: string
        server_label:
          type: string
          description: >-
            For tool calls and approval requests. `qx` for one of QX's own
            tools, or the app, like `gmail`
        name:
          type: string
          description: >-
            For tool calls and approval requests. The tool, like `web_search` or
            `GMAIL_SEND_EMAIL`
        arguments:
          type: string
          description: >-
            For tool calls and approval requests, as a JSON object in a string.
            A call to one of QX's own tools shows only the `command`, `query`,
            `url` or `path` it was given, with a command cut to 40 characters,
            and a call to an app's tool shows `{}`. An approval request has the
            call's arguments in full, with the agent's `reason` for it among
            them
          example: '{}'
        output:
          type: string
          nullable: true
          description: For tool calls. Always null, since a tool's result stays in the app
        error:
          type: string
          nullable: true
          description: >-
            For tool calls. The result when the call failed or was stopped, null
            otherwise
        approval_request_id:
          type: string
          nullable: true
          description: >-
            For tool calls. The approval request the call ran after, if it
            needed one
    AgentsError:
      type: object
      description: OpenAI's error shape
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
            param:
              type: string
              nullable: true
            code:
              type: string
              nullable: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Your QX API key. The `X-API-Key` header works too

````

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