tanqoryExtShippingRateQuote
- Query
- Inventory and fulfillment
The services a shipping label could be bought with for a parcel that is not an order yet (the shipping rate calculator), from the same label provider as shippingLabelPurchase: from originLocationId (an active location of the store, its address and the store as sender), to destination, in packageId (omitted = the store's default package; a store without packages is quoted in the provider's standard box), at weight (the packed parcel's total weight), in the store's currency, shipped today. Nothing is stored. userErrors use the shippingLabelPurchase codes: NOT_FOUND (originLocationId is not an active location of this store, or packageId is not a package of this store), INVALID_PACKAGE_DIMENSIONS (the package has a dimension that is not greater than zero), TOTAL_WEIGHT_ZERO, RATES_NOT_FOUND (the provider offers no service for this parcel, field destination).
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
destination | TanqoryExtShippingRateQuoteAddressInput! | Required | |
originLocationId | ID! | Required | |
packageId | ID | Optional | |
weight | WeightInput! | Required |
Returns
TanqoryExtShippingLabelRates! The shipping services offered for one label, or why none can be offered.
| Field | Type | Description |
|---|---|---|
noRatesReason | TanqoryExtShippingLabelNoRatesReason | What the carrier said when it offered no service (with RATES_NOT_FOUND), so the merchant knows what to fix. Null when services are offered, when the input was refused before the carrier was asked, or when the carrier gave no reason. |
purchasesOpen | Boolean! | Whether a label can be bought here now. False on a deployment that takes real money while its label carrier is still a practice one (a sandbox or test environment): the rates are shown, and shippingLabelPurchase answers TANQORY_EXT_LABELS_NOT_OPEN. |
rates | [TanqoryExtShippingLabelRate!]! | The services, in the provider's order (the first is the default selection of shippingLabelPurchase). |
userErrors | [ShippingLabelPurchaseUserError!]! | Why no rate can be offered (the shippingLabelPurchase codes). |
Example request
A starting point: required arguments as variables and a few fields of the result. Replace the placeholders.
Set STORE_ID and TANQORY_ACCESS_TOKEN in your environment first (Make your first API call).
curl -X POST "https://api.tanqory.com/admin/2026-10/stores/$STORE_ID/graphql" \
-H "Authorization: Bearer $TANQORY_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
--data '{"query":"query TanqoryExtShippingRateQuote($destination: TanqoryExtShippingRateQuoteAddressInput!, $originLocationId: ID!, $weight: WeightInput!) {\n tanqoryExtShippingRateQuote(destination: $destination, originLocationId: $originLocationId, weight: $weight) {\n purchasesOpen\n userErrors {\n code\n field\n message\n }\n }\n}","variables":{"destination":{"countryCode":"AC"},"originLocationId":"gid://tanqory/Type/id","weight":{"unit":"GRAMS","value":1}}}'// Node.js 18 or later (fetch is built in). Save as request.mjs and run: node request.mjs
const query = `query TanqoryExtShippingRateQuote(\$destination: TanqoryExtShippingRateQuoteAddressInput!, \$originLocationId: ID!, \$weight: WeightInput!) {
tanqoryExtShippingRateQuote(destination: \$destination, originLocationId: \$originLocationId, weight: \$weight) {
purchasesOpen
userErrors {
code
field
message
}
}
}`;
const variables = {
"destination": {
"countryCode": "AC"
},
"originLocationId": "gid://tanqory/Type/id",
"weight": {
"unit": "GRAMS",
"value": 1
}
};
const res = await fetch(`https://api.tanqory.com/admin/2026-10/stores/${process.env.STORE_ID}/graphql`, {
method: 'POST',
headers: {
'Authorization': 'Bearer ' + process.env.TANQORY_ACCESS_TOKEN,
'Content-Type': 'application/json',
},
body: JSON.stringify({ query, variables }),
});
console.log(res.status, JSON.stringify(await res.json(), null, 2));# Python 3, standard library only. Save as request.py and run: python3 request.py
import json, os, urllib.request
query = """query TanqoryExtShippingRateQuote($destination: TanqoryExtShippingRateQuoteAddressInput!, $originLocationId: ID!, $weight: WeightInput!) {
tanqoryExtShippingRateQuote(destination: $destination, originLocationId: $originLocationId, weight: $weight) {
purchasesOpen
userErrors {
code
field
message
}
}
}"""
variables = json.loads("""{
"destination": {
"countryCode": "AC"
},
"originLocationId": "gid://tanqory/Type/id",
"weight": {
"unit": "GRAMS",
"value": 1
}
}""")
req = urllib.request.Request(
"https://api.tanqory.com/admin/2026-10/stores/" + os.environ["STORE_ID"] + "/graphql",
data=json.dumps({"query": query, "variables": variables}).encode(),
headers={
"Authorization": "Bearer " + os.environ["TANQORY_ACCESS_TOKEN"],
"Content-Type": "application/json",
},
)
with urllib.request.urlopen(req) as res:
print(res.status, json.dumps(json.load(res), indent=2))