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

# Get chat history

> Returns stored **`messages`** for **`sessionId`**. If **`sessionId`** is empty or omitted, returns **`messages`: []** without error.



## OpenAPI

````yaml /api-reference/ageneral-chat-openapi.json get /v1/chat/history
openapi: 3.1.0
info:
  title: Chat
  version: 1.0.0
  description: >-
    **Platform chat** for the Ageneral web app: session-backed conversations
    tied to a **project**, with inference using your **project access**. **Base
    URL:** `https://ageneral.ai`.


    **Not** the inference-only host at `models.ageneral.ai` — use
    **`https://models.ageneral.ai`** instead. That host uses **API keys** only —
    no **`Ageneral-Project-Id`** or session headers.


    **Authentication:** `Authorization: Bearer <session JWT>` from Ageneral
    sign-in.


    **Project scope:** Every route requires header **`Ageneral-Project-Id`**
    with a project you can access.


    **Session:** For **`POST /v1/chat/completions`** and **`POST
    /v1/chat/responses`**, send optional **`Ageneral-Session-Id`** to continue
    an existing session; responses echo the active session id in the
    **`Ageneral-Session-Id`** response header. Omit the header to start a new
    session.
  contact:
    name: Ageneral
    url: https://ageneral.ai
servers:
  - url: https://ageneral.ai
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Chat completions
    description: >-
      OpenAI Chat Completions–compatible body; server merges history and
      defaults model.
  - name: Responses
    description: >-
      Streaming responses compatible with OpenAI **Responses**; request uses
      `model` and `messages`.
  - name: Sessions
    description: List, update metadata, and load stored messages for platform chat.
paths:
  /v1/chat/history:
    get:
      tags:
        - Sessions
      summary: Get chat history
      description: >-
        Returns stored **`messages`** for **`sessionId`**. If **`sessionId`** is
        empty or omitted, returns **`messages`: []** without error.
      operationId: getPlatformChatHistory
      parameters:
        - $ref: '#/components/parameters/AgeneralProjectId'
        - name: sessionId
          in: query
          required: false
          schema:
            type: string
          description: >-
            Platform chat session id. Omit or leave empty for an empty message
            list.
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatHistoryResponse'
        '400':
          description: Missing `Ageneral-Project-Id`.
        '401':
          description: Missing or invalid session JWT.
        '403':
          description: User cannot access this project.
        '404':
          description: '`sessionId` set but session not found for this user and project.'
      security:
        - bearerAuth: []
components:
  parameters:
    AgeneralProjectId:
      name: Ageneral-Project-Id
      in: header
      required: true
      schema:
        type: string
      description: Project id. You must be a member with access.
  schemas:
    ChatHistoryResponse:
      type: object
      required:
        - messages
      properties:
        messages:
          type: array
          items:
            $ref: '#/components/schemas/ChatHistoryMessage'
    ChatHistoryMessage:
      type: object
      properties:
        role:
          type: string
        content:
          type: string
      additionalProperties: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Session JWT from Ageneral sign-in. Send as `Authorization: Bearer
        <token>`.

````