Data Export#
Dify supports exporting chat conversation logs as flat files for offline analysis, annotation pipelines, or archival. The feature was introduced in PR #30448 and is available only for chat-based app modes (Chat, Agent Chat, Advanced Chat).
API Endpoint#
GET /apps/<app_id>/chat-conversations/export
- Auth: Requires
@edit_permission_required(editor role or above) - Response: Streaming response β the server flushes records in batches of 100 to avoid loading the full dataset into memory
Query Parameters#
| Parameter | Type | Description |
|---|---|---|
format | jsonl | csv |
keyword | string | Filter by message content, conversation name, intro, or end-user session ID |
start / end | YYYY-MM-DD HH:MM | Date range filter, interpreted in the user's configured timezone |
annotation_status | annotated | not_annotated |
sort_by | created_at | -created_at |
Filtering logic mirrors the existing ChatConversationQuery used for pagination, so the export always reflects exactly what the Log UI is currently showing.
Output Formats#
Each exported record is a conversation-level snapshot β not individual messages. Fields included in both formats :
id, name, introduction, status, from_source, from_end_user_id, from_end_user_session_id, from_account_id, created_at, updated_at, message_count, annotated
JSONL (application/jsonl; charset=utf-8): one JSON object per line β easy to pipe into jq, Python, or LLM fine-tuning scripts.
CSV (text/csv; charset=utf-8-sig): BOM-prefixed UTF-8 so Excel opens it correctly; datetime fields are quoted to prevent auto-reformatting .
Note: In Advanced Chat mode, debugger conversations are excluded from export .
Frontend Integration#
The export UI is a dropdown button labeled "Export All" inside the log filter bar. Clicking it reads the current filter state (period, annotation status, keyword, sort order) and converts the selected TIME_PERIOD_MAPPING period to explicit start/end timestamps before calling the export endpoint .
The TIME_PERIOD_MAPPING object (defined in filter.tsx) maps UI period selectors (today, last 7 days, last 3 months, etc.) to day-offset values that the export handler converts to ISO timestamps.
i18n keys added: operation.exportAll, operation.exportSuccess, operation.exportFailed .
Related Files#
| File | Role |
|---|---|
api/controllers/console/app/conversation.py | Export endpoint controller; also hosts ChatConversationApi (list) and ChatConversationDetailApi |
api/services/conversation_service.py | Service layer with conversation queries used by the export generator |
web/app/components/app/log/filter.tsx | Filter bar component; contains TIME_PERIOD_MAPPING and the export dropdown |
web/service/use-log.ts | React Query hooks for chat/completion conversation list and detail APIs |