Price a delivery
const url = 'https://api.govza.app/v1/delivery/quotes';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"pickup":{"latitude":43.342439,"longitude":45.693597},"dropoffs":[{"latitude":43.320872,"longitude":45.691756,"cargo_size":"M"},{"latitude":43.351021,"longitude":45.69154,"cargo_size":"S"}],"routing_mode":"sequential"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.govza.app/v1/delivery/quotes \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "pickup": { "latitude": 43.342439, "longitude": 45.693597 }, "dropoffs": [ { "latitude": 43.320872, "longitude": 45.691756, "cargo_size": "M" }, { "latitude": 43.351021, "longitude": 45.69154, "cargo_size": "S" } ], "routing_mode": "sequential" }'Returns the price, distance and duration for a trip without creating
anything. Pass the returned quote_id to POST /orders to lock in
these prices; quotes expire after five minutes, after which the order is
re-priced at the current rate.
Authorizations
Заголовок раздела «Authorizations»Request Bodyrequired
Заголовок раздела «Request Bodyrequired»Pricing needs coordinates and cargo size, and nothing else — no addresses and no contact details. You can price a basket before the customer has typed an address, and you never send us personal data for a call that has no use for it.
object
object
object
Overrides the request-level cargo_size for this stop.
Applies to every dropoff that does not set its own. Cargo size is
priced per destination, so it changes the quote; GET /cargo-sizes
lists what each size covers and adds.
sequential routes one chained trip through every dropoff in order.
parallel prices each dropoff independently from the pickup.
The order the courier visits the dropoffs in. given, the default,
keeps the order you sent. optimized reorders every dropoff into the
shortest road route from the pickup, and the trip is priced along that
route. optimized_keep_last does the same but keeps your last dropoff
last. Your order stays when no other is shorter. Only for
routing_mode: sequential; with parallel the request is refused.
Example
{ "pickup": { "latitude": 43.342439, "longitude": 45.693597 }, "dropoffs": [ { "latitude": 43.320872, "longitude": 45.691756, "cargo_size": "M" }, { "latitude": 43.351021, "longitude": 45.69154, "cargo_size": "S" } ], "routing_mode": "sequential"}Responses
Заголовок раздела «Responses»The trip was priced.
object
object
Pass to POST /orders to keep these prices.
Sum of every leg, each including its cargo surcharge.
One leg per dropoff, in your order. For sequential, each is
the leg arriving at that dropoff from the stop visited before it.
object
Metres.
Seconds.
Route price for this leg plus its cargo surcharge.
The part of price that is the cargo surcharge, as GET /cargo-sizes
lists it for the tariff this leg was priced by. price minus
cargo_surcharge is the distance price.
Zero-based positions in your dropoffs array, in the order the courier
visits them. Everything else stays in your order: quote legs,
tracking_urls and index in PATCH.
Example
{ "data": { "dropoffs": [ { "cargo_size": "S" } ], "visit_order": [ 2, 0, 1 ] }}The payload was rejected. error.details is a JSON array of
{ field, message } covering every offending field, not just the
first, so one response is enough to fix the request.
object
object
Example
{ "success": false, "error": { "id": "validation.delivery_payload_invalid", "message": "dropoffs.0.address.latitude: latitude is required", "details": "[{\"field\":\"dropoffs.0.address.latitude\",\"message\":\"latitude is required\"}]" }}The key is missing, malformed, revoked, or its account can no longer create orders.
object
object
Example
{ "success": false}