Event export
Export a project's raw events for a period as gzipped JSON-lines files, one per day, to load them into your data warehouse or keep your own copy. Exports run in the background; you follow their progress and download each file through a short-lived signed link.
On Cohorly Cloud, requesting an export and asking for a download link need a
plan that includes event export (a self-hosted server has every feature).
Without it they answer 403 with code: "plan_feature_required" and
feature: "exports". After a downgrade that shortens how long your data is
kept, export stays available for the 30 days before the older data is deleted.
Listing, reading and cancelling exports, and links already issued, keep working.
How it works
- Request an export of one project for a period (
fromandto, at most 366 days), optionally only some events. - The export runs in the background, one day at a time. Poll it to follow
days_done,days_totalandrows. - When it is
completed, ask for a download link for each file and fetch it. A link works for 15 minutes; ask again for a fresh one. - Files are kept for 7 days after the export completes, then deleted
(status
expired). You can delete them sooner.
An organization has at most one active export (queued or running) at
a time. There is no monthly limit.
Days are read in the project's time zone, exactly like from and to on
GET /api/events: for the same period, the number of exported
lines equals that endpoint's total minus the events marked dropped, which
GET /api/events still lists and an export leaves out. On a day when the
clock changes (daylight saving), a day file covers 23 or 25 hours.
What is exported
- Every event of the project in the period, except events marked dropped in the lexicon (their stored history included).
- Every stored property of each event, except properties marked dropped. Hidden events and properties are exported: hiding only affects the dashboard.
distinct_idis the user's canonical id: an id later linked into another user (for example with/alias) is exported as that user. The id the event was stored with is kept in$distinct_id_before_identity_fix, unless the event already carries one.- With
events, each named event and the events merged into it. A dropped event name exports nothing.
Profiles are not exported.
Line format
Each line is one event, in the shape POST /track
accepts. Lines are ordered by time. Properties the server added at
ingestion (geo, $mp_api_timestamp_ms, ...) are part of the stored event and
are exported too.
json{"event":"Purchase","properties":{"plan":"pro","amount":12,"distinct_id":"account-42","time":1772438400000,"$insert_id":"purchase-0042","$distinct_id_before_identity_fix":"anon-7"}}
| Field | Meaning |
|---|---|
event | The event name as it was stored. |
properties.distinct_id | Canonical user id. |
properties.time | Unix milliseconds. |
properties.$insert_id | The event's deduplication id. |
other properties | Stored properties, dropped ones removed. |
Files
One file per day that has events; a day without events has no file. A file
is named events-YYYY-MM-DD.jsonl.gz and is gzip compressed.
A very large day (over 64 MiB of uncompressed JSON by default) is split into
parts: events-2026-03-02.jsonl.gz, then events-2026-03-02.2.jsonl.gz,
events-2026-03-02.3.jsonl.gz, and so on. Each entry of files lists its
name, day, part, rows and compressed bytes.
Request an export
Queue an export of one project's events for a period. Owners only.
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
projectId | integer | Required | - | The project to export. |
from | string | Required | - | First day, YYYY-MM-DD. |
to | string | Required | - | Last day, YYYY-MM-DD, at most 366 days after from (both included). |
events | string[] | Optional | - | Only these events (1 to 100 names). Omit to export every event. |
400 invalid events when events is not a list of 1 to 100 non-empty
names.
bashcurl -X POST https://cohorly-service.velloalabs.com/api/exports \-H "Authorization: Bearer $API_KEY" \-H "Content-Type: application/json" \-d '{ "projectId": 1, "from": "2026-03-01", "to": "2026-03-31" }'
json{"export": {"id": 12,"project_id": 1,"status": "queued","from": "2026-03-01","to": "2026-03-31","events": null,"days_total": 31,"days_done": 0,"rows": 0,"files": [],"error": null,"created_at": 1775000000000,"started_at": null,"finished_at": null,"expires_at": null}}
Follow an export
One export: status, progress and files.
The project's 50 most recent exports, newest first, as { exports: [...] }.
status moves from queued to running to completed. An export that
fails ends failed with error set to timeout (it ran past its time
limit, or one read stayed slow after a retry) or internal; its partial
files are deleted. Request it again.
bashcurl https://cohorly-service.velloalabs.com/api/exports/12 \-H "Authorization: Bearer $API_KEY"
json{"id": 12,"project_id": 1,"status": "completed","from": "2026-03-01","to": "2026-03-31","events": null,"days_total": 31,"days_done": 31,"rows": 1843021,"files": [{ "name": "events-2026-03-01.jsonl.gz", "day": "2026-03-01", "part": 1, "rows": 60122, "bytes": 2290431 }],"error": null,"created_at": 1775000000000,"started_at": 1775000004000,"finished_at": 1775000391000,"expires_at": 1775605191000}
Download a file
A signed download link for one file of a completed export, valid 15 minutes.
The returned path is relative to the API base URL and needs no credential:
anyone holding it can download that one file until expiresAt. A tampered
or expired link answers 403 { "error": "invalid or expired link" }.
bashcurl -X POST https://cohorly-service.velloalabs.com/api/exports/12/files/events-2026-03-01.jsonl.gz/link \-H "Authorization: Bearer $API_KEY"
json{"path": "/api/exports/download/12/events-2026-03-01.jsonl.gz?expires=1775001291000&signature=4be1...","expiresAt": 1775001291000}
Cancel or delete
Cancel a queued or running export, or delete a completed export's files.
A running export stops at its next batch and its partial files are deleted
(cancelled). A completed export's files are deleted at once (expired). Deleting a
project does the same to its exports.
The response is { "export": {...} } after the change.
Automate it
A complete script: request, wait, download every file and read it with jq.
bashAPI=https://cohorly-service.velloalabs.comAUTH="Authorization: Bearer $API_KEY"ID=$(curl -s -X POST "$API/api/exports" -H "$AUTH" -H "Content-Type: application/json" \-d '{ "projectId": 1, "from": "2026-03-01", "to": "2026-03-31" }' | jq -r '.export.id')while :; doSTATUS=$(curl -s "$API/api/exports/$ID" -H "$AUTH" | jq -r '.status')echo "export $ID: $STATUS"case "$STATUS" in completed) break ;; failed|cancelled|expired) exit 1 ;; esacsleep 10donefor NAME in $(curl -s "$API/api/exports/$ID" -H "$AUTH" | jq -r '.files[].name'); doLINK=$(curl -s -X POST "$API/api/exports/$ID/files/$NAME/link" -H "$AUTH" | jq -r '.path')curl -s -o "$NAME" "$API$LINK"donegunzip -c events-2026-03-01.jsonl.gz | jq -c '{event, user: .properties.distinct_id}' | head