Quiver
Track delivery
Documentation contents

Quote, book and track a delivery

Start with quote, book and track

Use curl and jq for this walkthrough. Find your Sandbox key, addresses and product, then set the four environment variables shown below. Keep the same order ID from quote to booking and tracking.

1. Quote the basket

Use the collection address, delivery address and catalogue product IDs for the account you are testing.

BASE_URL=https://api.quiver.london
QUIVER_API_KEY="${QUIVER_SANDBOX_API_KEY:?Set your Sandbox API key}"
: "${COLLECTION_ADDRESS_ID:?Set your Sandbox collection address ID}"
: "${DELIVERY_ADDRESS_ID:?Set your Sandbox delivery address ID}"
: "${MERCHANT_PRODUCT_ID:?Set your Sandbox catalogue product reference}"
ORDER_ID="docs-next-day-$(date +%s)-$$"

jq -n --argjson collection "$COLLECTION_ADDRESS_ID" --argjson delivery "$DELIVERY_ADDRESS_ID" \
  --arg product "$MERCHANT_PRODUCT_ID" --arg order "$ORDER_ID" '{
    deliveryType: "NEXT_DAY",
    collection: { addressId: $collection },
    delivery: { addressId: $delivery },
    customer: {
      firstName: "Alex", lastName: "Example",
      emailAddress: "alex@example.com", phoneNumber: "+447700900123"
    },
    order: { merchantOrderId: $order, lineItems: [{ merchantProductId: $product, quantity: 1 }] }
  }' > quote-request.json

curl --silent --show-error --fail-with-body "$BASE_URL/task/quotes" \
  -H "x-api-key: $QUIVER_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-binary @quote-request.json > quote.json
jq '.rates' quote.json

Read the rate’s code, price, currency and, when present, window. A price of 5.99 in GBP means £5.99. A provisional rate depends on confirming availability at the delivery address. If no rate can be booked, offer another delivery option. Get a fresh quote after changing the address or basket and shortly before booking.

2. Book the selected rate

Use the quote’s code as the booking’s rateCode. Include at least one order.lineItems entry when booking a delivery or return. A quote can succeed with an empty basket. Check the returned deliveryType and delivery window for the service Quiver accepted. Save the taskId and trackingUrl alongside your order ID.

RATE_CODE=$(jq -er '.rates[] | select(.code == "QUIV_DEL_ND" and (.error | not)) | .code' quote.json)
jq --arg code "$RATE_CODE" '. + { rateCode: $code }' quote-request.json > booking-request.json

curl --silent --show-error --fail-with-body "$BASE_URL/task/deliveries" \
  -H "x-api-key: $QUIVER_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-binary @booking-request.json > booking.json
jq '{taskId, trackingId, trackingUrl, status: .status.value, window: .delivery.window}' booking.json

3. Track the delivery

TASK_ID=$(jq -er '.taskId' booking.json)
curl --silent --show-error --fail-with-body "$BASE_URL/task/deliveries/$TASK_ID" \
  -H "x-api-key: $QUIVER_API_KEY" | jq '{taskId, status: .status.value, trackingUrl}'

Use the returned trackingUrl for customer tracking. Store taskId as your API identifier. Provide a new merchantOrderId for each new order.

Treat any returned trackingAccessKey and signed label URLs as credentials. Keep them out of logs, analytics and shared examples.

How We Work
Pricing
Reviews
Become a Courier
Jobs
3
Developers