Skip to main content
POST
← Business Travels API Create one or many business travels (Scope 3 category 6). Say how each trip was made, when, how often and how far, or between which places; Dcycle works out the distance when you leave it out, picks the emission factor and calculates the emissions in the background. The travels are the ones /v1/business-travels reads and edits. The request checks every record and writes them all at once, then answers 202 Accepted with an ingest job that calculates them. Follow it with GET /v2/ingest-jobs/{id} or the ingest_job.finished webhook.
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. If any is invalid the whole request is rejected with 422 and nothing is written; the answer lists every invalid record, so you can fix them all at once.
  2. The travels are written at once, with status pending, in the x-organization-id organization.
  3. The job calculates them in the background, in chunks. A travel sent without distance_km gets the distance between its origin and destination for its transport (road or rail route, great-circle for a flight, sea route for a ferry), and its places are located. Then the emission factor of its transport, fuel and country is applied. Each travel ends active or error. Its job item is then failed with the reason when there is one:
    • TRANSPORT_MODE_INVALID_FOR_ROUTE: there is no route for that transport between the two places (e.g. a car between continents).
    • DISTANCE_CALCULATION_ERROR or GEOCODE_LOCATION_ERROR: a place could not be found.
    • CALCULATION_FAILED: no emission factor for the trip, or the distance provider was unavailable (send the travel again later, or with distance_km).
  4. When every chunk is done the job is completed (or completed_with_errors) and ingest_job.finished is sent to your webhook endpoints.

How a trip is counted

A record is a trip made travel_number times in its period: its emissions are those of distance_km (twice for travel_type: round) for each trip, times passenger_number. A trip over several days is one record with its start_date and end_date; recurring trips (a commute to a client) are one record with their count.

Request

Headers

string
required
Your API key (see Authentication).
string
required
The organization the travels belong to. A record cannot name another organization: send each organization’s travels with its own x-organization-id.
string
required
1 to 255 characters, unique per batch. A retry with the same key and body returns the original job (with Idempotent-Replayed: true) instead of creating the travels 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 written, no job; 200 with {"dry_run": true, "submitted": n, "valid": n} when every record is valid.

Body Parameters

array[object]
required
The business travels to create, 1 to 5,000. A field not listed here is rejected (SCHEMA_INVALID).
The file import template writes some of these values differently: car_small is transport_type: car + vehicle_size: small here, return_trip is travel_type: round, and electric_renewable / electric_not_renewable is fuel_type: electric + renewable_energy: yes / no.

Response

202 Accepted with the job (entity_type: business_travels, operation: create) and a Location header to it. To read the result:

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 Business Travels (v2)

Delete travels by id

Get Ingest Job

Follow the calculation

List Job Items

The travel id and outcome of each record

List Business Travels

The travels and their emissions