Safaribid Docs

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/quote

Request Parameters

ParameterTypeRequiredDescription
pickup_addressStringYesHuman-readable pickup location.
dropoff_addressStringYesHuman-readable delivery destination.
package_typeStringYesType of package (food, document, small, large).
weightNumberNoWeight 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

  1. Merchant Requests Quote: Calculate costs and show them to your customer.
  2. Merchant Confirms Order: Convert the quote_id into a formal Delivery Request.
  3. Rider Assigned: Our engine matches the nearest qualified rider.
  4. Pickup & Fulfillment: Rider picks up the item and begins the delivery.
  5. Real-time Tracking: Monitor the rider via the Tracking API.

On this page