More
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
unauthorizedStatus401CauseMissing or malformedAuthorization: Bearerkey, or an unknown keyFixSendAuthorization: Bearer prk_test_...(orprk_live_...). Keys stop working when new ones are issuedbad_signatureStatus401CauseX-PR-Signaturedoes not matchtimestamp.POST./events.body(or/supply)FixSign the exact body you send, with the path/eventsor/supplyand the secret for that environmentstale_timestampStatus401CauseX-PR-Timestampmissing or more than 5 minutes from our clockFixSync your clock (NTP). Sign each try again with a fresh timestampinvalid_jsonStatus400CauseBody is not JSONFixSend a JSON object withContent-Type: application/jsoninvalid_eventStatus400CauseA missing or wrong field (the message names it), an unknown event,occurred_atin the future or before we booked the trip, or astop_orderthe trip does not haveFixFix the field named in the message. Do not retry unchangedinvalid_supplyStatus400CauseSupply report: a missing or wrong fieldFixFix the field named in the messageinconsistent_countsStatus422CauseSupply report: online over total, or on trip over onlineFixCount again soon_trip_drivers≤online_drivers≤total_driversunknown_tripStatus404CauseNo trip with thatpr_trip_idfor your accountFixUse thepr_trip_idfrom our booking, with the key of the account that got ittrip_mismatchStatus400Causepartner_trip_iddoes not match thispr_trip_idFixSend thepartner_trip_idyou returned when we bookedwrong_environmentStatus403CauseA live trip sent with a sandbox key, or a sandbox trip with a live keyFixSend live trips withprk_live_and sandbox trips withprk_test_wrong_pinStatus422CauseNot the rider's codeFixAsk the driver to check it with the rider, then sendtrip.startedagain with a newevent_idpin_lockedStatus422Cause5 wrong codes. The trip cannot startFixStop. The rider contacts PerfectRide supportretry_laterStatus409CauseThe event came before the one it follows, or the trip changed while it was appliedFixSend the earlier event first, then retry with backoffcomplete_requiredStatus409CauseA cash trip that has started can't be cancelledFixSendtrip.completedwhen it endscancel_not_allowedStatus409CauseAfter the driver arrived, a cash trip can only be cancelled as a rider no-showFixSendreason: "rider_no_show"fee_not_supportedStatus422CauseCash trips take no cancellation fee in the pilotFixSendcancellation_fee: 0length_requiredStatus411CauseNoContent-Lengthheader (chunked bodies are not accepted)FixSend the body with aContent-Lengthheadertoo_largeStatus413CauseBody over 64 KBFixSend smaller events. Supply reports: at most 50 areas and 500 cellsrate_limitedStatus429CauseOver 1,200 events or 60 supply reports a minute, or many refused keys from one addressFixWait forRetry-After, then retryunavailableStatus503CauseSupply report: we could not store itFixRetry laternot_foundStatus404CauseThe Partner API is not switched on for this environmentFixWrite to hello@perfectride.io
| Code | Status | Cause | Fix |
|---|---|---|---|
unauthorized | 401 | Missing or malformed Authorization: Bearer key, or an unknown key | Send Authorization: Bearer prk_test_... (or prk_live_...). Keys stop working when new ones are issued |
bad_signature | 401 | X-PR-Signature does not match timestamp.POST./events.body (or /supply) | Sign the exact body you send, with the path /events or /supply and the secret for that environment |
stale_timestamp | 401 | X-PR-Timestamp missing or more than 5 minutes from our clock | Sync your clock (NTP). Sign each try again with a fresh timestamp |
invalid_json | 400 | Body is not JSON | Send a JSON object with Content-Type: application/json |
invalid_event | 400 | A 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 | Fix the field named in the message. Do not retry unchanged |
invalid_supply | 400 | Supply report: a missing or wrong field | Fix the field named in the message |
inconsistent_counts | 422 | Supply report: online over total, or on trip over online | Count again so on_trip_drivers ≤ online_drivers ≤ total_drivers |
unknown_trip | 404 | No trip with that pr_trip_id for your account | Use the pr_trip_id from our booking, with the key of the account that got it |
trip_mismatch | 400 | partner_trip_id does not match this pr_trip_id | Send the partner_trip_id you returned when we booked |
wrong_environment | 403 | A live trip sent with a sandbox key, or a sandbox trip with a live key | Send live trips with prk_live_ and sandbox trips with prk_test_ |
wrong_pin | 422 | Not the rider's code | Ask the driver to check it with the rider, then send trip.started again with a new event_id |
pin_locked | 422 | 5 wrong codes. The trip cannot start | Stop. The rider contacts PerfectRide support |
retry_later | 409 | The event came before the one it follows, or the trip changed while it was applied | Send the earlier event first, then retry with backoff |
complete_required | 409 | A cash trip that has started can't be cancelled | Send trip.completed when it ends |
cancel_not_allowed | 409 | After the driver arrived, a cash trip can only be cancelled as a rider no-show | Send reason: "rider_no_show" |
fee_not_supported | 422 | Cash trips take no cancellation fee in the pilot | Send cancellation_fee: 0 |
length_required | 411 | No Content-Length header (chunked bodies are not accepted) | Send the body with a Content-Length header |
too_large | 413 | Body over 64 KB | Send smaller events. Supply reports: at most 50 areas and 500 cells |
rate_limited | 429 | Over 1,200 events or 60 supply reports a minute, or many refused keys from one address | Wait for Retry-After, then retry |
unavailable | 503 | Supply report: we could not store it | Retry later |
not_found | 404 | The Partner API is not switched on for this environment | Write 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.
timeoutCauseNo answer within 2 seconds (quotes) or 8 seconds (other calls)FixAnswer faster. Queue slow worknetworkCauseWe could not connect, or the host resolves to a private addressFixUse a public HTTPS host that answers without redirectsbad_base_urlCauseYour base URL is not httpsFixSave an https URL in the portalbad_responseCauseA 2xx whose body does not match the spechttp_<status>CauseA non-2xx without an error bodyFixAnswer with{ "error": { "code", "message" } }, or fix the failure- Your own codeCauseA non-2xx with your error bodyFixShown as you sent it
| Code | Cause | Fix |
|---|---|---|
timeout | No answer within 2 seconds (quotes) or 8 seconds (other calls) | Answer faster. Queue slow work |
network | We could not connect, or the host resolves to a private address | Use a public HTTPS host that answers without redirects |
bad_base_url | Your base URL is not https | Save an https URL in the portal |
bad_response | A 2xx whose body does not match the spec | Check the response in API reference |
http_<status> | A non-2xx without an error body | Answer with { "error": { "code", "message" } }, or fix the failure |
| Your own code | A non-2xx with your error body | Shown as you sent it |