---
title: "Get History"
method: GET
path: "/v1/agents/sessions/{session_id}/history"
tags: ["Agent Sessions"]
---

# Get History

`GET /v1/agents/sessions/{session_id}/history`

## Request

- Base URL: `https://api.mixpeek.com`
- URL: `https://api.mixpeek.com/v1/agents/sessions/{session_id}/history`
- Auth: HTTP bearer and API key in header `X-Namespace`

Get conversation history for a session.

Returns messages in chronological order (oldest first).

Args:
    request: FastAPI request with tenant context
    session_id: Session identifier
    limit: Maximum messages to return (default: 50, max: 200)
    offset: Pagination offset (default: 0)

Returns:
    GetHistoryResponse with message history

Raises:
    NotFoundError: If session not found

Example:
    ```bash
    curl -X GET "http://localhost:8000/v1/agents/sessions/ses_abc123/history?limit=20&offset=0" \
      -H "Authorization: Bearer {api_key}" \
      -H "X-Namespace: {namespace_id}"
    ```

## Path parameters

- `session_id` string, required: Session ID

## Query parameters

- `limit` integer: Maximum messages to return
- `offset` integer: Pagination offset

## Response `200`

Successful Response

- GetHistoryResponse: Response for retrieving conversation history. Attributes: session_id: Session identifier messages: List of messages in chronological order total_messages: Total number of messages in session returned_messages: Number of messages returned (may be limited) has_more: Whether there are more messages available Example: ```python response = GetHistoryResponse( session_id="ses_abc123", messages=[...], total_messages=50, returned_messages=20, has_more=True ) ```
  - `session_id` string, required: Session identifier
  - `messages` MessageHistoryItem[], required: Message history
    - `message_id` string, required: Message identifier
    - `role` string, required: Message role
    - `content` string, required: Message content
    - `content_type` string, required: Content type
    - `tool_name` string, nullable: Tool name (if tool message)
    - `tool_inputs` string, nullable: Tool inputs (if tool call)
    - `tool_outputs` string, nullable: Tool outputs (if tool result)
    - `tool_status` string, nullable: Tool status (if tool message)
    - `timestamp` string, date-time, required: Message timestamp
  - `total_messages` integer, required: Total messages in session
  - `returned_messages` integer, required: Messages returned
  - `has_more` boolean, required: Whether more messages available

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not Found
- `422`: Unprocessable Entity
- `429`: Too Many Requests
- `500`: Internal Server Error
- `503`: Service Unavailable

## Changes

- **2026-10-09** `61a175e8eb9a`: 1 warning, 5 info
  - removed the optional property `detail` from the response with the `422` status
  - added the non-success response with the status `429`
  - added the non-success response with the status `503`
  - added the optional property `success` to the response with the `422` status
  - …2 more
- **2026-08-09** `5d4c905106b4`: 1 info
  - the endpoint scheme security `BearerAuth AND NamespaceHeader` was added to the API

[Operation history](https://skmtc.dev/mixpeek/apis/mixpeek-api/changes/v1/agents/sessions/:session_id/history/get.md)

---

[API](https://skmtc.dev/mixpeek/apis/mixpeek-api.md) - [All operations](https://skmtc.dev/mixpeek/apis/mixpeek-api/llms.txt) - [OpenAPI document](https://skmtc.dev/mixpeek/apis/mixpeek-api/revisions/790bc16455f6?raw)
