Skip to main content
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_1234567890abcdef
string
required
Your organization UUIDExample: a8315ef3-dd50-43f8-b7ce-d839e68d51fa

Body 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
When a hub name is provided, the system automatically resolves it to the hub’s registered address. Required if 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
When a hub name is provided, the system automatically resolves it to the hub’s registered address. Required if 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:
  1. Look up the hub by name in your organization’s registered hubs
  2. Validate that the hub is active and belongs to your organization
  3. Use the hub’s registered address for distance calculation
This is useful when you have predefined warehouse or distribution center locations. If the provided value does not match any hub name in your organization, it will be treated as a literal address string.
number
Distance in kilometers between origin and destination. If provided, takes priority over origin and destination.Example: 500
number
Load of the shipment. If not provided, it will be calculated from the TOC or category.Example: 1000
string
Unit of the load.Available values: kg, ton, pallets, teu, feuDefault: kg
number
Factor to divide the load by (between 0 and 1). Example: 100 pallets with 0.5 factor is 50 pallets.Default: 1.0
string
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: ES
integer
Year of the emission factor to use. If not provided, current year will be used.Example: 2024
boolean
If cleaning has been done, it will increase the emissions.Default: false

Traceability 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: true
number
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.0
string
Identifier of the logistics hub associated with this shipment. This parameter serves two main purposes:
  1. 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.
  2. 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.
Example: "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 key
Solution: Verify your API key is valid and active. Get a new one from Settings → API.

404 Not Found

Cause: Organization not found
Solution: Verify that the x-organization-id header contains a valid organization UUID.

422 Validation Error

Cause: Missing required parameters or invalid values
Solution: Ensure that either toc 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
Solution: Verify that:
  • The hub name is correct and exists in your organization
  • The hub status is active (not inactive, error, or archived)

400 Hub Has No Address

Cause: A hub name was provided as origin/destination, but the hub doesn’t have an address configured
Solution: Configure an address for the hub in your organization settings before using it as origin/destination.

Use 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:
You can also mix hub names with 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 own package_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/requests

Headers Update

Removed: x-user-id (not needed)Keep: Authorization, x-organization-id

Response Changes

Added: id field for trackingAdded: created_at, updated_at timestamps

Field Names

Most field names remain the sameCheck validation rules for category vs toc
Both APIs will be supported during the migration period. New integrations should use /v1/logistics/requests.

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