shipmentRates
Requires permission sales:sales_order:ship.
Prices a shipment with every enabled delivery partner, at the seller's cost: either an order's outbound shipment (salesOrderId) or a return pickup from the customer to the warehouse (productReturnId, offered only by partners that handle returns). Give exactly one of the two; lines to ship apply to a sales order, not a return pickup. The result lists the rate options, the partners that could not quote and why, suggested parcels when boxes are packed for you, and the order's shipping charge and the customer's checkout choice. Needs the sales order ship permission.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
query ShipmentRates($input: ShipmentRatesInput!) {
shipmentRates(input: $input) {
customerChoice {
serviceLevelCode
carrierName
partnerDisplayName
serviceLevelName
speedName
amount
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "query ShipmentRates($input: ShipmentRatesInput!) {\n shipmentRates(input: $input) {\n customerChoice {\n serviceLevelCode\n carrierName\n partnerDisplayName\n serviceLevelName\n speedName\n amount\n }\n }\n}",
"variables": {
"input": {}
}
}
EOF
Variables:
{
"input": {}
}
Response:
{
"data": {
"shipmentRates": {
"customerChoice": {
"serviceLevelCode": "string",
"carrierName": "string",
"partnerDisplayName": "string",
"serviceLevelName": "string",
"speedName": "string",
"amount": "string"
}
}
}
}
shipmentRates(
input: ShipmentRatesInput!
): ShipmentRatesGql!
Arguments
shipmentRates.input ● ShipmentRatesInput! non-null input
The details of the shipment rates request.
Type
ShipmentRatesGql object
The prices delivery partners quoted for a shipment.