Quote a shipment price
pricing:readPrices exactly like shipment creation (rate card of the merchant, zone of the destination, handling surcharges,
COD fee) and applies the company's coverage, but creates nothing: no shipment, no tracking number, no quota is
used. total equals the shipping fee the created shipment will carry. Without merchant the company's default
pricing applies.
A destination (or pickup) outside the company's coverage is not an error: the answer is 200 with
deliverable: false and reason set to destination_not_covered, pickup_not_covered or
rate_card_not_found. Locations that do not exist answer 422 with the geo_* codes and details.field
= pickup or recipient.
جسم الطلب · PublicQuoteRequestapplication/json
The shipment to price.
| الحقل | النوع | الوصف |
|---|---|---|
merchantمشروط | stringيقبل null | Merchant id or exact account name; the merchant's own rate card applies. Optional: without it the company's
default pricing is used. A merchant login always quotes for itself. Required for مثال: |
pickup | PublicQuoteLocationInput | A place given by names for a quote. Each level accepts an id, a code or a name in Arabic or English. |
countrypickup.country | stringيقبل null | Country id, ISO code or name. Optional when the city name is unambiguous. مثال: |
citypickup.city مطلوب | stringيقبل null | City id, code or name. Required. مثال: |
districtpickup.district | stringيقبل null | District id, code or name. Optional for a quote; when sent it must exist. مثال: |
recipient | PublicQuoteLocationInput | A place given by names for a quote. Each level accepts an id, a code or a name in Arabic or English. |
countryrecipient.country | stringيقبل null | Country id, ISO code or name. Optional when the city name is unambiguous. مثال: |
cityrecipient.city مطلوب | stringيقبل null | City id, code or name. Required. مثال: |
districtrecipient.district | stringيقبل null | District id, code or name. Optional for a quote; when sent it must exist. مثال: |
parcel | PublicParcelInput | The parcel. Weight and dimensions describe the whole shipment. |
weightKgparcel.weightKg مطلوب | number (double) | Actual weight in kilograms, greater than 0. مثال: |
lengthCmparcel.lengthCm مطلوب | number (double) | Length in centimetres, greater than 0. مثال: |
widthCmparcel.widthCm مطلوب | number (double) | Width in centimetres, greater than 0. مثال: |
heightCmparcel.heightCm مطلوب | number (double) | Height in centimetres, greater than 0. مثال: |
piecesparcel.pieces | integer (int32)يقبل null | Number of pieces (default 1). مثال: |
descriptionparcel.description | stringيقبل null | What is inside (optional, shown on the label). مثال: |
declaredValueparcel.declaredValue | number (double)يقبل null | Declared value of the goods (default 0). مثال: |
fragileparcel.fragile | boolean | Fragile goods. مثال: |
requiresColdChainparcel.requiresColdChain مشروط | boolean | Needs cold chain; then مثال: |
coldChainRangeparcel.coldChainRange | enum | Temperature range of cold-chain goods. القيم: |
flammableparcel.flammable | boolean | Flammable goods. مثال: |
hazardousparcel.hazardous | boolean | Hazardous goods. مثال: |
containsAlcoholparcel.containsAlcohol | boolean | Contains alcohol. مثال: |
liquidparcel.liquid | boolean | Liquid goods. مثال: |
highValueparcel.highValue | boolean | High-value goods. مثال: |
payment | PublicPaymentInput | Cash on delivery and freight payment. |
codAmountpayment.codAmount | number (double)يقبل null | Amount the courier collects from the recipient (cash on delivery). Default 0. Must be 0 for مثال: |
freightOnDeliverypayment.freightOnDelivery | booleanيقبل null | True when the recipient pays the shipping fee on delivery. مثال: |
serviceType | enum | Kind of service requested for a shipment. القيم: |
serviceTier | enum | Speed of the service; it drives the estimated delivery date. القيم: |
وثيقة OpenAPI لا تعلّم الحقول المطلوبة رسمياً، لذلك تُقرأ كلمة «مطلوب» من وصف كل حقل. تسرد الأدلة الحقول المطلوبة لكل طلب.
مثال طلب
curl -X POST "https://api.goldrock.live/api/public/v1/pricing/quote" \
-H "X-API-Key: lmc_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "X-API-Secret: YOUR_API_SECRET" \
-H "Content-Type: application/json" \
-d '{
"merchant": "Noor Electronics",
"pickup": {
"country": "SA",
"city": "Riyadh",
"district": "Al Olaya"
},
"recipient": {
"country": "SA",
"city": "Jeddah",
"district": "Al Rawdah"
},
"parcel": {
"weightKg": 1.5,
"lengthCm": 20,
"widthCm": 15,
"heightCm": 10
},
"payment": {
"codAmount": 199.5
},
"serviceType": "delivery",
"serviceTier": "standard"
}'const response = await fetch("https://api.goldrock.live/api/public/v1/pricing/quote", {
method: "POST",
headers: {
"X-API-Key": "lmc_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"X-API-Secret": "YOUR_API_SECRET",
"Content-Type": "application/json"
},
body: JSON.stringify({
"merchant": "Noor Electronics",
"pickup": {
"country": "SA",
"city": "Riyadh",
"district": "Al Olaya"
},
"recipient": {
"country": "SA",
"city": "Jeddah",
"district": "Al Rawdah"
},
"parcel": {
"weightKg": 1.5,
"lengthCm": 20,
"widthCm": 15,
"heightCm": 10
},
"payment": {
"codAmount": 199.5
},
"serviceType": "delivery",
"serviceTier": "standard"
}),
});
const data = await response.json();
console.log(response.status, data);<?php
$url = 'https://api.goldrock.live/api/public/v1/pricing/quote';
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'X-API-Key: lmc_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'X-API-Secret: YOUR_API_SECRET',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'merchant' => 'Noor Electronics',
'pickup' => [
'country' => 'SA',
'city' => 'Riyadh',
'district' => 'Al Olaya',
],
'recipient' => [
'country' => 'SA',
'city' => 'Jeddah',
'district' => 'Al Rawdah',
],
'parcel' => [
'weightKg' => 1.5,
'lengthCm' => 20,
'widthCm' => 15,
'heightCm' => 10,
],
'payment' => [
'codAmount' => 199.5,
],
'serviceType' => 'delivery',
'serviceTier' => 'standard',
], JSON_UNESCAPED_UNICODE),
]);
$result = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
var_dump($status, json_decode($result, true));import requests
response = requests.request(
"POST",
"https://api.goldrock.live/api/public/v1/pricing/quote",
headers={
"X-API-Key": "lmc_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"X-API-Secret": "YOUR_API_SECRET",
},
json={
"merchant": "Noor Electronics",
"pickup": {
"country": "SA",
"city": "Riyadh",
"district": "Al Olaya",
},
"recipient": {
"country": "SA",
"city": "Jeddah",
"district": "Al Rawdah",
},
"parcel": {
"weightKg": 1.5,
"lengthCm": 20,
"widthCm": 15,
"heightCm": 10,
},
"payment": {
"codAmount": 199.5,
},
"serviceType": "delivery",
"serviceTier": "standard",
},
timeout=30,
)
print(response.status_code, response.json())تستخدم الأمثلة مفتاح API؛ استبدل القيم النائبة. لاستخدام رمز Bearer أرسل Authorization: Bearer <accessToken>.
الاستجابات
200The quote.
الاستجابات · الحقل
| الحقل | النوع | الوصف |
|---|---|---|
deliverable | boolean | False when the company does not cover the pickup or the destination (see |
reason | stringيقبل null |
|
shippingFee | number (double)يقبل null | Shipping fee without the COD fee (weight price plus handling surcharges). |
codFee | number (double)يقبل null | Fee charged for collecting cash on delivery. |
total | number (double)يقبل null | What the shipment will be charged: |
chargeableWeightKg | number (double)يقبل null | The larger of actual and volumetric weight. |
zone | PublicZoneRef | A pricing zone. |
idzone.id | string (uuid) | Zone id. |
namezone.name | stringيقبل null | Zone name. |
breakdown | array<PublicQuoteLineDto>يقبل null | Price lines; they add up to |
codebreakdown[].code | stringيقبل null |
|
labelbreakdown[].label | stringيقبل null | Readable label (the handling flag name for |
amountbreakdown[].amount | number (double) | Amount of the line. |
{
"deliverable": true,
"reason": null,
"shippingFee": 25,
"codFee": 5,
"total": 30,
"chargeableWeightKg": 1.5,
"zone": {
"id": "d4e5f6a7-b8c9-4d0e-8f1a-2b3c4d5e6f70",
"name": "Zone 2"
},
"breakdown": [
{
"code": "baseShipping",
"label": "Base shipping",
"amount": 25
},
{
"code": "codFee",
"label": "Cash on delivery fee",
"amount": 5
}
]
}| الحالة | الوصف |
|---|---|
400 | The request is invalid (code |
401 | Authentication is missing or invalid (code |
403 | The credential lacks the required scope, or the public API is disabled (codes |
404 | The merchant was not found ( |
422 | A business rule or a location could not be satisfied (codes such as |
429 | Too many requests (code |
تشترك أخطاء الواجهة في جسم واحد موصوف في مرجع الأخطاء. مرجع الأخطاء