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
Your API key for authenticationExample:
sk_live_1234567890abcdefYour organization UUIDExample:
a8315ef3-dd50-43f8-b7ce-d839e68d51faBody Parameters
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"
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
Distance in kilometers between origin and destination. If provided, takes priority over
origin and destination.Example: 500Load of the shipment. If not provided, it will be calculated from the TOC or category.Example:
1000Unit of the load.Available values:
kg, ton, pallets, teu, feuDefault: kgFactor to divide the load by (between 0 and 1). Example: 100 pallets with 0.5 factor is 50 pallets.Default:
1.0Type of vehicle to use for calculation. If omitted, it will be estimated from the
category provided.Example: "van_diesel"Category of the vehicle. Required if
toc is not provided.Available values: road, rail, maritime, airExample: "road"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: ESYear of the emission factor to use. If not provided, current year will be used.Example:
2024If 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.Unique identifier for the shipment movement, used for tracking and deduplication.Example:
"MOV-2024-001234"Client or customer identifier for the shipment.Example:
"CORREOS-EXPRESS"Date of the shipment (ISO 8601 format). If not provided, current date will be used.Example:
"2024-11-25"Stretch or segment of the movement (e.g., first mile, last mile).Example:
"last_mile"Stage of the movement in the logistics chain.Example:
"delivery"License plate of the vehicle used for the shipment.Example:
"1234-ABC"License plate of the trailer, if applicable.Example:
"5678-XYZ"Whether the shipment is handled by a subcontractor.Default:
trueTonne-kilometers (load in tonnes multiplied by distance in km). If provided, used directly for calculations instead of computing from load and distance.Example:
500.0Identifier 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.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
Unique identifier for the logistics request
Total CO2 equivalent emissions in kilograms
Timestamp when the request was created
Timestamp when the request was last updated
Shipment origin address. If a hub name was provided in the request, this will contain the resolved hub address.
Shipment destination address. If a hub name was provided in the request, this will contain the resolved hub address.
Distance in kilometers (if provided or calculated)
Transported load
Load unit of measurement
Vehicle category used
Type of vehicle (if provided)
Origin country code
Year used for emission factors
Unique identifier for the shipment movement
Client or customer identifier
Date of the shipment
Stretch or segment of the movement
Stage of the movement in the logistics chain
License plate of the vehicle
License plate of the trailer
Whether handled by a subcontractor
Tonne-kilometers calculated or provided
Logistics hub identifier
UUID of the associated package (if
package_key was provided)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

