Everything you need to integrate with or build on the Waste Warriors platform.
The Waste Warriors REST API allows you to manage pickups, process payments, and track recyclers programmatically. All endpoints return JSON and use Laravel Sanctum for authentication.
All protected endpoints require a Bearer token in the Authorization header.
Obtain a token by calling the login endpoint.
{
"phone": "07xxxxxxxxx",
"password": "yourpassword"
}
{
"token": "1|abc123...",
"user": { "id": 1, "name": "James", "role": "producer" }
}
Pass the token on every subsequent request: Authorization: Bearer 1|abc123...
/producer/pickups
/producer/pickups
/producer/pickups/{id}
/producer/pickups/{id}/cancel
/recycler/pickups
/recycler/pickups/{id}/accept
/recycler/pickups/{id}/complete
Payments use M-Pesa STK Push (initiate + poll for status) and B2C for payouts. An in-app wallet is also available for both producers and recyclers.
/mpesa/stk/topup
/mpesa/stk/{checkoutId}/status
/mpesa/withdraw
/wallet/balance
/wallet/transactions
Recyclers push their GPS position; producers poll for the current location. No WebSocket required.
/pickups/{id}/location
/pickups/{id}/location/current
/pickups/{id}/location/trail
| Code | Meaning |
|---|---|
| 400 | Validation error — check the message field for details |
| 401 | Unauthenticated — missing or invalid Bearer token |
| 403 | Forbidden — insufficient role or payment permission disabled |
| 404 | Resource not found |
| 422 | Business logic error (e.g. pickup already accepted) |
| 500 | Server error — contact support with the request ID |