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

# Get session history

> This endpoint, given a session ID, returns the complete message history for that specific session.



## OpenAPI

````yaml open-api-files/treble-api-en.json GET /devapi/session/{session_id}/history
openapi: 3.0.1
info:
  title: Treble Poll API
  description: Documentation for the poll deployment endpoint in Treble
  version: 1.0.0
servers:
  - url: https://main.treble.ai
    description: Main Treble server
  - url: https://yourdomain.com
    description: >-
      Example server for implementing webhooks. This represents YOUR server
      where you must implement the endpoints that Treble will call.
security: []
tags:
  - name: Webhooks
    description: >-
      Endpoints that Treble will call on your server. These are not real
      endpoints that you can call, but a representation of the webhooks that
      Treble will invoke in your system.
paths:
  /devapi/session/{session_id}/history:
    get:
      summary: Get message history from a session
      description: >-
        This endpoint, given a session ID, returns the complete message history
        for that specific session.
      parameters:
        - name: session_id
          in: path
          required: true
          description: ID of the session from which you want to obtain the message history
          schema:
            type: string
        - name: Authorization
          in: header
          required: true
          description: >-
            Authorization API Key. Can be obtained at
            https://app.treble.ai/en/dashboard/settings/developers
          schema:
            type: string
          example: API_KEY
      responses:
        '200':
          description: Message history obtained correctly
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    type:
                      type: string
                      description: Type of entry in the history
                      example: MESSAGE
                    message:
                      type: object
                      properties:
                        type:
                          type: string
                          description: Type of message
                          example: TEXT
                        sender:
                          type: string
                          description: Sender of the message
                          example: USER
                        text:
                          type: string
                          description: Content of the message
                        file_url:
                          type: string
                          nullable: true
                          description: URL of the attached file (if it exists)
                        created_at:
                          type: integer
                          description: Timestamp UNIX UTC of message creation
                        delivered_at:
                          type: integer
                          nullable: true
                          description: Timestamp UNIX UTC of message delivery
                        read_at:
                          type: integer
                          nullable: true
                          description: Timestamp UNIX UTC of message reading
                        extra:
                          type: object
                          nullable: true
                          description: Additional information of the message
              example:
                - type: MESSAGE
                  message:
                    type: TEXT
                    sender: USER
                    text: Hi
                    file_url: null
                    created_at: 1653341789
                    delivered_at: null
                    read_at: null
                    extra: null
                - type: MESSAGE
                  message:
                    type: TEXT
                    sender: AI
                    text: I need help
                    file_url: null
                    created_at: 1653341803
                    delivered_at: 1653341804
                    read_at: 1653342120
                    extra: null
        '401':
          description: Unauthorized. Invalid or missing API Key.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error code
                  message:
                    type: string
                    description: Error description
        '404':
          description: Session not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error code
                  message:
                    type: string
                    description: Error description

````