Export scheduled query results
Spaces method and path for this operation:
<div><span class="operation-verb post">post</span> <span class="operation-path">/s/{space_id}/api/osquery/scheduled_results/{scheduleId}/{executionCount}/_export</span></div>Refer to Spaces for more information.
Export all result rows for a specific scheduled query execution as a downloadable file. The response is a streaming file attachment in the requested format.
Path parameters
The schedule ID of the scheduled query.
The schedule ID of the scheduled query.
The execution counter for this scheduled query run.
The execution counter for the scheduled query run whose results are exported. Must be a non-negative integer.
Query parameters
The output format for the exported file. Use ndjson for streaming newline-delimited JSON (recommended for large exports), json for a single JSON array (held in memory; suitable for smaller result sets), or csv for a comma-separated values file with a header row derived from the ECS mapping.
The output format of the exported file.
Request body
Example request
{
"agentIds": [
"980a6b73-0b03-4d1e-8915-67c202e4a980",
"e40fde1c-5729-4885-b0b2-16a42e9332e3"
],
"esFilters": [
{
"meta": {
"key": "agent.name",
"params": {
"query": "prod-host-1"
},
"type": "phrase"
},
"query": {
"match_phrase": {
"agent.name": "prod-host-1"
}
}
}
],
"kuery": "host.name: \"prod-host-1\""
}Response
A downloadable file in the requested format. The Content-Disposition header contains the suggested filename.
Example response
{
"_meta": {
"action_id": "e88d7652-fc3e-4544-b0e0-3d5df2be454c",
"execution_count": 17384,
"exported_by": "elastic",
"format": "ndjson",
"query": "SELECT * FROM users;",
"timestamp": "2026-04-30T09:12:00.000Z",
"total_results": 64
},
"results": [
{
"@timestamp": "2026-04-30T09:11:58.321Z",
"agent": {
"id": "980a6b73-0b03-4d1e-8915-67c202e4a980",
"name": "prod-host-1",
"type": "osquerybeat",
"version": "9.4.0"
},
"osquery": {
"directory": "/home/ubuntu",
"gid": "1000",
"shell": "/bin/bash",
"uid": "1000",
"username": "ubuntu"
},
"user": {
"group": {
"id": "1000"
},
"id": "1000",
"name": "ubuntu"
}
}
]
}