Rates
Calculate rate
A price for a destination, weight and size, with the full breakdown.
POST
/v1/rates/calculateBearer tokenReturns JSONSuccess 200
This runs the same rate engine that prices an order at dispatch, so the number is real. Nothing is saved or charged. Each box is charged on the larger of its actual weight and its volume weight (length × width × height ÷ 5000). resolvedTier is the price tier of the destination.
Request
Headers
| Field | Type | Description |
|---|---|---|
Authorizationrequired | string | The access token from Get token, as "Bearer <token>". |
Content-Typerequired | string | Always application/json when a body is sent. |
Request body
| Field | Type | Description |
|---|---|---|
pickupAddressIdoptional | string | Where the shipment starts, from List pickup addresses. Left out, your shipping company's home country is used. |
destinationCountryIdrequired | string | Destination country id. |
destinationStateIdoptional | string | Destination state id. Makes the price tier more exact. |
destinationCityIdoptional | string | Destination city id. Makes the price tier more exact and checks coverage. |
boxesrequired | array | The boxes to price. At least one. |
boxes[].lengthrequired | number | Length in cm. |
boxes[].widthrequired | number | Width in cm. |
boxes[].heightrequired | number | Height in cm. |
boxes[].weightrequired | number | Actual weight of the box in kg. |
wantsInsuranceoptional | boolean | Add insurance to the price. |
declaredValueoptional | number | The value of the goods. Insurance and customs duty are worked out from it. |
Example request
curl -X POST "https://api.swiftazu.com/v1/rates/calculate" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"pickupAddressId": "899caca3-0471-423e-9a90-0add12d7355b",
"destinationCountryId": "cfde4319-9563-4d6a-9afa-0f72dad3c718",
"destinationStateId": "73ff99bd-ca0e-4ec7-a60e-f314c57c0046",
"destinationCityId": "23a058c2-9b96-460b-92d8-1196cba2f562",
"boxes": [
{
"length": 30,
"width": 20,
"height": 15,
"weight": 2.4
}
],
"wantsInsurance": true,
"declaredValue": 350
}'Response
Example response · 200
{
"currency": "AED",
"total": "27.80",
"basePrice": "18.00",
"overweightSurcharge": "4.80",
"insurancePremium": "5.00",
"customsDutyCharge": null,
"isCrossBorder": false,
"resolvedTier": 1,
"originTier": 1,
"totalChargeableWeight": 2.4,
"baseWeight": 0,
"maxWeight": 5,
"overweightPricePerKg": "2.00",
"boxCount": 1,
"boxes": [
{
"actualWeight": 2.4,
"volumetricWeight": 1.8,
"chargeableWeight": 2.4
}
]
}Errors
| HTTP | Code | Meaning |
|---|---|---|
| 400 | destination_not_covered | The shipping company does not deliver to this city. |
| 400 | no_route | The shipping company has no price for this origin and destination. |
| 400 | no_weight_band | No price is set for this weight on this route. |
| 400 | box_limit_exceeded | The route does not carry this many boxes on one shipment. |
| 400 | invalid_request | The request broke a business rule. message says which one. |
Every call can also return the shared errors listed on the Overview page. Overview