Export conversations

POST/v2/agents/{agentId}/conversations/export

Export the conversations of an agent as a JSON or CSV file and get back a temporary download link, optionally filtered by status, channel and dates.

Working draft. These docs are illustrative: names, endpoints and examples describe the intended behaviour and can change before launch.

Creates a file with the conversations of an agent and returns a temporary download link. Call it for backups, for analysis in a spreadsheet, or to keep a copy before you delete conversations.

Request

POST /v2/agents/{agentId}/conversations/export

Path parameters:

Name Type Required Description
agentId string Yes The ID of the agent, starting with agt_.

Body fields:

Name Type Required Description
format string No json or csv. Defaults to json.
filters object No Narrows the export. Leave it out to export every conversation of the agent.
filters.status array of strings No One or more of open, resolved and handoff.
filters.channel array of strings No One or more channels, for example widget or email.
filters.from string No Only conversations created at or after this ISO 8601 UTC time.
filters.to string No Only conversations created before this ISO 8601 UTC time.

The file holds each conversation with its messages. The filters work like the ones in Search conversations, so you can export exactly the set you found.

Example request

curl -X POST https://api.askocto.co/v2/agents/agt_8f3k2m/conversations/export \
  -H "Authorization: Bearer $OCTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "format": "csv",
    "filters": {
      "status": ["resolved"],
      "from": "2026-03-01T00:00:00Z",
      "to": "2026-04-01T00:00:00Z"
    }
  }'
const response = await fetch(
  "https://api.askocto.co/v2/agents/agt_8f3k2m/conversations/export",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.OCTO_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      format: "csv",
      filters: {
        status: ["resolved"],
        from: "2026-03-01T00:00:00Z",
        to: "2026-04-01T00:00:00Z",
      },
    }),
  },
)

const result = await response.json()
console.log(`${result.conversationCount} conversations: ${result.downloadUrl}`)

Example response

A successful call returns 200 OK.

{
  "downloadUrl": "https://cdn.askocto.co/exports/agt_8f3k2m-2026-03.csv?token=ex_7d2c91",
  "format": "csv",
  "conversationCount": 412,
  "expiresAt": "2026-04-01T10:30:00Z"
}

Response fields

Name Type Description
downloadUrl string A signed link to the file. Open it with a plain GET, no API key needed.
format string json or csv, as requested.
conversationCount integer The number of conversations in the file.
expiresAt string When the link stops working, as an ISO 8601 UTC time.

Download the file before expiresAt. After that, run the export again. Treat the link like a secret, because anyone who has it can read the file.

Exporting does not change or remove anything. If you export to keep a record before cleaning up, delete afterwards with Delete conversation, or with Delete all conversations for a user when a person asked for their data to be removed.

Errors

Status Code When
400 invalid_request format is not json or csv, a filter has an unknown value, or a date is not an ISO 8601 time.
401 unauthorized The API key is missing, malformed or deleted.
404 not_found No agent has this ID in your workspace.
429 rate_limited Too many requests. Wait for the number of seconds in the Retry-After header.

Something unclear or missing? Tell us and we will fix the page.