Skip to main content
POST
← Vehicles API Create one or many fuel or energy consumptions of your vehicles (scope 1 for every vehicle, owned or rented, with their upstream emissions in scope 3 category 3; see Scopes). Say which vehicle, how much, in which unit and over which period; Dcycle picks the emission factor of the vehicle’s class, fuel and country and calculates the emissions in the background. The consumptions are the ones the app shows under each vehicle. The request checks every record and writes them all at once, then answers 202 Accepted with an ingest job that calculates them (see how bulk ingestion works). Follow it with GET /v2/ingest-jobs/{id} or, for a job submitted with an API key, the ingest_job.finished webhook.
Beta. Part of the bulk ingest API, in beta. The contract may still change before general availability.

How it works

  1. Every record is checked. If any is invalid the whole request is rejected with 422 and nothing is written (all or nothing): rejected is the number of invalid records and errors lists them (up to 100), so you can fix them at once.
  2. The consumptions are written at once, with status loading. Each belongs to its vehicle’s organization: the x-organization-id organization or one under it that you can write to (its perimeter).
  3. The job calculates them in the background, in chunks. A consumption that ends success has its job item succeeded; one that ends error has it failed with CALCULATION_FAILED, e.g. when no emission factor matches the vehicle’s class, fuel and country.
  4. When every chunk is done the job is completed (or completed_with_errors) and, for a job submitted with an API key, ingest_job.finished is sent to your webhook endpoints.
Every record is a new consumption: the same record sent twice, or sent again with a new Idempotency-Key, creates two. To retry a batch, reuse its key.

Scopes

A consumption is scope 1, whatever the vehicle’s ownership. Its well-to-tank upstream emissions (scope 3, category 3) are added when a factor exists for them; a vehicle priced by a legacy custom emission factor group gets none. The factor is picked per year: a period spanning two years uses each year’s factor, and a year without an edition of the factor database uses its latest edition.

A spend in euros

A consumption in euros (unit_id d3e37f2b-0fc3-4532-82f8-3890ab56ad37) is stored in litres: the amount is divided by the pump price, taxes included, of the consumption’s fuel in the vehicle’s country, from the latest EU Weekly Oil Bulletin on or before start_date. A bulletin’s price serves the 14 days after it. The euros are kept as the consumption’s spend. The bulletin prices:
  • Fuels (the fuel of List Vehicle Fuels): gas_oil, b7 and b10 at the diesel price; gasoline, e5 and e10 at the Euro-super 95 price; lpg at the LPG price.
  • Countries (the vehicle’s country): the 27 EU member states. LPG has no price in AT, CY, DK, FI, GR, IE, MT and SE.
  • Dates: the weekly bulletins from 2020-01-06; prices are available up to the bulletin of 2026-09-28.
For any other fuel, country or date, a quantity in euros is NO_FUEL_PRICE_FOR_SPEND: send litres instead. A vehicle with its own emission factor is not converted (see A vehicle with its own emission factor).

A vehicle with its own emission factor

A vehicle priced by its own emission factor takes only that factor’s unit, as the app’s form and the file import: the unit of its record of your custom emission factor databases (the vehicle’s custom_ef_record_id; List Records gives the record’s unit_id), or else of its legacy custom emission factor group (its latest factor’s unit). Any other unit, euros included, is UNIT_NOT_ALLOWED_FOR_CUSTOM_EMISSION_FACTOR, with the accepted unit in error_params.supported: a factor per litre cannot price kilometres. A group without factors takes no unit. A quantity in euros is not turned into litres, not even for a factor per litre: send litres (or euros to a factor per euro).

Request

Headers

string
required
Your API key (see Authentication).
string
required
Your organization. Its vehicles, and those of the organizations under it that you can write to (its perimeter), can take consumptions; each consumption belongs to its vehicle’s organization.
string
required
1 to 255 characters, one per batch, looked up per organization across every v2 bulk route. Within 24 hours, the same key with the same route and body returns the original job (with Idempotent-Replayed: true) instead of creating the consumptions again; the same key with another body or on another route is 422 IDEMPOTENCY_KEY_REUSED, and while the first request is still being processed 409 IDEMPOTENCY_KEY_IN_PROGRESS. After 24 hours the key is free, and a request with it is a new one. See The Idempotency-Key.

Query Parameters

boolean
default:"false"
Check only: the same 422 for invalid records, nothing written, no job; 200 with {"dry_run": true, "submitted": n, "valid": n} when every record is valid. The Idempotency-Key header is still required, but a dry run does not check or store it. A successful dry run means the records are valid, not that every one will calculate: the emission factor is matched by the job.

Body Parameters

array[object]
required
The consumptions to create, 1 to 5,000. A field not listed here is rejected (SCHEMA_INVALID).

Response

202 Accepted with the job (entity_type: vehicle_consumptions, operation: create) and a Location header to it. GET /v2/ingest-jobs/{id}/items has one item per record, in the order sent: its entity_id is the consumption’s id (the one Delete Vehicle Consumptions (v2) takes), and a failed item carries its error_code. See following a job. In the results, a consumption’s co2e is its scope 1 plus its well-to-tank upstream (scope 3) (see List Vehicle Consumptions).
If chunks_done stops moving, see A job that does not finish: never resend the batch with a new Idempotency-Key, because its consumptions are already stored.

Errors

Problem details. Per-record codes in errors[].error_code of a 422 BULK_RECORDS_REJECTED: Request-level errors: 401 for a missing or invalid API key, 403 LOGGED_USER_NOT_MEMBER when the key’s user is not a member of the organization, 422 REQUEST_VALIDATION_FAILED for a malformed body (no records, more than 5,000, no Idempotency-Key), 422 IDEMPOTENCY_KEY_REUSED, 409 IDEMPOTENCY_KEY_IN_PROGRESS, and 429 beyond the rate limits.

Limits

Delete Vehicle Consumptions (v2)

Delete consumptions by id

Create Vehicles (v2)

The vehicles, and their ids

List Vehicle Fuels

Fuel and unit ids

Get Ingest Job

Follow the calculation

List Job Items

The consumption id and outcome of each record