segments_export
Starts a background job that writes the segment's leads to a file in the workspace Files (workspaces_files_list). Rows, columns and order are the same as the lead table for the given filter + view + status: columns and sort come from the view (default columns when omitted), the filter narrows rows, and ARCHIVED leads are excluded unless status says otherwise. Returns {task_sqid, job_url}; poll jobs_get until COMPLETED, then result.file_sqid is the file to fetch with files_download.
Method: POST /api/v1/workspaces/{workspace_sqid}/segments/{sqid}/export/
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"sqid": "<sqid>"
},
"name": "segments_export"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sqid | Yes | ||
| view | No | ViewConfig sqid giving the columns and sort order. | |
| filter | No | FilterConfig sqid narrowing the exported rows. | |
| format | No | `xlsx` (Excel, default) or `csv`. * `xlsx` - xlsx * `csv` - csv | xlsx |
| status | No | Empty = all but ARCHIVED (default), a status value = only that status, `__all__` = every status. | |
| filename | No | File name; defaults to `YYYY-MM-DD_<segment-name>.<format>`. The extension is forced to match `format`. |