PARTNER API · POS

Book a Viaph delivery from your POS

One API key from your server. Send pickup and drop-off, get a fare, then create the job. Create returns a trackingUrl per order (it uses that order’s orderId — never your API key). Share that link with the cafe and the recipient. Do not poll status. Optional: we can ping your HTTPS URL when the job changes. The customer pays cash to the rider (COD). Viaph assigns the rider.

Access this page

Share this link with POS vendors (no login required). Live after Hosting deploy.

https://viaph-d4bab.web.app/developers

Same path on any custom marketing domain: /developers

Rules you must follow

Fare is the distance from pickup to drop-off. Both pins are required. We do not use your POS cafe IDs, and we do not fall back to a store pin.

Pickup + drop-off

Every quote must send pickup and dropoff with lat, lng, and address. Missing pickup returns 422.

No POS cafe IDs

Send pickup and drop-off. Do not send your POS store ids. restaurantId is only needed if we listed Viaph stores on your key.

COD only

Rider collects the delivery fee in cash at the door (collectCashCents). No food total. No customer app.

Auth

Send the key only from your server. Never put it in a browser, APK, or POS terminal app.

The API key is static. It does not expire. It stays valid until we turn it off or make a new one (rotate). Keep it secret.

saraf_live_… writes live jobs. saraf_test_… writes test jobs (hidden from live ops).

Put these in your terminal once, then copy each curl below.

Setup
export VIAPH_API_KEY='saraf_live_YOUR_KEY'
export VIAPH_BASE='https://asia-southeast1-viaph-d4bab.cloudfunctions.net/partnerDeliveryApi/v1'

Base URL

Base URL
https://asia-southeast1-viaph-d4bab.cloudfunctions.net/partnerDeliveryApi/v1

1. Quote — POST /quotations

Required: pickup and dropoff. Each pin needs lat, lng, and address.

Optional: restaurantId (only if your key still has Viaph stores listed), sizeCategory (small/medium/large, default medium), vehicleType (motorcycle/trike/car, default motorcycle).

Save quotationId. The quote expires in 10 minutes (not your API key). Create cannot change the pins or the fare.

Quote curl
curl -sS -X POST "$VIAPH_BASE/quotations" \
  -H "Authorization: Bearer $VIAPH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "pickup": {
      "lat": 9.790,
      "lng": 125.495,
      "address": "Cafe counter, Surigao City"
    },
    "dropoff": {
      "lat": 9.784,
      "lng": 125.489,
      "address": "Customer house, Surigao City"
    },
    "sizeCategory": "small",
    "vehicleType": "motorcycle"
  }'

Example response:

Quote response
{
  "quotationId": "q_abc123",
  "feeCents": 8900,
  "currency": "PHP",
  "distanceKm": 2.4,
  "expiresAtMs": 1727332800000,
  "pickup": { "lat": 9.790, "lng": 125.495, "address": "Cafe counter, Surigao City" },
  "dropoff": { "lat": 9.784, "lng": 125.489, "address": "Customer house, Surigao City" }
}

2. Create — POST /deliveries

Required: quotationId, itemDescription, pickupContact (who hands the bag), and dropoffContact (who receives). Each contact needs name and PH mobile phone (09…).

Optional: deliveryInstructions (unit, landmark, max 1000 chars).

Response includes orderId (same as deliveryId) and trackingUrl. Open or share the link — the page updates by itself. collectCashCents is the COD delivery fee only. Do not poll GET in a loop.

Paste the quote id from step 1 into VIAPH_QUOTE_ID first.

Create curl
export VIAPH_QUOTE_ID='QUOTATION_ID_FROM_STEP_1'

curl -sS -X POST "$VIAPH_BASE/deliveries" \
  -H "Authorization: Bearer $VIAPH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "quotationId": "'"$VIAPH_QUOTE_ID"'",
    "itemDescription": "1 iced coffee, no ice extra",
    "deliveryInstructions": "Blue gate, 2nd house",
    "pickupContact": {
      "name": "Cafe Ana",
      "phone": "09170001111"
    },
    "dropoffContact": {
      "name": "Maria Santos",
      "phone": "09171234567"
    }
  }'

Example response:

Create response
{
  "orderId": "d_abc123",
  "deliveryId": "d_abc123",
  "status": "pending_assignment",
  "trackingUrl": "https://viaph-d4bab.web.app/track?orderId=d_abc123",
  "feeCents": 8900,
  "collectCashCents": 8900
}

3. Status — tracking page (preferred) + GET fallback

Share trackingUrl with the cafe, the customer, and the rider if needed. One link per order. The page shows pickup and drop-off name, phone, and address (tap to call), plus notes. Never put your API key in the URL. The page listens for changes — it does not call this API on a timer.

Optional webhook: Super pastes your HTTPS URL on the key. We POST { orderId, status, trackingUrl, feeCents } when status changes. That is for your software.

GET below is a fallback for debug. Do not poll it. We do not return rider phone or live GPS.

Your status What it means
pending_assignment Waiting for Viaph to assign a rider
assigned Rider accepted
pickup Rider is at pickup
in_transit On the way to drop-off
completed Delivered
canceled Canceled
Status curl
export VIAPH_ORDER_ID='ORDER_ID_FROM_STEP_2'

curl -sS "$VIAPH_BASE/deliveries/$VIAPH_ORDER_ID" \
  -H "Authorization: Bearer $VIAPH_API_KEY"

4. Cancel — POST /deliveries/:orderId/cancel

Same Package cancel rules. If the rider already arrived at pickup, half the fee may still be owed.

Cancel curl
curl -sS -X POST "$VIAPH_BASE/deliveries/$VIAPH_ORDER_ID/cancel" \
  -H "Authorization: Bearer $VIAPH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

Errors

Body shape: { "error": { "code", "message" } }. Caps: 60 calls/min per key, 20 new bookings/min, 20 bad-key guesses/min per IP.

HTTP When
401 Missing, unknown, or turned-off key
403 restaurantId is not on this key
404 Unknown quote or order
409 Quote used/expired, or cancel not allowed
422 Validation — missing pickup/drop-off, missing pickup/drop-off contact, empty item, bad phone
429 Too many requests
503 Fare / maps failure. Retry later.