Skip to content

Keys and signing

Which key goes where, and how every request is signed in both directions.

Keys

  • API key
    Who makes itPerfectRide (portal for sandbox)
    UseYou send it to us: Authorization: Bearer prk_test_.... Live keys start prk_live_
  • Webhook secret
    Who makes itPerfectRide, with the API key
    UseBoth sides sign with it, one per environment
  • Your API key for us
    Who makes itYou
    UseWe 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

  • timestamp
    ValueThe X-PR-Timestamp value: unix seconds
  • METHOD
    ValueUpper case: POST, GET
  • path
    ValueThe path after the base URL, with the query string: /quotes, /trips/t_9931/cancel, /settlements?date=2026-12-03
  • path, events and supply
    Value/events for events you send us, /supply for supply reports
  • path, our webhooks
    Value/ for events we send to your webhook URL, whatever its path
  • body
    ValueThe 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.

  • secret
    Valuewhsec_test_123
  • timestamp
    Value1764756072
  • method and path
    ValuePOST /events
  • body
    Value{"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
    Valuesha256=3eddcf9d07a8ef75f99b16e15e7fe500799eb4dfa028032939f6d93108d1b44b

Conventions

  • Direction
    RuleYou host the endpoints, PerfectRide calls them. You send events to our events URL
  • Idempotency
    RuleBook and cancel carry Idempotency-Key. Every event carries a unique event_id
  • Money
    RuleIntegers in kobo. 650000 = ₦6,500. NGN only
  • Time
    RuleISO 8601, UTC
  • Events URL
    Rulehttps://www.perfectride.io/api/partner/v1/events
  • Supply URL
    Rulehttps://www.perfectride.io/api/partner/v1/supply
  • Body
    RuleJSON, at most 64 KB, with a Content-Length header (no chunked bodies)

View this page as Markdown · hello@perfectride.io