Get started
Keys and signing
Which key goes where, and how every request is signed in both directions.
Keys
- API keyWho makes itPerfectRide (portal for sandbox)UseYou send it to us:
Authorization: Bearer prk_test_.... Live keys startprk_live_ - Webhook secretWho makes itPerfectRide, with the API keyUseBoth sides sign with it, one per environment
- Your API key for usWho makes itYouUseWe send it to your API:
Authorization: Bearer <your key>
| Key | Who makes it | Use |
|---|---|---|
| API key | PerfectRide (portal for sandbox) | You send it to us: Authorization: Bearer prk_test_.... Live keys start prk_live_ |
| Webhook secret | PerfectRide, with the API key | Both sides sign with it, one per environment |
| Your API key for us | You | We send it to your API: Authorization: Bearer <your key> |
- Sandbox keys come from the portal. Live keys come from PerfectRide when your pilot starts.
- Issuing new sandbox keys stops the old pair at once. Only an owner can do it.
- Keep keys and the secret on your servers, never in an app or browser.
Headers
Every request, both directions
Authorization: Bearer <key>
X-PR-Timestamp: 1764756072
X-PR-Signature: sha256=<hex>
hex = HMAC-SHA256(webhook_secret, "<timestamp>.<METHOD>.<path>.<body>")What you sign
- timestampValueThe
X-PR-Timestampvalue: unix seconds - METHODValueUpper case:
POST,GET - pathValueThe path after the base URL, with the query string:
/quotes,/trips/t_9931/cancel,/settlements?date=2026-12-03 - path, events and supplyValue
/eventsfor events you send us,/supplyfor supply reports - path, our webhooksValue
/for events we send to your webhook URL, whatever its path - bodyValueThe raw body bytes, UTF-8. Empty for GET
| Part | Value |
|---|---|
| timestamp | The X-PR-Timestamp value: unix seconds |
| METHOD | Upper case: POST, GET |
| path | The path after the base URL, with the query string: /quotes, /trips/t_9931/cancel, /settlements?date=2026-12-03 |
| path, events and supply | /events for events you send us, /supply for supply reports |
| path, our webhooks | / for events we send to your webhook URL, whatever its path |
| body | The raw body bytes, UTF-8. Empty for GET |
Warning: Sign the exact bytes you send. Parsing and re-serialising JSON before you sign or verify changes the bytes and breaks the signature.
Sign and verify
# hex = HMAC-SHA256(secret, "<ts>.<METHOD>.<path>.<body>")
TS=$(date +%s)
BODY='{"event":"trip.driver_arrived","event_id":"ev_0003","partner_trip_id":"t_9931","pr_trip_id":"pr_55a9","occurred_at":"2026-12-03T10:05:00Z"}'
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"Check our requests
- Check the Bearer key is the one you gave us.
- Refuse a timestamp more than 300 seconds from your clock.
- Compare signatures in constant time.
- Answer 401 with the error body when any check fails. Certification sends one wrong signature: you must answer 401.
401 body
{ "error": { "code": "bad_signature", "message": "X-PR-Signature does not match" } }Test vector
Check your code against this before you call us.
- secretValue
whsec_test_123 - timestampValue
1764756072 - method and pathValue
POST/events - bodyValue
{"event":"trip.driver_arrived","event_id":"ev_0003","partner_trip_id":"t_9931","pr_trip_id":"pr_55a9","occurred_at":"2026-12-03T10:05:00Z"} - X-PR-SignatureValue
sha256=3eddcf9d07a8ef75f99b16e15e7fe500799eb4dfa028032939f6d93108d1b44b
| Input | Value |
|---|---|
| secret | whsec_test_123 |
| timestamp | 1764756072 |
| method and path | POST /events |
| body | {"event":"trip.driver_arrived","event_id":"ev_0003","partner_trip_id":"t_9931","pr_trip_id":"pr_55a9","occurred_at":"2026-12-03T10:05:00Z"} |
| X-PR-Signature | sha256=3eddcf9d07a8ef75f99b16e15e7fe500799eb4dfa028032939f6d93108d1b44b |
Conventions
- DirectionRuleYou host the endpoints, PerfectRide calls them. You send events to our events URL
- IdempotencyRuleBook and cancel carry
Idempotency-Key. Every event carries a uniqueevent_id - MoneyRuleIntegers in kobo.
650000= ₦6,500. NGN only - TimeRuleISO 8601, UTC
- Events URLRule
https://www.perfectride.io/api/partner/v1/events - Supply URLRule
https://www.perfectride.io/api/partner/v1/supply - BodyRuleJSON, at most 64 KB, with a
Content-Lengthheader (no chunked bodies)
| Item | Rule |
|---|---|
| Direction | You host the endpoints, PerfectRide calls them. You send events to our events URL |
| Idempotency | Book and cancel carry Idempotency-Key. Every event carries a unique event_id |
| Money | Integers in kobo. 650000 = ₦6,500. NGN only |
| Time | ISO 8601, UTC |
| Events URL | https://www.perfectride.io/api/partner/v1/events |
| Supply URL | https://www.perfectride.io/api/partner/v1/supply |
| Body | JSON, at most 64 KB, with a Content-Length header (no chunked bodies) |