Shipping by Truck
POST /estimates/shipping-road
| Parameter | type | required | default | description |
|---|---|---|---|---|
| shipmentMass | Mass | true | Mass of the shipment. | |
| vehicleType | VehicleType | true | Type of the truck. | |
| country | String | true | Country of the shipment. | |
| fuelType | RoadFuelType | false | Fuel type of the vessel. | |
| loadCharacteristics | LoadCharacteristics | false | Load characteristics of the shipment. | |
| isTemperatureControlled | Boolean | false | false | Whether the shipment is temperature controlled. |
| distance | Distance | true send places if distance is missing | Distance of the shipment. | |
| places | [Address,Address] | true send distance if places is missing | Two addresses for the shipment. | |
| glecVersion | String | true | v2 | Version of the GLEC model to use. "v2" or "v3" |
Validation Rules
- shipmentMass.amount: Must be greater than or equal to 0. Negative weights are not allowed.
- distance.amount: Must be greater than 0 when provided.
- distance vs places: Exactly one of
distanceorplacesmust be provided (mutually exclusive). - vehicleType: Must be a valid vehicle type from the supported list.
- country: Must be a valid country code.
- glecVersion: Must be either "v2" or "v3".
Return type
| Parameter | type | description |
|---|---|---|
| id | ID | ID of the estimate |
| response | Mass | Total WTW (well-to-wheel) emissions in tCO2e |
Error Responses
The API returns appropriate HTTP status codes and error messages for invalid requests:
400 Bad Request
{
"message": "Bad payload"
}
Common causes:
- Invalid or missing required parameters
- Weight validation failure (negative values)
- Distance validation failure (zero or negative values)
- Both
distanceandplacesprovided (mutually exclusive) - Invalid vehicle type or country code
Create an estimate
curl -X "POST" "https://logistics.erguvan.co/api/estimates/shipping-road" \
-H 'Authorization: Bearer YOUR_ERGUVAN_API_KEY' \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"shipmentMass": {
"amount": 15,
"unit": "t"
},
"glecVersion": "v2",
"vehicleType": "urban_truck",
"country": "TR",
"distance": {
"amount": 300,
"unit": "km"
}
}'