Skip to content

Errors

Every error code we return, why, and how to fix it.

Error body, both directions
{ "error": { "code": "bad_signature", "message": "X-PR-Signature does not match timestamp.POST./events.body" } }

Codes we return

  • unauthorized
    Status401
    CauseMissing or malformed Authorization: Bearer key, or an unknown key
    FixSend Authorization: Bearer prk_test_... (or prk_live_...). Keys stop working when new ones are issued
  • bad_signature
    Status401
    CauseX-PR-Signature does not match timestamp.POST./events.body (or /supply)
    FixSign the exact body you send, with the path /events or /supply and the secret for that environment
  • stale_timestamp
    Status401
    CauseX-PR-Timestamp missing or more than 5 minutes from our clock
    FixSync your clock (NTP). Sign each try again with a fresh timestamp
  • invalid_json
    Status400
    CauseBody is not JSON
    FixSend a JSON object with Content-Type: application/json
  • invalid_event
    Status400
    CauseA missing or wrong field (the message names it), an unknown event, occurred_at in the future or before we booked the trip, or a stop_order the trip does not have
    FixFix the field named in the message. Do not retry unchanged
  • invalid_supply
    Status400
    CauseSupply report: a missing or wrong field
    FixFix the field named in the message
  • inconsistent_counts
    Status422
    CauseSupply report: online over total, or on trip over online
    FixCount again so on_trip_drivers ≤ online_drivers ≤ total_drivers
  • unknown_trip
    Status404
    CauseNo trip with that pr_trip_id for your account
    FixUse the pr_trip_id from our booking, with the key of the account that got it
  • trip_mismatch
    Status400
    Causepartner_trip_id does not match this pr_trip_id
    FixSend the partner_trip_id you returned when we booked
  • wrong_environment
    Status403
    CauseA live trip sent with a sandbox key, or a sandbox trip with a live key
    FixSend live trips with prk_live_ and sandbox trips with prk_test_
  • wrong_pin
    Status422
    CauseNot the rider's code
    FixAsk the driver to check it with the rider, then send trip.started again with a new event_id
  • pin_locked
    Status422
    Cause5 wrong codes. The trip cannot start
    FixStop. The rider contacts PerfectRide support
  • retry_later
    Status409
    CauseThe event came before the one it follows, or the trip changed while it was applied
    FixSend the earlier event first, then retry with backoff
  • complete_required
    Status409
    CauseA cash trip that has started can't be cancelled
    FixSend trip.completed when it ends
  • cancel_not_allowed
    Status409
    CauseAfter the driver arrived, a cash trip can only be cancelled as a rider no-show
    FixSend reason: "rider_no_show"
  • fee_not_supported
    Status422
    CauseCash trips take no cancellation fee in the pilot
    FixSend cancellation_fee: 0
  • length_required
    Status411
    CauseNo Content-Length header (chunked bodies are not accepted)
    FixSend the body with a Content-Length header
  • too_large
    Status413
    CauseBody over 64 KB
    FixSend smaller events. Supply reports: at most 50 areas and 500 cells
  • rate_limited
    Status429
    CauseOver 1,200 events or 60 supply reports a minute, or many refused keys from one address
    FixWait for Retry-After, then retry
  • unavailable
    Status503
    CauseSupply report: we could not store it
    FixRetry later
  • not_found
    Status404
    CauseThe Partner API is not switched on for this environment
    FixWrite to hello@perfectride.io
Tip: Retry only 409 retry_later, 429, 5xx and timeouts. Keep the same event_id and sign each try again.

What you answer us

  • A wrong key, signature or timestamp: 401 with the same error body.
  • No driver for a quote: 200 { "available": false }. It is not an error.
  • A repeated Idempotency-Key: the same trip or cancellation, never a new one.

In our test results

When we call you (portal tests, certification and live trips), a failed call shows one of these.

  • timeout
    CauseNo answer within 2 seconds (quotes) or 8 seconds (other calls)
    FixAnswer faster. Queue slow work
  • network
    CauseWe could not connect, or the host resolves to a private address
    FixUse a public HTTPS host that answers without redirects
  • bad_base_url
    CauseYour base URL is not https
    FixSave an https URL in the portal
  • bad_response
    CauseA 2xx whose body does not match the spec
    FixCheck the response in API reference
  • http_<status>
    CauseA non-2xx without an error body
    FixAnswer with { "error": { "code", "message" } }, or fix the failure
  • Your own code
    CauseA non-2xx with your error body
    FixShown as you sent it

View this page as Markdown · hello@perfectride.io