Skip to content

Exports

Exports are async: you enqueue a request, then poll its status until the file is ready. Export requests and files are kept for 10 days, then deleted by the daily cleanOldExports cron. (See the retention table — the single source of truth.)

Public API (API key)

Enqueue an export for a patient linked to the key:

Terminal window
curl -X POST "https://api.levelcast.org/api/v1/public/exports" \
-H "Content-Type: application/json" \
-H "X-API-KEY: lc_your_key_here" \
-d '{
"patientId": "PATIENT_ID",
"format": "csv",
"rangeStart": "2026-09-01T00:00:00.000Z",
"rangeEnd": "2026-10-01T00:00:00.000Z"
}'
# → 201 { "success": true, "data": { "id": "…" } }

Track it (paginated, max 100 per page):

Terminal window
curl "https://api.levelcast.org/api/v1/public/exports?page=1&limit=50" \
-H "X-API-KEY: lc_your_key_here"

format is csv, json or xml. Statuses: pending → processing → completed (or failed/expired).

Enqueueing requires the write scope; polling requires read.

Dashboard

The dashboard adds ExportPage.vue (format wizard with size estimates, streaming above ~50MB), XLSX via exceljs, and clinical PDF reports via Gotenberg (patient-report.astro, sections such as advanced_stats, medication). History rows (EXP-…) poll every 5s. These use the session-authenticated routes (/api/v1/exports), not the public ones.

Limits

Exports are not rate-limited by plan, but large exports auto-stream. Retention is 10 days regardless of plan.