API Docs
Build SACCO-safe integrations for vehicles, trips, passenger payments, fuel approvals, route data, fare tables, revenue visibility, and webhooks.
https://nganyapay.online/api/v1
Authorization: Bearer ngp_sk_...
Authentication
NganyaPay APIs use Stripe-style Bearer authentication with server-side secret keys. Every key is SACCO-scoped and permissioned through API scopes.
Authorization: Bearer ngp_sk_test_xxxxxxxxx
Environments
Test mode
Use test keys for sandbox integrations, API testing, webhook validation, and developer onboarding.
Live mode
Live keys are for production SACCO operations and must be protected carefully.
Quick request
export NGP_API_KEY="ngp_sk_test_xxxxxxxxx"
curl https://nganyapay.online/api/v1/me \
-H "Authorization: Bearer $NGP_API_KEY"
API Endpoints
These endpoints allow SACCO systems, fleet ERPs, finance tools, dashboards, and third-party mobility platforms to integrate with NganyaPay infrastructure.
| Method | Endpoint | Scope | Purpose |
|---|---|---|---|
| GET | /health | active key | API health and environment check |
| GET | /me | active key | Inspect authenticated key, SACCO, environment, and scopes |
| GET | /vehicles | vehicles:read | List SACCO vehicles |
| GET | /vehicles/<id>/status | vehicles:read | Vehicle live status, GPS, driver, conductor, owner, and capacity |
| GET | /vehicles/<id>/active-trip | trips:read | Current active trip and active-trip revenue for one vehicle |
| GET | /trips | trips:read | Trip history, statuses, start/end time, and total collected |
| GET | /revenue/summary | revenue:read | Successful payments count and gross revenue summary |
| GET | /payments | payments:read | Passenger payment records, M-Pesa checkout IDs, result codes, and transaction status |
| GET | /fuel/payments | fuel:read | Fuel requests, owner approvals, and payment status |
| GET | /fuel/payments/<id> | fuel:read | Single fuel payment detail |
| GET | /routes | routes:read | Route catalog for the SACCO |
| GET | /stages | routes:read | Route stages, GPS coordinates, and ordering |
| GET | /fares | fares:read | Fare matrix by route, pickup, destination, and time category |
| GET | /passengers/sessions | passengers:read | Passenger sessions, payment state, receipts, seats, and attempts |
| GET | /webhooks/events | webhooks:read | Webhook event catalog |
| POST | /webhooks/test | webhooks:test | Sandbox webhook test payload validation |
Common Filters
List endpoints support pagination using limit and offset.
Some endpoints support additional filters.
GET /api/v1/payments?status=success&vehicle_id=1&limit=50&offset=0
GET /api/v1/fuel/payments?approval_status=pending&vehicle_id=1
GET /api/v1/stages?route_id=1
GET /api/v1/fares?route_id=1
GET /api/v1/passengers/sessions?trip_id=16&status=paid
Example: Payments
curl https://nganyapay.online/api/v1/payments?status=success \
-H "Authorization: Bearer $NGP_API_KEY"
Example: Fuel Payments
curl https://nganyapay.online/api/v1/fuel/payments \
-H "Authorization: Bearer $NGP_API_KEY"
Example: Webhook Test
curl https://nganyapay.online/api/v1/webhooks/test \
-X POST \
-H "Authorization: Bearer $NGP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"event_type": "payment.success",
"data": {
"vehicle_id": 1,
"amount": "100.00",
"currency": "KES"
}
}'
Webhook Events
payment.successpayment.failedtrip.startedtrip.endedfuel.requestedfuel.approvedfuel.rejectedfuel.confirmedvehicle.status.updatedScopes
vehicles:readtrips:readrevenue:readpayments:readfuel:readroutes:readfares:readpassengers:readwebhooks:readwebhooks:testStandard Response Format
{
"success": true,
"request_id": "req_xxxxx",
"data": [],
"meta": {
"limit": 50,
"offset": 0,
"total": 100,
"has_more": true
}
}
Errors
{
"error": {
"message": "Missing Bearer token",
"status_code": 401
},
"request_id": "req_xxxxx"
}
401— missing, invalid, or revoked API key403— insufficient API key scope404— resource not found or not owned by the SACCO429— rate limit exceeded500— internal API error
Rate limits
- Test keys: 60 requests per minute
- Live keys: 300 requests per minute