Get started
Quickstart: your first trip
Get sandbox keys, answer a quote and a booking, send your first signed event and see it in the portal.
Step 1: Sign in and get sandbox keys
Open the partner portal and sign in with your email and the 6-digit code we email you. In Setup, under Keys, issue sandbox keys. You get an API key (
prk_test_...) and a webhook secret, shown once.Shellexport PR_API_KEY=prk_test_... # you send it to us as Bearer export PR_SECRET=... # the webhook secret: both sides sign with itStep 2: Connect your sandbox
In Connect, save your Sandbox API URL, your Webhook URL and Your API key for us (we send it to you as Bearer). Only an owner can change these.
Step 3: Answer a quote and a booking
Build
POST /quotesandPOST /trips(details in Quotes and booking). Then press Run tests in Test your API: we quote, book twice, get and cancel, and send a wrong signature and an old timestamp you must refuse.# Call your own sandbox the way PerfectRide does (signed with your secret). # The signed path is the path after your base URL: /quotes. TS=$(date +%s) BODY='{"pickup":{"lat":4.8156,"lng":7.0345,"address":"Hotel Presidential, Aba Road, Port Harcourt"},"dropoff":{"lat":4.8242,"lng":6.9969,"address":"Genesis Centre, GRA Phase 2, Port Harcourt"},"ride_class":"standard","passengers":1,"payment_method":"perfectride"}' SIG=$(printf '%s' "$TS.POST./quotes.$BODY" | openssl dgst -sha256 -hmac "$PR_SECRET" | sed 's/^.*= //') curl "$YOUR_BASE_URL/quotes" \ -H "Authorization: Bearer $KEY_YOU_GAVE_US" \ -H "Content-Type: application/json" \ -H "X-PR-Timestamp: $TS" \ -H "X-PR-Signature: sha256=$SIG" \ --data-raw "$BODY"Step 4: Send trip.driver_assigned
In Certification, press start. We book test trips in your sandbox and list each one with its
pr_trip_idand PIN. Copy the id of the first trip and sendtrip.driver_assignedfor it.TS=$(date +%s) NOW=$(date -u +%Y-%m-%dT%H:%M:%SZ) PR_TRIP_ID=pr_xxxx # the test trip from the portal BODY='{"event":"trip.driver_assigned","event_id":"ev_0001","partner_trip_id":"t_9931","pr_trip_id":"'"$PR_TRIP_ID"'","occurred_at":"'"$NOW"'","driver":{"id":"d_771","name":"Musa A.","phone":"+2348090001122"},"vehicle":{"make":"Toyota","model":"Corolla","color":"Black","plate":"PHC-123-AB"},"eta_seconds":240}' SIG=$(printf '%s' "$TS.POST./events.$BODY" | openssl dgst -sha256 -hmac "$PR_SECRET" | sed 's/^.*= //') curl https://www.perfectride.io/api/partner/v1/events \ -H "Authorization: Bearer $PR_API_KEY" \ -H "Content-Type: application/json" \ -H "X-PR-Timestamp: $TS" \ -H "X-PR-Signature: sha256=$SIG" \ --data-raw "$BODY"Response 200{ "ok": true, "result": "applied", "trip_status": "driver_assigned" }Step 5: See it in the portal
Open Event log and press Refresh. Your event shows as accepted, or refused with the error code and why. Then play the rest of the test trips to pass certification.
bad_signature almost always means the signed body is not the exact body sent. Sign the string you send, byte for byte.Next
- Keys and signingWhich key goes where, and how every request is signed in both directions.
- Trip eventsTell PerfectRide what happens on each trip, in order, and handle our answers.
- Sandbox and test dataTest against PerfectRide before any rider is involved: portal tests, certification trips and fixed scenarios.