Skip to main content

Download API

Soltix supports async bulk data download in CSV or JSON format. Downloads are processed in the background, allowing clients to poll for status and download completed files.

Endpoints

MethodPathDescription
POST/v1/databases/:db/collections/:col/downloadCreate download request
GET/v1/download/status/:request_idCheck download status
GET/v1/download/file/:request_idDownload completed file

Create Download Request

curl -X POST http://localhost:5555/v1/databases/mydb/collections/sensors/download \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-d '{
"start_time": "2026-01-01T00:00:00Z",
"end_time": "2026-01-31T23:59:59Z",
"device_id": ["sensor-001", "sensor-002"],
"fields": ["temperature", "humidity"],
"format": "csv"
}'

Request Parameters

FieldTypeRequiredDescription
start_timestringYesRFC3339 timestamp
end_timestringYesRFC3339 timestamp
device_idstring[]YesDevice IDs
fieldsstring[]NoField filter (empty = all fields)
intervalstringNoAggregation: 1m, 5m, 1h, 1d, 1mo, 1y
aggregationstringNosum, avg, min, max, count (default: sum)
downsamplingstringNonone, auto, lttb, minmax, avg, m4
formatstringNocsv (default) or json
filenamestringNoCustom filename

No time range limits — async processing handles arbitrarily large datasets.

Response

{
"request_id": "abc123-def456",
"status": "pending",
"message": "Download request created",
"expires_at": "2026-02-01T00:00:00Z"
}

Check Status

curl http://localhost:5555/v1/download/status/abc123-def456 \
-H "X-API-Key: your-api-key"

Response

{
"request_id": "abc123-def456",
"status": "completed",
"progress": 100,
"total_rows": 86400,
"file_size": 2048576,
"filename": "mydb_sensors_20260101_20260131.csv",
"download_url": "/v1/download/file/abc123-def456",
"created_at": "2026-01-31T12:00:00Z",
"completed_at": "2026-01-31T12:00:30Z"
}

Status Values

StatusDescription
pendingRequest queued, not yet processing
processingCurrently generating the file
completedFile ready for download
failedError occurred during processing
expiredFile expired and was removed

Download File

curl -o data.csv \
http://localhost:5555/v1/download/file/abc123-def456 \
-H "X-API-Key: your-api-key"

The file is streamed with Transfer-Encoding: chunked, so clients can process data as it arrives.

Auto-Generated Filenames

If no custom filename is specified, the format is:

{database}_{collection}_{start_date}_{end_date}.{format}

Example: mydb_sensors_20260101_20260131.csv