API reference
Webhooks we send
Every event PerfectRide sends to your webhook URL, with an example, retries and signing.
Delivery
- MethodRule
POSTto your webhook URL,Content-Type: application/json - SignatureRuleSigned like every call with your webhook secret and path
/, whatever your URL's path - EnvelopeRuleEvery event has
event,event_idandoccurred_at - SuccessRuleAny 2xx within 8 seconds. Redirects are not followed
- RetriesRule30 seconds, then doubling, at most 1 hour apart, for 24 hours
- RepeatsRuleThe
event_idnever changes between retries. Ignore one you have already handled - OrderingRuleNot guaranteed. Use
occurred_atand the current state, not arrival order
| Item | Rule |
|---|---|
| Method | POST to your webhook URL, Content-Type: application/json |
| Signature | Signed like every call with your webhook secret and path /, whatever your URL's path |
| Envelope | Every event has event, event_id and occurred_at |
| Success | Any 2xx within 8 seconds. Redirects are not followed |
| Retries | 30 seconds, then doubling, at most 1 hour apart, for 24 hours |
| Repeats | The event_id never changes between retries. Ignore one you have already handled |
| Ordering | Not guaranteed. Use occurred_at and the current state, not arrival order |
const seen = new Set(); // use your database
app.post("/webhook", express.raw({ type: "application/json" }), (req, res) => {
const raw = req.body.toString("utf8");
// Our webhook calls are signed with path "/", whatever your URL is.
if (!prVerify(process.env.PR_SECRET, "POST", "/", raw, req.headers)) return res.sendStatus(401);
const e = JSON.parse(raw);
if (!seen.has(e.event_id)) {
seen.add(e.event_id);
handle(e); // driver.paused, statement.ready, trip.rider_contact, ...
}
res.sendStatus(200); // any 2xx stops our retries
});Events
trip.rider_contactWhenLive trips, when a driver is assigned, and again on reassignFieldspr_trip_id,partner_trip_id,rider { first_name, phone }driver.pausedWhenPerfectRide paused a driverFieldsdriver_id,reason(rider_complaints, low_ratings, safety_review, documents, other),until(or null)driver.reinstatedWhenThe pause endedFieldsdriver_idpartner.balance_dueWhenYou owe us at the end of a period, or you passed your credit limitFieldsamount_due,currency, thenperiod_startandperiod_end, orreason: "credit_limit"account.status_changedWhenYour account status changedFieldsfrom,to(sandbox, in_review, pilot, live, paused),reason(optional)statement.readyWhenOnce a day, for the day before (WAT)Fieldsdate,trips,amount(what we owe you, kobo),currency
| Event | When | Fields |
|---|---|---|
trip.rider_contact | Live trips, when a driver is assigned, and again on reassign | pr_trip_id, partner_trip_id, rider { first_name, phone } |
driver.paused | PerfectRide paused a driver | driver_id, reason (rider_complaints, low_ratings, safety_review, documents, other), until (or null) |
driver.reinstated | The pause ended | driver_id |
partner.balance_due | You owe us at the end of a period, or you passed your credit limit | amount_due, currency, then period_start and period_end, or reason: "credit_limit" |
account.status_changed | Your account status changed | from, to (sandbox, in_review, pilot, live, paused), reason (optional) |
statement.ready | Once a day, for the day before (WAT) | date, trips, amount (what we owe you, kobo), currency |
Example: trip.rider_contact
Body
{
"event": "trip.rider_contact",
"event_id": "evt_0b6f2c4e-...",
"occurred_at": "2026-12-03T10:01:13Z",
"pr_trip_id": "pr_55a9",
"partner_trip_id": "t_9931",
"rider": { "first_name": "Ada", "phone": "+2348031234521" }
}Example: driver.paused
Body
{
"event": "driver.paused",
"event_id": "evt_6a1e...",
"occurred_at": "2026-12-03T12:00:00Z",
"driver_id": "d_771",
"reason": "rider_complaints",
"until": null
}Example: partner.balance_due
Body
{
"event": "partner.balance_due",
"event_id": "evt_91c3...",
"occurred_at": "2026-12-08T06:00:00Z",
"amount_due": 1250000,
"currency": "NGN",
"period_start": "2026-12-01T00:00:00.000Z",
"period_end": "2026-12-08T00:00:00.000Z"
}Example: account.status_changed
Body
{
"event": "account.status_changed",
"event_id": "evt_2d7a...",
"occurred_at": "2026-12-10T09:00:00Z",
"from": "in_review",
"to": "pilot"
}Example: statement.ready
Body
{
"event": "statement.ready",
"event_id": "evt_7f3a...",
"occurred_at": "2026-12-04T06:00:00Z",
"date": "2026-12-03",
"trips": 38,
"amount": 21450000,
"currency": "NGN"
}Tip: New fields may appear at any time. Ignore ones you don't recognise.