---
updatedAt: 2026-02-08T21:17:53.000Z
agentTools:
  projectIndex: https://docs.d-id.com/llms.txt
---

# Chat Exports

Export your agent's conversation history

Export all conversations between your agent and users. Get a downloadable ZIP file with JSON chat logs for analytics and insights.

<CoolSteps name="chat-exports-quickstart">
  <CoolStep number={1} title="Create an export request">
    Request an export of chat history for a specific agent and time range.

    ```yaml Request
    curl -X POST "https://api.d-id.com/agents/chats/exports" \
      -H "Authorization: Basic <YOUR KEY>" \
      -H "Content-Type: application/json" \
      -d '{
        "agent_id": "agt_abc123",
        "from": "2024-01-01T00:00:00Z",
        "to": "2024-01-31T23:59:59Z"
      }'
    ```

    ```json Response
    {
      "export_id": "exp_xyz789"
    }
    ```

    Save the `export_id` — you'll use it to check status and download the file. Omit `from` and `to` to export the full chat history.
  </CoolStep>

  <CoolStep number={2} title="Check export status">
    Poll the GET endpoint until the export is ready. Large exports may take a few minutes.

    ```yaml Request
    curl -X GET "https://api.d-id.com/agents/chats/exports/exp_xyz789" \
      -H "Authorization: Basic <YOUR KEY>"
    ```

    ```json Response
    {
      "export_id": "exp_xyz789",
      "agent_id": "agt_abc123",
      "status": "done",
      "total_files_count": 134,
      "result": {
        "result_url": "https://result.d-id.com/.../chats.zip"
      },
      "expires": 1705708800
    }
    ```

    Poll until `status` is `done`. The `result_url` contains the downloadable ZIP file.
  </CoolStep>

  <CoolStep number={3} title="Download and analyze">
    Download the ZIP file containing JSON chat logs.

    ```curl
    curl -O "https://result.d-id.com/.../chats.zip"
    ```

    ```json Chat file format
    {
      "chatId": "cht_abc123",
      "agentId": "agt_abc123",
      "messages": [
        {
          "role": "assistant",
          "content": "Hello! How can I help you today?",
          "created_at": "2024-01-15T10:30:00.000Z"
        },
        {
          "role": "user",
          "content": "What are your business hours?",
          "created_at": "2024-01-15T10:30:15.000Z"
        },
        {
          "role": "assistant",
          "content": "We're open Monday to Friday, 9 AM to 5 PM.",
          "created_at": "2024-01-15T10:30:18.000Z"
        }
      ]
    }
    ```

    Each chat session is saved as a separate JSON file. The export URL expires after 7 days.
  </CoolStep>
</CoolSteps>