Delivery Quote API
Learn how to calculate delivery costs, distance, and duration using the Delivery Quote API.
Delivery Quote API
The Delivery Quote API allows you to calculate the estimated cost, distance, and duration for a delivery before placing a formal request.
Endpoint
POST /v1/delivery/quoteRequest Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
pickup_address | String | Yes | Human-readable pickup location. |
dropoff_address | String | Yes | Human-readable delivery destination. |
package_type | String | Yes | Type of package (food, document, small, large). |
weight | Number | No | Weight in Kilograms (KG). |
Request Example
{
"pickup_address": "Westlands, Nairobi",
"dropoff_address": "Kilimani, Nairobi",
"package_type": "food",
"weight": 2
}Response Example
{
"success": true,
"quote_id": "qt_928174",
"distance_km": 6.4,
"estimated_duration": "18 mins",
"delivery_fee": 420,
"currency": "KES",
"available_riders": 12,
"expires_at": "2026-05-14T15:30:00Z"
}Implementation
cURL
curl -X POST https://api.safaribid.com/v1/delivery/quote \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"pickup_address": "Westlands, Nairobi",
"dropoff_address": "Kilimani, Nairobi",
"package_type": "food",
"weight": 2
}'TypeScript
import { Safaribid } from '@safaribid/sdk';
const client = new Safaribid('YOUR_API_KEY');
const quote = await client.delivery.getQuote({
pickup_address: 'Westlands, Nairobi',
dropoff_address: 'Kilimani, Nairobi',
package_type: 'food',
weight: 2
});
console.log(`Estimated Fee: ${quote.delivery_fee} ${quote.currency}`);Delivery Lifecycle
- Merchant Requests Quote: Calculate costs and show them to your customer.
- Merchant Confirms Order: Convert the
quote_idinto a formal Delivery Request. - Rider Assigned: Our engine matches the nearest qualified rider.
- Pickup & Fulfillment: Rider picks up the item and begins the delivery.
- Real-time Tracking: Monitor the rider via the Tracking API.