Going Online & Accepting Rides
Phase 1 — driver trip flow. API-level today; the driver app wraps these.
Prerequisites
- A driver account (phone OTP login, same as riders).
- An active vehicle registered to you (status
active— set after document verification; admin verifies in Phase 4).
1. Go online
POST /api/drivers/online
{ "vehicleId": "<your vehicle>", "lat": 12.9750, "lng": 77.6060 }
This sets you online and records your location. You must be online to
receive ride offers. Send periodic location updates while online:
POST /api/drivers/location { "lat": 12.9752, "lng": 77.6061 }
Go offline any time:
POST /api/drivers/offline
2. The trip flow
Once a rider books near you and you're matched, drive the trip through its states. Each call pushes a realtime update to the rider:
| Step | Endpoint | Ride state |
|---|---|---|
| Accept the ride | POST /api/driver/rides/:id/accept |
→ accepted |
| Reached pickup | POST /api/driver/rides/:id/arrive |
→ arrived |
| Start the trip | POST /api/driver/rides/:id/start |
→ in_progress |
| End the trip | POST /api/driver/rides/:id/complete |
→ completed |
| Pass on an offer | POST /api/driver/rides/:id/reject |
(stays open) |
On accept you become on_trip; on complete you return to
online, ready for the next ride. The state machine enforces order — you
can't start a trip you haven't accepted, or complete one twice.
3. Bidding (where enabled)
If the rider booked in bidding mode you can:
POST /api/rides/:id/bids/counter { "amountMinor": "13000" } # propose your fare
POST /api/rides/:id/bids/driver-accept # accept rider's fare
When a fare is agreed the ride is assigned to you at that price.
4. Realtime connection
Connect a Socket.IO client with your access token to receive offers and trip events:
io('https://your-host', { auth: { token: accessToken } })
.on('ride:status', e => /* trip state changes */)
source: docs/driver-guide/going-online.md (ships identically in the product zip)