Skip to main content

Exporting Chats

Gravity Rail lets you export chat data in two ways:

  • Single chat — download one conversation as a JSONL file (full transcript with messages, metadata, and tool calls)
  • Bulk export — download all chats (or a filtered subset) as a CSV file

Both export types are useful for compliance, legal hold, records management, and offline analysis.

PHI notice: Exported files may contain Protected Health Information. Handle and store them according to your organization's data handling policies. Do not share export files through unprotected channels.

Permissions

ActionWho can do it
Export your own chatAny member
Export another member's chatMembers with the chats:admin scope
Bulk export (CSV)Members with the chats:read scope

If you cannot see the export option, ask your workspace admin to check your role permissions.

Exporting a Single Chat (JSONL)

A single-chat export contains the full conversation — chat metadata followed by every message in chronological order. Each line of the file is a self-contained JSON object (JSONL / newline-delimited JSON).

From the UI

  1. Go to Chats and open the chat you want to export.
  2. In the chat header, click the ⋯ menu (three dots / actions menu).
  3. Select Export.
  4. The browser downloads a .jsonl file named after the chat title and timestamp.

Via the API

GET /api/v2/w/{workspace_id}/chats/{chat_id}/export?format=jsonl

The response is an application/x-ndjson stream with a Content-Disposition: attachment header.

JSONL file format

The first line is the chat record:

{"type": "chat", "id": 123, "title": "Support enquiry", "channel": "sms", "chat_type": "assignment", "created_at": "2026-01-15T10:00:00", "archived": false, "is_test": false}

Each subsequent line is a message:

{"type": "message", "id": 456, "message_id": "msg-abc123", "role": "user", "content": "Hello, I need help.", "channel": "sms", "received_at": "2026-01-15T10:00:05"}
{"type": "message", "id": 457, "message_id": "msg-def456", "role": "assistant", "content": "Hi! How can I help you today?", "channel": "sms", "received_at": "2026-01-15T10:00:08", "model": "claude-sonnet-4-6"}

Optional fields (model, call_id, tool_calls, reasoning_content) appear only when they have values.

Bulk-Exporting Chats (CSV)

The bulk export downloads all chats that match the filters currently applied to the Chats table.

From the UI

  1. Go to Chats.
  2. Apply any filters you want (channel, date range, workflow, labels, etc.).
  3. Click the Export button in the Chats table toolbar.
  4. The browser downloads a .csv file.

The CSV includes chat metadata and participant information. Message content is not included in the CSV — use single-chat JSONL export when you need full transcripts.

Via the API

GET /api/v2/w/{workspace_id}/chats/export

Supports all the same query parameters as the chat list endpoint (sortBy, sortOrder, mine, archived, channel, chatType, memberId, search, filters, isTest).

  • Chats — Managing conversations
  • Filters — Save and reuse filter combinations for repeatable exports
  • Generating Summaries — Create AI-powered summaries before exporting