Get started
Sandbox and test data
Test against PerfectRide before any rider is involved: portal tests, certification trips and fixed scenarios.
Sandbox and live
- The key decides the environment. The events and supply URLs are the same for both.
- Sandbox trips have no rider and no money. Send their events with your
prk_test_key. - An event sent with the wrong key for its trip gets 403
wrong_environment.
Test your API
In the portal, Test your API calls your sandbox the way a real trip does and shows 6 results.
- QuotePasses whenYou answer
POST /quoteswithin 2 seconds, or sayavailable: false - BookPasses when
POST /tripsbooks, and the sameIdempotency-Keyagain returns the same trip - Get tripPasses when
GET /trips/{partner_trip_id}returns that trip - CancelPasses when
POST /trips/{partner_trip_id}/cancelanswers 2xx - Wrong signaturePasses whenYou answer 401
- Old timestampPasses whenA 10-minute-old
X-PR-Timestampgets 401
| Test | Passes when |
|---|---|
| Quote | You answer POST /quotes within 2 seconds, or say available: false |
| Book | POST /trips books, and the same Idempotency-Key again returns the same trip |
| Get trip | GET /trips/{partner_trip_id} returns that trip |
| Cancel | POST /trips/{partner_trip_id}/cancel answers 2xx |
| Wrong signature | You answer 401 |
| Old timestamp | A 10-minute-old X-PR-Timestamp gets 401 |
Sandbox only, public HTTPS hosts only, 10 runs an hour.
Certification trips
Start a run in Certification (5 a day). We book one test trip per scenario. Each shows its pr_trip_id and PIN. Play them, then press check.
- Card tripWhat you doAssign a driver, send a location, arrive. Send
trip.startedwith pin0000(we refuse it), then with the PIN shown. Complete at the quoted price. Optional:trip.rider_rated - Driver cancelsWhat you doAssign a driver, then cancel as the driver (
cancelled_by: driver) - No driversWhat you doSend
trip.no_driver - Rider cancelsWhat you doNothing. We book it twice with the same
Idempotency-Keyand cancel it as the rider - StopsWhat you doOnly when your Max stops is above 0. Assign, arrive, start with the PIN, send
trip.arrived_at_stopthentrip.departed_stopfor eachstop_order, complete at the quoted price
| Scenario | What you do |
|---|---|
| Card trip | Assign a driver, send a location, arrive. Send trip.started with pin 0000 (we refuse it), then with the PIN shown. Complete at the quoted price. Optional: trip.rider_rated |
| Driver cancels | Assign a driver, then cancel as the driver (cancelled_by: driver) |
| No drivers | Send trip.no_driver |
| Rider cancels | Nothing. We book it twice with the same Idempotency-Key and cancel it as the rider |
| Stops | Only when your Max stops is above 0. Assign, arrive, start with the PIN, send trip.arrived_at_stop then trip.departed_stop for each stop_order, complete at the quoted price |
Note: Cash is not part of the sandbox run. PerfectRide switches cash on per partner during the pilot. See Cash trips.
What certification checks
- Quote within 2 seconds, and
available: falsehandledRequiredYes - Trip completedRequiredYes
- Events in the right order.
trip.driver_assignedcarries a validdriver.phoneRequiredYes - Cancel by the rider (we call you) and by the driver (you send it)RequiredYes
trip.no_driverwhen nobody is freeRequiredYes- Duplicate booking returns the same tripRequiredYes
- Signatures and timestamps checked both waysRequiredYes
- Rider code: a wrong code is refused, the right one starts the tripRequiredYes
- Driver counts: a valid
POST /supplywith your sandbox key during the runRequiredYes - Trip with stopsRequiredOnce your Max stops is above 0
- Ratings both waysRequiredOptional
- Settlement report matchesRequiredOptional
| Check | Required |
|---|---|
Quote within 2 seconds, and available: false handled | Yes |
| Trip completed | Yes |
Events in the right order. trip.driver_assigned carries a valid driver.phone | Yes |
| Cancel by the rider (we call you) and by the driver (you send it) | Yes |
trip.no_driver when nobody is free | Yes |
| Duplicate booking returns the same trip | Yes |
| Signatures and timestamps checked both ways | Yes |
| Rider code: a wrong code is refused, the right one starts the trip | Yes |
Driver counts: a valid POST /supply with your sandbox key during the run | Yes |
| Trip with stops | Once your Max stops is above 0 |
| Ratings both ways | Optional |
| Settlement report matches | Optional |
Tools
- UseSend signed events, and call your own endpoints the way we do
- UseA reference partner in one Node file:
run t_1 4821plays a whole trip - Event logUseIn the portal: your last 100 events, accepted or refused, with the reason
| Tool | Use |
|---|---|
| Postman collection | Send signed events, and call your own endpoints the way we do |
| Sample server | A reference partner in one Node file: run t_1 4821 plays a whole trip |
| Event log | In the portal: your last 100 events, accepted or refused, with the reason |
Our reference partner
PerfectRide tests its own side against a mock partner that implements this spec, at https://www.perfectride.io/api/partner-sandbox/mock. Its behaviour follows the pickup address, which is a handy model for your own test switches:
slow: the quote takes 3 seconds (over the 2 second limit)nodriver: 200{ "available": false }broken: 500
It only answers keys PerfectRide wired to it.
Next
- Quickstart: your first tripGet sandbox keys, answer a quote and a booking, send your first signed event and see it in the portal.
- Go-live checklistEverything that must be done before PerfectRide starts your pilot with live riders.
- Trip eventsTell PerfectRide what happens on each trip, in order, and handle our answers.