DeveloperRegister an app
Menu

Create a mileage entry

POST /mileage

Requires the mileage:write scope and an Idempotency-Key header. Registers one trip for an employee. The trip waits for the company's owner to approve it; nothing is booked and nothing is paid until then. No addresses or vehicle are accepted.

Authentication

Requires a bearer access token with the mileage:write scope.

Idempotency

Send an Idempotency-Key header with every request. See Idempotency. The sample generates one with uuidgen.

Body

JSON. A field that is not listed is refused.

NameRequiredDescription
employee_refYesThe employee, as returned by the shifts or mileage reads.
dateYesThe day of the trip, YYYY-MM-DD. Not later than tomorrow and not older than 13 months.
distance_kmYesDistance in km, above 0 and at most 1000.
purposeYesWhy the trip was made, 1 to 120 characters.

Errors

See Errors for the full list of status codes this endpoint can return.

Samples

curl
curl -X POST "https://app.sparro.dk/api/v2/mileage" \
  -H "Authorization: Bearer $SPARRO_ACCESS_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"employee_ref":"emp_Qm9hcmRFeGFtcGxlUmVmZXJlbmNlS2V5Rm9yRG9jc09","date":"2026-10-30","distance_km":42.5,"purpose":"Customer visit"}'