Quote
Amounts, ids and limits in the examples are samples. Read the real values from the API.
Price a product with shipping
Prices a quantity of one base product with one technique and its zones, plus one shipment. It saves nothing and charges nothing.
Colour and size do not change the price: it depends on the product, the technique, the zones and the quantity. technique_id and zone_ids must be one of the product's options; zones no option prices answer 400 invalid_request with unknown_zone.
There is no address in a quote: the shipping fee is the carrier's fee per shipment, which does not depend on the address.
Without carrier_id, your default carrier is used, or B7R's default carrier when you have not chosen one. An id that is not the product's, a technique it does not offer or an inactive carrier answers 400 invalid_request; the error names the field and lists the accepted ids in valid_values.
Headers
Bearer b7r_live_.... A key with the catalog area. X-B7R-Key works too; send one, never both.
A new value per operation (up to 255 letters, digits, ., _, : or -; a UUID works), the same value on its retries. See Safe retries.
application/json.
ar for Arabic error titles; anything else gives English. Codes never change.
Body
1 to 2 items.
1 to 999.
Answer
Child fields
Always "SAR".
Child fields
Always "SAR".
Child fields
Child fields
Always "SAR".
Child fields
Always "SAR".
Child fields
Always "SAR".
Errors
| HTTP | Code | Retry |
|---|---|---|
| 401 | unauthorized | No |
| 403 | area_forbidden | No |
| 403 | account_inactive | No |
| 403 | connection_disabled | No |
| 400 | invalid_request | No |
| 400 | idempotency_key_required | No |
| 413 | request_too_large | No |
| 415 | unsupported_media_type | No |
| 429 | rate_limited | Yes |
| 500 | internal_error | Yes |
| 502 | upstream_unavailable | Yes |
| 503 | api_unavailable | Yes |
| 503 | request_expired | Yes |
| 503 | service_unavailable | Yes |
| 504 | upstream_timeout | Yes |
curl -X POST https://api.b7r.app/v1/quote \
-H "Authorization: Bearer $B7R_API_KEY" \
-H "Idempotency-Key: $(uuidgen 2>/dev/null || node -e 'console.log(crypto.randomUUID())')" \
-H "Content-Type: application/json" \
-d '{
"product_id": "8c2e4f6a-1b3d-4a5c-8e7f-9a0b1c2d3e4f",
"technique_id": "2b9d6e1f-7a4c-4d8e-b3f5-0c1a2e3d4f5a",
"zone_ids": [
"5e7a9c1b-3d5f-4b7a-9c1e-2f4a6b8c0d2e"
],
"quantity": 2,
"carrier_id": "9b1d3f5a-7c9e-4b1d-8f5a-6c8e0a2b4d6f"
}'const res = await fetch("https://api.b7r.app/v1/quote", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.B7R_API_KEY}`,
"Idempotency-Key": crypto.randomUUID(),
"Content-Type": "application/json",
},
body: JSON.stringify({
"product_id": "8c2e4f6a-1b3d-4a5c-8e7f-9a0b1c2d3e4f",
"technique_id": "2b9d6e1f-7a4c-4d8e-b3f5-0c1a2e3d4f5a",
"zone_ids": [
"5e7a9c1b-3d5f-4b7a-9c1e-2f4a6b8c0d2e"
],
"quantity": 2,
"carrier_id": "9b1d3f5a-7c9e-4b1d-8f5a-6c8e0a2b4d6f"
}),
});
const data = await res.json();import os, requests, uuid
res = requests.post(
"https://api.b7r.app/v1/quote",
headers={
"Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
json={
"product_id": "8c2e4f6a-1b3d-4a5c-8e7f-9a0b1c2d3e4f",
"technique_id": "2b9d6e1f-7a4c-4d8e-b3f5-0c1a2e3d4f5a",
"zone_ids": [
"5e7a9c1b-3d5f-4b7a-9c1e-2f4a6b8c0d2e"
],
"quantity": 2,
"carrier_id": "9b1d3f5a-7c9e-4b1d-8f5a-6c8e0a2b4d6f"
},
timeout=30,
)
data = res.json(){
"product_id": "8c2e4f6a-1b3d-4a5c-8e7f-9a0b1c2d3e4f",
"technique_id": "2b9d6e1f-7a4c-4d8e-b3f5-0c1a2e3d4f5a",
"zone_ids": [
"5e7a9c1b-3d5f-4b7a-9c1e-2f4a6b8c0d2e"
],
"quantity": 2,
"unit_cost": {
"net": "45.00",
"vat": "0.00",
"gross": "45.00",
"currency": "SAR"
},
"lines_total": {
"net": "90.00",
"vat": "0.00",
"gross": "90.00",
"currency": "SAR"
},
"shipping": {
"carrier_id": "9b1d3f5a-7c9e-4b1d-8f5a-6c8e0a2b4d6f",
"fee": {
"net": "25.00",
"vat": "0.00",
"gross": "25.00",
"currency": "SAR"
}
},
"total": {
"net": "115.00",
"vat": "0.00",
"gross": "115.00",
"currency": "SAR"
},
"minimum_selling_price": {
"amount": "59.00",
"currency": "SAR"
}
}Money: net, VAT and gross
Every amount B7R charges comes as an object: net, vat and gross as decimal strings with two places, and currency, always SAR. Read amounts as decimals, never as floating point numbers.
- Amounts are VAT inclusive:
grossis what you pay. - B7R is not VAT registered today, so
vatis"0.00"andnetequalsgross. - When B7R registers for VAT, the same fields carry the VAT inside
gross:vatbecomes more than zero andnetisgrossminusvat. Your code needs no change if it reads the three fields instead of working VAT out itself. - Never assume a VAT rate. Every answer carries the figures that apply.
{
"net": "115.00",
"vat": "0.00",
"gross": "115.00",
"currency": "SAR"
}Minimum selling price
minimum_selling_price is the lowest price you may sell the product for, per piece, worked out on the cost per piece (shipping is not part of it). It follows a markup over cost that B7R sets and can change, so read it from the catalog or a fresh quote, and never store it as a constant.
