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

# Get History

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

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` — Validation Error
- `500` — Internal Server Error

---

[API](https://skmtc.net/mixpeek/apis/mixpeek-api.md) · [All operations](https://skmtc.net/mixpeek/apis/mixpeek-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/mixpeek/mixpeek-api/revisions/40af5e67ba94/schema)
