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

# Export conversations

> Export all conversations with full message history for an agent. Includes conversations from all sources. Tool results are sanitized to remove internal data. Supports cursor-based pagination.



## OpenAPI

````yaml /api-v2-openapi.json get /agents/{agentId}/conversations/export
openapi: 3.1.0
info:
  title: Chatbase API v2
  version: 2.0.0
  description: >-
    Chatbase API v2 - A robust, structured API for managing agents and
    conversations.
servers:
  - url: https://www.chatbase.co/api/v2
    description: Chatbase API v2
security: []
paths:
  /agents/{agentId}/conversations/export:
    get:
      tags:
        - Conversations
      summary: Export conversations
      description: >-
        Export all conversations with full message history for an agent.
        Includes conversations from all sources. Tool results are sanitized to
        remove internal data. Supports cursor-based pagination.
      parameters:
        - schema:
            type: string
            minLength: 1
            description: The agent ID
            example: 5QHA6VB-DIAbBhxwqxfdi
          required: true
          description: The agent ID
          name: agentId
          in: path
        - schema:
            type: string
            description: Opaque cursor from a previous response to fetch the next page
            example: eyJ0IjoiMjAyNC0wMS0xNVQxMDozMDowMC4wMDBaIiwiaWQiOiJhYmMxMjMifQ==
          required: false
          description: Opaque cursor from a previous response to fetch the next page
          name: cursor
          in: query
        - schema:
            type: integer
            minimum: 1
            maximum: 20
            default: 20
            description: Number of items per page (1–20, default 20)
            example: 20
          required: false
          description: Number of items per page (1–20, default 20)
          name: limit
          in: query
      responses:
        '200':
          description: Paginated list of conversations with full message history
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExportConversationsResponse'
        '400':
          description: >-
            The request body failed schema validation. Inspect the `details`
            object in the error response for field-level errors.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: VALIDATION_INVALID_BODY
                  message: Invalid request
        '401':
          description: >-
            No Authorization header present. Provide a valid API key as a Bearer
            token in the Authorization header: `Authorization: Bearer
            <api-key>`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: AUTH_MISSING_API_KEY
                  message: Authentication required
        '403':
          description: >-
            Your current plan does not include API access. Upgrade to the
            Standard plan or higher to use the API.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: SUBSCRIPTION_API_RESTRICTED_PLAN
                  message: A Standard plan or higher is required to access the API
        '429':
          description: >-
            Rate limit exceeded. Check the `X-RateLimit-Reset` response header
            for the Unix epoch seconds when the limit resets.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: RATE_LIMIT_TOO_MANY_REQUESTS
                  message: Too many requests, please try again later
        '500':
          description: >-
            An unhandled server error occurred. If the issue persists, contact
            support with the `x-request-id` response header value for debugging.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: INTERNAL_SERVER_ERROR
                  message: Something went wrong, please try again
      security:
        - bearerAuth: []
components:
  schemas:
    ExportConversationsResponse:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/ExportConversation'
        pagination:
          type: object
          properties:
            cursor:
              type:
                - string
                - 'null'
              description: Cursor for the next page, or null if no more pages
            hasMore:
              type: boolean
              description: Whether more results are available
            total:
              type: number
              description: Total number of items matching the query
          required:
            - cursor
            - hasMore
            - total
      required:
        - data
        - pagination
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: Machine-readable error code
            message:
              type: string
              description: Human-readable error message
            details:
              type: object
              additionalProperties:
                type: string
              description: Field-level validation errors
          required:
            - code
            - message
      required:
        - error
    ExportConversation:
      type: object
      properties:
        id:
          type: string
          description: Conversation ID
        title:
          type:
            - string
            - 'null'
          description: Conversation title
        createdAt:
          type: number
          description: Unix epoch timestamp (seconds)
        updatedAt:
          type: number
          description: Unix epoch timestamp (seconds) of last activity
        userId:
          type:
            - string
            - 'null'
          description: User ID if the conversation is authenticated
        source:
          type:
            - string
            - 'null'
          enum:
            - API
            - WhatsApp
            - Messenger
            - Instagram
            - Slack
            - Salesforce
            - Zendesk
            - Zendesk Messaging
            - Chatbase site
            - Playground
            - Action preview
            - Qna preview
            - Widget or Iframe
            - Iframe
            - Email
            - Agent page
            - Phone
            - Android SDK
            - iOS SDK
            - Unspecified
            - null
          description: Conversation source
        status:
          type: string
          enum:
            - ongoing
            - ended
            - taken_over
          description: Conversation activity status
        messages:
          type: array
          items:
            $ref: '#/components/schemas/ExportMessage'
          description: Conversation messages
      required:
        - id
        - title
        - createdAt
        - updatedAt
        - userId
        - source
        - status
        - messages
    ExportMessage:
      type: object
      properties:
        id:
          type: string
          description: Message ID
        role:
          type: string
          enum:
            - user
            - assistant
          description: Message role
        parts:
          type: array
          items:
            oneOf:
              - type: object
                properties:
                  type:
                    type: string
                    enum:
                      - text
                  text:
                    type: string
                required:
                  - type
                  - text
              - type: object
                properties:
                  type:
                    type: string
                    enum:
                      - tool-call
                  toolCallId:
                    type: string
                  toolName:
                    type: string
                required:
                  - type
                  - toolCallId
                  - toolName
              - type: object
                properties:
                  type:
                    type: string
                    enum:
                      - tool-result
                  toolCallId:
                    type: string
                  toolName:
                    type: string
                  output: {}
                required:
                  - type
                  - toolCallId
                  - toolName
          description: Message content parts
        createdAt:
          type: number
          description: Unix epoch timestamp (seconds)
        feedback:
          type:
            - string
            - 'null'
          enum:
            - positive
            - negative
            - null
          description: User feedback on this message (present on assistant messages)
        metadata:
          $ref: '#/components/schemas/MessageMetadata'
      required:
        - id
        - role
        - parts
    MessageMetadata:
      type: object
      properties:
        score:
          type:
            - number
            - 'null'
          description: Confidence score for this message (0 to 1 float value)
      required:
        - score
      description: Message metadata (present on assistant messages)
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key from your account settings

````