Get the shipping cost of an order
Prices shipping for an order before you place it, from the same items you would send to create_integrator_order: the quotes, how many of each and any extras, which change the weight. It runs the calculation the order charges with and creates nothing, so you can show your customer the shipping before they buy.
The parcel is priced at the tier of its heaviest item, plus a charge for each other item (extra-small items travel free). VAT is not included: checkout mode adds it for buyers in the EU and UK. A rate card change between the estimate and the order changes the price, so estimate close to ordering.
What you need
- countrystringRequired
Destination country, ISO alpha-2 (for example
DE). - itemsarray of objectRequired
The order lines:
{ "quote": "qte_...", "quantity": 2 }, withextras: [{ "extra": "xtr_...", "quantity_per_unit": 1 }]when the units ship with extras. Every quote must beready.
Step 1: Estimate the shipping of an order
POST/v2/integrator/orders/shipping-estimate
quote_not_ready (422) means a quote is still processing or failed. shipping_destination_not_served (422) means 3DAPI does not deliver to that country (Russia, Belarus, Iran or Syria); every other country is served, and get_shipping_rates lists the zones. tier and zone are null when the order cannot be weighed, and the total is then the flat delivery price.
{
"country": "$inputs.country",
"items": "$inputs.items"
}Succeeds when:
$statusCode == 200
Otherwise:
quote_not_found: stop the workflow when$statusCode == 404.not_ready_or_not_served: stop the workflow when$statusCode == 422.
Keeps for the next steps:
total:$response.body#/totaltier:$response.body#/tierzone:$response.body#/zoneadditional_items:$response.body#/additional_items
As a workflow file
The workflow returns:
total:$steps.estimate.outputs.totaltier:$steps.estimate.outputs.tier
Values starting with $ are filled in as you go: $inputs.x is something you provide, $steps.s.outputs.o is a value an earlier step returned, and $response.body#/path a field of this response.
This recipe is the workflow estimate_order_shipping of arazzo.json, an Arazzo 1.0 document that tools and AI agents can follow step by step.