Create Business Travel
Create a new business travel record in your organization. The system will automatically calculate CO2e emissions based on the transport type and distance.
Distance Options: You can provide either distance_km directly OR provide origin and destination addresses to have the distance calculated automatically.
Request
Bearer token for authenticationExample: Bearer sk_live_1234567890abcdef
Your organization UUIDExample: a8315ef3-dd50-43f8-b7ce-d839e68d51fa
Body Parameters
Date of the business travelFormat: YYYY-MM-DDExample: "2024-12-01"
Mode of transportAvailable values: car, metro, train, trolleybus, bus, motorbike, aircraft, ferry
Distance traveled in kilometers (required if origin/destination not provided)Constraints: Must be positiveExample: 350.5
Starting location address (required if distance_km not provided)Example: "Madrid, Spain"
Ending location address (required if distance_km not provided)Example: "Barcelona, Spain"
Number of travelersConstraints: 1 to 1000Example: 2
Whether this is a round tripExample: true
Vehicle size (only for car or motorbike)Available values: small, medium, large, average
Fuel type (only for car or motorbike)Available values: petrol, diesel, cng, lpg, unknown, plug_in_hybrid_electric, battery_electric
Flight type (only for aircraft)Available values: domestic, short_haul_international, long_haul_international
Cabin class (only for aircraft)Available values: economy, premium_economy, business, first, average
Response
Returns the created business travel object with calculated emissions.
Unique identifier (UUID) for the new record
Date of the business travel
Distance traveled in kilometers (calculated if origin/destination provided)
Starting location address
Whether this is a round trip
Initial status (usually pending until emissions are calculated)
Calculated CO2 equivalent emissions in kg
Timestamp when the record was created
Examples
Train Travel with Direct Distance
curl -X POST "https://api.dcycle.io/v1/business-travels" \
-H "Authorization: Bearer ${DCYCLE_API_KEY}" \
-H "x-organization-id: ${DCYCLE_ORG_ID}" \
-H "Content-Type: application/json" \
-d '{
"travel_date": "2024-12-01",
"transport_type": "train",
"distance_km": 621.5,
"travel_number": 2,
"round_trip": false
}'
Flight with Origin/Destination (Auto-Calculate Distance)
curl -X POST "https://api.dcycle.io/v1/business-travels" \
-H "Authorization: Bearer ${DCYCLE_API_KEY}" \
-H "x-organization-id: ${DCYCLE_ORG_ID}" \
-H "Content-Type: application/json" \
-d '{
"travel_date": "2024-12-05",
"transport_type": "aircraft",
"origin": "Madrid, Spain",
"destination": "London, UK",
"flight_type": "short_haul_international",
"cabin_class": "economy",
"round_trip": true
}'
Car Travel with Vehicle Details
curl -X POST "https://api.dcycle.io/v1/business-travels" \
-H "Authorization: Bearer ${DCYCLE_API_KEY}" \
-H "x-organization-id: ${DCYCLE_ORG_ID}" \
-H "Content-Type: application/json" \
-d '{
"travel_date": "2024-12-10",
"transport_type": "car",
"origin": "Madrid, Spain",
"destination": "Valencia, Spain",
"vehicle_size": "medium",
"fuel_type": "diesel",
"travel_number": 3
}'
Successful Response
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"travel_date": "2024-12-01",
"transport_type": "train",
"distance_km": 621.5,
"origin": null,
"destination": null,
"travel_number": 2,
"round_trip": false,
"vehicle_size": null,
"fuel_type": null,
"flight_type": null,
"cabin_class": null,
"status": "pending",
"co2e": 0,
"created_at": "2024-12-01T10:30:00Z",
"updated_at": "2024-12-01T10:30:00Z"
}
The co2e value may initially be 0 with status pending. The emissions calculation happens asynchronously and the value will be updated shortly. Use the Get Business Travel endpoint to check the updated value.
Common Errors
401 Unauthorized
Cause: Missing or invalid API key
{
"detail": "Invalid API key",
"code": "INVALID_API_KEY"
}
403 Forbidden - Limit Reached
Cause: Organization has reached maximum business travel records
{
"detail": "Business travel limit reached for this organization",
"code": "LIMIT_REACHED"
}
Solution: Contact support to increase your organization’s limit or delete unused records.
Cause: Must provide either distance_km OR origin+destination
{
"detail": [
{
"loc": ["body"],
"msg": "You must provide either distance_km or both origin and destination",
"type": "value_error"
}
]
}
422 Validation Error - Invalid Travel Mode
Cause: Transport type not valid for the route (e.g., train across an ocean)
{
"detail": "Invalid travel mode between the specified places",
"code": "VALIDATION_ERROR"
}
Solution: Choose a valid transport type for the origin/destination pair, or provide distance_km directly.
Validation Rules
- Distance Input: Provide either
distance_km OR both origin and destination, not both
- Travel Number: Must be between 1 and 1000
- Vehicle Details:
vehicle_size and fuel_type only apply to car or motorbike
- Flight Details:
flight_type and cabin_class only apply to aircraft