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

# Retrieve User Chat History — POST /api/v1/get-chat

> Fetch the complete message history for a specific Botsify bot user identified by their fbId, useful for auditing sessions and live agent handoffs.

Use this endpoint to retrieve the complete message history for a specific user session in your Botsify bot. You identify the user by their `fbId`, which is the session identifier assigned when the user first interacts with your bot. This is useful for auditing conversations, replaying sessions, or surfacing context in a live agent handoff. Your bot API key can be supplied in the request body or via the `X-Api-Key` header.

## Request

**fbId** `string` *required*

The session identifier for the target user. This value is assigned by Botsify when a user first engages with your bot.

**apikey** `string`

Your bot's API key. You may alternatively supply this value in the `X-Api-Key` request header instead of the body.

## Example Request

```bash theme={null}
curl --request POST \
  --url https://app.botsify.com/api/v1/get-chat \
  --header 'Content-Type: application/json' \
  --header 'X-Api-Key: YOUR_BOT_API_KEY' \
  --data '{
    "fbId": "user-123"
  }'
```

## Response

A successful request returns a JSON array of message objects representing the full conversation history for the specified user. Each message object includes the message content, direction (inbound from the user or outbound from the bot), and a timestamp.

```json theme={null}
{
  "messages": [
    {
      "id": "msg_001",
      "text": "Hello! How can I help you?",
      "direction": "outbound",
      "created_at": "2024-01-15T09:00:00Z"
    },
    {
      "id": "msg_002",
      "text": "I need help with my order.",
      "direction": "inbound",
      "created_at": "2024-01-15T09:00:45Z"
    }
  ],
  "fbId": "user-123"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.