Get Bordereau Export Run
Reports the status of a bordereau export run started by
POST /policies/bordereau/export-runs.
Poll this until status is terminal, then fetch the file from
GET .../export-runs/{runId}/download if it succeeded — or deliver it
to Google Drive via POST .../export-runs/{runId}/drive.
Statuses
queued— the run exists and is waiting for a worker. A normal state every run passes through, not a stall: the run is recorded before the background work is dispatched.running— the export is streaming rows into its CSV.succeeded— the file is parked and downloadable.rowCountandfinishedAtare set.failed— the export stopped early.errorcarries the reason; start a new run to retry.expired— the run succeeded, but its CSV has passed the retention horizon (expiresAt) and been deleted. The run’s facts (rowCount, timestamps) remain readable; start a new export for a fresh file.
The body is fixed-size — the export request is not echoed back — so a poll costs the same however large the export is.
A run’s status stays readable for as long as the run exists: nothing removes
a run on a timer (only its FILE expires), and a run id belonging to another
company — or to an entity export run rather than a bordereau one — is a
404, exactly as an id that exists nowhere.
Required permission: company.policy:read
Authorizations
User-principal OAuth 2.0 Bearer authentication. Send a user-scoped Auth0 access token (audience = the app API audience) as Authorization: Bearer <jwt>. The request resolves to the user's identity and is authorized by their Role on the {companyId} in the path — the same role-based permissions the web app enforces. This is the path the MCP connector uses to act on a user's behalf; endpoints that accept it list both BearerAuth and ApiKeyAuth.
Path Parameters
Company identifier
The run identifier returned by POST /policies/bordereau/export-runs. Runs are scoped to their company AND
their kind: a run id belonging to another company, or to an entity
export run rather than a bordereau one, returns 404, exactly as an id
that exists nowhere does.
Response
The run's current status
An export run's current status. Fixed size: there is no echo of the export request, so a poll costs the same however large the export is.
The run identifier
queued while the run waits for a worker (a normal state, not a stall), running while it projects and streams, then the terminal succeeded or failed — and expired once a succeeded run's CSV has passed its retention horizon and been deleted
queued, running, succeeded, failed, expired Data rows written to the CSV (the header row not counted); null until the run succeeds. It stays populated on an expired run, describing the file that existed.
Why the export stopped; null unless status is failed
When the run was started
When the run last made progress or changed status
When the run reached a terminal status; null until then
When the run's CSV artifact passes its retention horizon. After this instant the run reports expired and the download answers 404 — start a new export for a fresh file.
