Skip to main content

Fuel: transactions, summary, vehicles

7 operations at https://api.zaitrack.app. Request and response bodies are JSON with camelCase keys; ids are UUIDs; times are RFC 3339 in UTC.

Every operation needs an API key, a personal access token or an OAuth access token unless it says otherwise. An Idempotency-Key is replayed for 24 hours; see Idempotency. Errors are application/problem+json; see Errors.

Get a fuel transaction​

GET /v1/fuel/transactions/{id}

  • Scope: fuel:read or fuel:*
  • Rate class: read (100 per second and 360,000 per hour)
  • Idempotency-Key: not used
  • Audited: no
  • Step-up MFA: no

Path parameters: id.

Request​

No body.

Response​

200: fields the handler writes, taken from its source.

FieldTypeNotes
id—
externalId—
source—
cardId—
vehicleId—
driverId—
stationName—
station—
purchasedAtstring
product—
litres—
totalCents—
currency—
unitPriceCents—
odometerKm—
status—
findings—
vehicleDistanceM—
distanceSincePrevKm—
l100km—
checkedAt—
reviewedBy—
reviewNote—
reviewedAt—
createdAtstring
version—

Example​

curl "https://api.zaitrack.app/v1/fuel/transactions/$ID" \
-H "Authorization: Bearer zk_test_…"

Correct a fuel transaction​

PATCH /v1/fuel/transactions/{id}

  • Scope: fuel:write or fuel:*
  • Rate class: write (50 per second and 36,000 per hour)
  • Idempotency-Key: not used
  • Audited: medium risk
  • Step-up MFA: no
  • If-Match: the version you read; a stale one is refused (412 or 409)

Path parameters: id.

Request​

Fields the handler reads, taken from its source.

FieldTypeNotes
vehicleIdstringoptional
driverIdstringoptional
odometerKmnumberoptional
stationNamestringoptional
productstringoptional
purchasedAtstring (date-time)optional
litresnumberoptional
totalCentsintegeroptional
currencystringoptional
stationLatnumberoptional
stationLonnumberoptional

Response​

200: fields the handler writes, taken from its source.

The same fields as the response of Get a fuel transaction.

Example​

Every field is sent with a placeholder value: replace them with yours.

curl -X PATCH "https://api.zaitrack.app/v1/fuel/transactions/$ID" \
-H "Authorization: Bearer zk_test_…" \
-H 'If-Match: "3"' \
-H "Content-Type: application/json" \
-d '{"vehicleId": "…", "driverId": "…"}'

Approve a flagged transaction​

POST /v1/fuel/transactions/{id}:approve

  • Scope: fuel:write or fuel:*
  • Rate class: write (50 per second and 36,000 per hour)
  • Idempotency-Key: optional
  • Audited: low risk
  • Step-up MFA: no
  • If-Match: the version you read; a stale one is refused (412 or 409)

Path parameters: id.

Request​

Fields the handler reads, taken from its source. One handler serves several actions here, so a field may not apply to this one.

FieldTypeNotes
notestring
reasonstring

Response​

200: fields the handler writes, taken from its source.

The same fields as the response of Get a fuel transaction.

Example​

Every field is sent with a placeholder value: replace them with yours.

curl -X POST "https://api.zaitrack.app/v1/fuel/transactions/$ID:approve" \
-H "Authorization: Bearer zk_test_…" \
-H 'If-Match: "3"' \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"note": "…", "reason": "…"}'

Reject a flagged transaction​

POST /v1/fuel/transactions/{id}:reject

  • Scope: fuel:write or fuel:*
  • Rate class: write (50 per second and 36,000 per hour)
  • Idempotency-Key: optional
  • Audited: low risk
  • Step-up MFA: no
  • If-Match: the version you read; a stale one is refused (412 or 409)

Path parameters: id.

Request​

Fields the handler reads, taken from its source. One handler serves several actions here, so a field may not apply to this one.

The same fields as the request of Approve a flagged transaction.

Response​

200: fields the handler writes, taken from its source.

The same fields as the response of Get a fuel transaction.

Example​

Every field is sent with a placeholder value: replace them with yours.

curl -X POST "https://api.zaitrack.app/v1/fuel/transactions/$ID:reject" \
-H "Authorization: Bearer zk_test_…" \
-H 'If-Match: "3"' \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"note": "…", "reason": "…"}'

Void a transaction​

POST /v1/fuel/transactions/{id}:void

  • Scope: fuel:write or fuel:*
  • Rate class: write (50 per second and 36,000 per hour)
  • Idempotency-Key: optional
  • Audited: medium risk
  • Step-up MFA: no
  • If-Match: the version you read; a stale one is refused (412 or 409)

Path parameters: id.

Request​

Fields the handler reads, taken from its source. One handler serves several actions here, so a field may not apply to this one.

The same fields as the request of Approve a flagged transaction.

Response​

200: fields the handler writes, taken from its source.

The same fields as the response of Get a fuel transaction.

Example​

Every field is sent with a placeholder value: replace them with yours.

curl -X POST "https://api.zaitrack.app/v1/fuel/transactions/$ID:void" \
-H "Authorization: Bearer zk_test_…" \
-H 'If-Match: "3"' \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"note": "…", "reason": "…"}'

Fuel spend and volume over a period​

GET /v1/fuel/summary

  • Scope: fuel:read or fuel:*
  • Rate class: read (100 per second and 360,000 per hour)
  • Idempotency-Key: not used
  • Audited: no
  • Step-up MFA: no
Query parameterTypeNotes
fromstring
tostring

Request​

No body.

Response​

200: fields the handler writes, taken from its source.

FieldTypeNotes
fromstring
tostring
itemsarray of object
items[].vehicleId—
items[].fills—
items[].litres—
items[].spendCents—
items[].flagged—
items[].avgL100km—

Example​

curl "https://api.zaitrack.app/v1/fuel/summary" \
-H "Authorization: Bearer zk_test_…"

A vehicle's fuel profile​

GET /v1/fuel/vehicles/{vehicleId}/profile

  • Scope: fuel:read or fuel:*
  • Rate class: read (100 per second and 360,000 per hour)
  • Idempotency-Key: not used
  • Audited: no
  • Step-up MFA: no

Path parameters: vehicleId.

Request​

No body.

Response​

200: fields the handler writes, taken from its source.

FieldTypeNotes
vehicleId—
productstring
tankLitresnumber
expectedL100kmnumber
updatedAtstring

Example​

curl "https://api.zaitrack.app/v1/fuel/vehicles/$VEHICLE_ID/profile" \
-H "Authorization: Bearer zk_test_…"