Export Call History CSV
Export call history records as a CSV file with optional transcript and post-analysis data.
Headers
x-workspace-idstringrequiredWorkspace identifier for the API.
Request Body
Send a JSON body, even if it is only {}. Filters behave the same as on List Call Histories, except that callIds, dateRange and postAnalysis are sent as JSON values, not strings.
includeTranscriptsbooleandefault: falseAdds a Transcript column.
includePostAnalysisbooleandefault: falseAdds one analyzed_<key> column per post-call analysis field.
includeDynamicVariablesbooleandefault: falseAdds one dynamic_<key> column per dynamic variable.
includeResponseVariablesbooleandefault: falseAdds one response_<key> column per response variable.
limitintegerMaximum number of records to export, newest first. Ignored unless it is a positive integer; without it every matching record is exported.
batchIdstringFilter by batch call ID.
agentIdstringFilter by agent ID, or by agent name.
pathwayIdstringFilter by call flow ID.
statusstringFilter by call status: completed, pending, failed or blocked.
directionstringFilter by call direction: inbound, outbound or web.
callTypestringFilter by call type: sip or web.
callIdsarrayExport only these call IDs.
searchstringFree-text search. At most 200 characters.
fromPhonestringPartial match on the caller number (digits only). At most 200 characters.
toPhonestringPartial match on the destination number (digits only). At most 200 characters.
isCallFromSmartCallbackbooleanFilter to calls that were (or were not) placed by a smart callback.
postAnalysisarrayPost-call analysis filters, same format as on List Call Histories.
dateRangeobjectFilter on call start time. Send either startDate and endDate, or start and end.
Response
The response is streamed as a CSV file with Content-Type: text/csv; charset=utf-8 and Content-Disposition: attachment. The filename is call_history.csv, or call_history_with_transcripts.csv when includeTranscripts is true.
Columns, in order: Record ID, Call ID, Room Name, Agent Name, Call Flow Name, Start Time (UTC), End Time (UTC), Duration (s), Direction, From Phone Number, To Phone Number, Status, Twilio Call SID, Batch ID, Smart Callback, Recording Link, Analyzed Data (JSON), Cost, Has Telephony Cost, Summary, With AI Duration (s), Transferring Duration (s), With Transferee Duration (s), Agent Segments (JSON). Then Transcript and the analyzed_, dynamic_ and response_ columns when requested. The variable columns are discovered from the 50 most recent matching calls.
Cost and Has Telephony Cost show N/A unless the caller's role has the billing:view permission.
Errors
| Status | Body | When |
|---|---|---|
400 | {"error": "<field> must be ..."} | search, fromPhone or toPhone is not a string, is over 200 characters, or (phone filters) has no digits |
500 | {"error": "<message>"} | Any other failure before streaming starts |
Last updated on