Create Logistics Request
Create Logistics Request
Calculate CO2e emissions for a logistics shipment
POST
Create Logistics Request
Create Logistics Request
Calculate CO2 equivalent (CO2e) emissions for a freight shipment with flexible parameters for origin/destination or direct distance input.New API: This endpoint is part of the new API architecture with improved design and maintainability.
Request
Headers
string
required
Your API key for authenticationExample:
sk_live_1234567890abcdefstring
required
Your organization UUIDExample:
a8315ef3-dd50-43f8-b7ce-d839e68d51faBody Parameters
string
Origin location of the shipment. Can be either:
- Address string: City and country (e.g.,
"Madrid, Spain") - Hub Name: Name of a logistics hub registered in your organization
distance_km is not provided.Examples:- Address:
"Madrid, Spain" - Hub Name:
"Madrid Distribution Center"
string
Destination location of the shipment. Can be either:
- Address string: City and country (e.g.,
"Barcelona, Spain") - Hub Name: Name of a logistics hub registered in your organization
distance_km is not provided.Examples:- Address:
"Barcelona, Spain" - Hub Name:
"Barcelona Warehouse"
Hub Name Resolution: When you provide a hub name as
origin or destination, the system will:- Look up the hub by name in your organization’s registered hubs
- Validate that the hub is active and belongs to your organization
- Use the hub’s registered address for distance calculation
number
Distance in kilometers between origin and destination. If provided, takes priority over
origin and destination.Example: 500number
Load of the shipment. If not provided, it will be calculated from the TOC or category.Example:
1000string
Unit of the load.Available values:
kg, ton, pallets, teu, feuDefault: kgnumber
Factor to divide the load by (between 0 and 1). Example: 100 pallets with 0.5 factor is 50 pallets.Default:
1.0string
Type of vehicle to use for calculation. If omitted, it will be estimated from the
category provided.Example: "van_diesel"string
Category of the vehicle. Required if
toc is not provided.Available values: road, rail, maritime, airExample: "road"string
Country ISO 3166-1 alpha-2 code of the origin to use the region’s emission factors. If not provided, global factors will be used.Default:
GLOExample: ESinteger
Year of the emission factor to use. If not provided, current year will be used.Example:
2024boolean
If cleaning has been done, it will increase the emissions.Default:
falseTraceability Parameters
These optional parameters allow you to track shipments with full traceability for logistics providers.string
Unique identifier for the shipment movement, used for tracking and deduplication.Example:
"MOV-2024-001234"string
Client or customer identifier for the shipment.Example:
"CORREOS-EXPRESS"date
Date of the shipment (ISO 8601 format). If not provided, current date will be used.Example:
"2024-11-25"string
Stretch or segment of the movement (e.g., first mile, last mile).Example:
"last_mile"string
Stage of the movement in the logistics chain.Example:
"delivery"string
License plate of the vehicle used for the shipment.Example:
"1234-ABC"string
License plate of the trailer, if applicable.Example:
"5678-XYZ"boolean
Whether the shipment is handled by a subcontractor.Default:
truenumber
Tonne-kilometers (load in tonnes multiplied by distance in km). If provided, used directly for calculations instead of computing from load and distance.Example:
500.0string
Identifier of the logistics hub associated with this shipment. This parameter serves two main purposes:
- Emissions allocation: Identifies that a specific load for a client was stored in a hub, allowing the system to assign the corresponding hub storage emissions.
- Origin substitution: When the hub address is registered in the system, it will be automatically used as the origin point for the leg, replacing the specified origin.
"HUB-MAD-001"Hub Integration: When you provide a
hub_id, the system automatically handles two things: it attributes the appropriate storage emissions from that hub to your shipment, and if the hub has a registered address, it overrides the leg’s origin with the hub’s location. This ensures accurate emission tracking for warehouse and cross-docking operations.Package Parameters (Multi-leg Shipments)
These parameters enable tracking of packages that travel through multiple legs.string
Unique identifier for the package. When provided, this leg will be associated with the package. Requires
movement_id to group packages into shipments.Example: "26830007899150601093463"Package Tracking: When you provide
package_key, the system automatically creates or finds the package and associates this leg with it. Multiple legs with the same package_key will be grouped together, and the package’s total distance and emissions will be aggregated.Response
string
Unique identifier for the logistics request
number
Total CO2 equivalent emissions in kilograms
datetime
Timestamp when the request was created
datetime | null
Timestamp when the request was last updated
string
Shipment origin address. If a hub name was provided in the request, this will contain the resolved hub address.
string
Shipment destination address. If a hub name was provided in the request, this will contain the resolved hub address.
number
Distance in kilometers (if provided or calculated)
number
Transported load
string
Load unit of measurement
string
Vehicle category used
string
Type of vehicle (if provided)
string
Origin country code
integer
Year used for emission factors
string
Unique identifier for the shipment movement
string
Client or customer identifier
date
Date of the shipment
string
Stretch or segment of the movement
string
Stage of the movement in the logistics chain
string
License plate of the vehicle
string
License plate of the trailer
boolean
Whether handled by a subcontractor
number
Tonne-kilometers calculated or provided
string
Logistics hub identifier
string
UUID of the associated package (if
package_key was provided)string
Package identifier (if provided in request)
Example
Successful Response
Common Errors
401 Unauthorized
Cause: Missing or invalid API key404 Not Found
Cause: Organization not foundx-organization-id header contains a valid organization UUID.
422 Validation Error
Cause: Missing required parameters or invalid valuestoc or category is provided. If using addresses, provide both origin and destination, or use distance_km instead.
404 Hub Not Found
Cause: A hub name was provided as origin/destination, but the hub is not active or doesn’t belong to your organization- The hub name is correct and exists in your organization
- The hub status is
active(notinactive,error, orarchived)
400 Hub Has No Address
Cause: A hub name was provided as origin/destination, but the hub doesn’t have an address configuredUse Cases
Calculate Emissions with Addresses
Most common use case - let the API calculate distance from addresses:Using Hub Names for Origin/Destination
If you have logistics hubs registered in your organization, you can use their names instead of addresses:Using Known Distance
If you already know the distance, skip geocoding:Comparing Transport Modes
Compare emissions across different transport categories:Logistics Provider Integration (Full Traceability)
For logistics providers like courier companies that need complete shipment tracking:Bulk Shipment Processing
For high-volume scenarios (hundreds to thousands of shipments), use the dedicated bulk endpoint:Create Logistics Requests (Bulk)
Process up to 5,000 records per request with optimized performance, caching, and partial error handling.
Single Package Tracking
Track a single package with one leg (simplest case):Multiple Packages in One Shipment
Track multiple packages belonging to the same shipment. Each package has its ownpackage_key but shares the same movement_id:
Multi-leg Package Tracking
Track a package through multiple legs of its journey. Each leg is created separately, and the system automatically aggregates emissions per package:Migration from Legacy API
If you’re migrating from the legacy/api/v1/logistics/shipment endpoint:
URL Change
Old:
/api/v1/logistics/shipmentNew: /v1/logistics/requestsHeaders Update
Removed:
x-user-id (not needed)Keep: Authorization, x-organization-idResponse Changes
Added:
id field for trackingAdded: created_at, updated_at timestampsField Names
Most field names remain the sameCheck validation rules for
category vs tocRelated Endpoints
Create Requests (Bulk)
Process up to 5,000 shipments in a single request
Get Logistics Requests
Retrieve all logistics requests (legs) with pagination
Get Packages
Retrieve all packages with aggregated emissions
Get Package by ID
Get a package with all its legs
Get Available Vehicle Types
Retrieve all available TOCs
Authentication Guide
Learn how to get your API key