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

# Get conversation history

> Retrieve all messages for a specific conversation.



## OpenAPI

````yaml /api-reference/openapi.yaml get /conversations/{id}
openapi: 3.0.3
info:
  title: NPC Builder - API
  description: >
    This is the latest NPC Builder API specification that defines a
    comprehensive, production-ready API for NPC Builder. The API is divided into
    three primary services:


    **Interactions Service**  
      - **Purpose:** Enables dynamic, context-aware conversations between players and NPC characters.


    **Context Service**  
      - **Purpose:** Manages in-game entities to build and maintain immersive game environments.
      - **Includes:**  
        - **Worlds:** Create, update, and delete game worlds.
        - **Regions:** Define and manage distinct regions within a world.
        - **Locations:** Handle specific locations within regions.
        - **Characters:** Manage the lifecycle (creation, updating, deletion) of NPC characters.


    **Sessions Service**  
      - **Purpose:** Manages player sessions to maintain game context and track interactions.


    Overall, this specification serves as a detailed guide to leveraging NPC
    Builder’s services—empowering developers to build rich, interactive
    experiences while efficiently managing game contexts and entities.
        _You must stick to the data structure defined, otherwise you may encounter unhandled errors_


    **Please check the schemas of each request to find the allowed values for
    certain properties.**


    _Technical Limitations: Character's knowledge and relationships updating and
    deleting are not available through the API. They must be managed through our
    app's frontend._


    Some useful links:

    - [Our website](https://npcbuilder.com)

    - [The App](https://app.npcbuilder.com)
  termsOfService: https://npcbuilder.com/terms-and-conditions/
  contact:
    email: support@npcbuilder.com
  version: 1.6.0
servers:
  - url: https://app.npcbuilder.com/api
    description: Production API for context, sessions, and non-interaction endpoints
security: []
tags:
  - name: Interactions
    description: Manage your NPCs text conversations and interactive responses.
  - name: Characters
    description: Manage characters in your game including creation, update, and deletion.
  - name: Worlds
    description: Create and manage immersive worlds for your game.
  - name: Regions
    description: Define and manage regions within your worlds.
  - name: Locations
    description: Manage specific locations within regions of your game.
  - name: Sessions
    description: Create, retrieve, and delete player sessions for enhanced game management.
paths:
  /conversations/{id}:
    get:
      tags:
        - Interactions
      summary: Get conversation history
      description: Retrieve all messages for a specific conversation.
      parameters:
        - name: id
          in: path
          required: true
          description: The conversation ID.
          schema:
            type: string
            example: conv_12345
        - name: game_id
          in: query
          required: true
          description: The game ID.
          schema:
            type: string
            example: tx65BrETVN2vMrrUIrlV
        - name: session_id
          in: query
          required: false
          description: (Optional) The session ID.
          schema:
            type: string
            example: 60Z5aZjIuFlyYbjbZZKe
      responses:
        '200':
          description: List of messages.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Messages'
        '500':
          description: Internal Server Error
      security:
        - npcbuilder_auth: []
components:
  schemas:
    Messages:
      type: object
      description: >
        A message object representing a single message in the conversation. The
        role indicates the sender ('user' for player messages, 'assistant' for
        NPC responses) and content holds the actual text.
      properties:
        role:
          type: string
          description: >
            The role of the message sender. Use 'user' for messages from the
            player and 'assistant' for NPC responses.
          enum:
            - user
            - assistant
          example: user
        content:
          type: string
          description: The text content of the message.
          example: Hello Jakinen, my name is Juan, I'll take my sword and dance!
      xml:
        name: messages_user
  securitySchemes:
    npcbuilder_auth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````