Skip to main content
POST
← Vehicles API Create one or many vehicles of your fleet. A vehicle is master data: creating it calculates nothing (its emissions come from its consumptions), so the request is synchronous: it answers 201 Created with every vehicle, in the order you sent them, ready to take consumptions.
Beta. Part of the bulk ingest API, currently in beta. The contract may still change before general availability.

How it works

  1. Every record is checked, with the rules of the Data Importer: the vehicle class and its fuels exist and the fuels are ones that class can run on, the country is known and the plate is free. If any record is invalid the whole request is rejected with 422 and nothing is created; the answer lists every invalid record.
  2. Every vehicle is created in one transaction and returned, in the order sent. source_row_index is the position of the record in records, and client_row_id echoes yours.
  3. The vehicles belong to the x-organization-id organization. A record cannot name another one: send each organization’s vehicles with its own x-organization-id.

Request

Headers

string
required
Your API key (see Authentication).
string
required
The organization the vehicles belong to.
string
required
1 to 255 characters, unique per batch. A retry with the same key and body answers the same vehicles (with Idempotent-Replayed: true) instead of creating them again; the same key with another body is 422 IDEMPOTENCY_KEY_REUSED, and while the first request is still being processed 409 IDEMPOTENCY_KEY_IN_PROGRESS.

Query Parameters

boolean
default:"false"
Check only: the same 422 for invalid records, nothing created; 200 with {"dry_run": true, "submitted": n, "valid": n} when every record is valid.

Body Parameters

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

Response

201 Created with items: one per record, in the order sent, each with source_row_index, client_row_id and the created vehicle: id, organization_id, license_plate, name, type, ownership, country, unknown_vehicle_id, vehicle_fuel_ids (primary first), registration_year, market_segment, size, status (active) and UTC timestamps ending in Z. Its emissions come with its consumptions: there is no co2e here.

Errors

Problem details. Per-record codes in errors[].error_code: 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 1,000, no Idempotency-Key), 422 IDEMPOTENCY_KEY_REUSED, 409 IDEMPOTENCY_KEY_IN_PROGRESS, and 429 beyond the rate limits.

Retries and idempotency

  • Network error or timeout: retry with the same Idempotency-Key and body. If the first request was accepted you get the same vehicles back, with Idempotent-Replayed: true, and nothing is duplicated.
  • 422 BULK_RECORDS_REJECTED: nothing was created. Fix the records and send the batch again.

Limits

Delete Vehicles (v2)

Delete up to 1,000 vehicles with their consumptions

List Unknown Vehicles

Ids for unknown_vehicle_id

List Vehicle Fuels

Ids for vehicle_fuel_ids

Vehicle Consumptions

What the vehicles’ emissions come from