API Overview
Base path: /api/v1
Transport: HTTPS. Format: JSON. Authentication: Bearer access token.
All authenticated endpoints use token-based authentication. Sensitive operations require authorization checks independent of frontend visibility.
Domain model
The API mirrors the domain, not a generic dispatch model:
Journey
↓
Ride Request
↓
Match
↓
Compliance
↓
Booking
↓
Journey Execution
↓
Contribution / Rating / AuditThere is deliberately no POST /rides resource. The platform is based on people sharing journeys they are already making, not on dispatching a driver to a demand signal. A rides or trips resource implies a supply-on-demand relationship the product does not have, and naming encourages building one.
Resources
/api/v1
├── auth
├── users
├── drivers
├── vehicles
├── journeys
├── ride-requests
├── matches
├── bookings
├── contributions
├── ratings
├── incidents
├── notifications
├── compliance
├── admin
└── regulatory/admin and /regulatory are privileged namespaces and are never reachable from a consumer client. /regulatory is reserved for the agreed authority interface and remains undefined until that interface is agreed — see Regulatory Model.
Authentication
Authorization: Bearer <access-token>Access token plus refresh token plus a revocable device session.
Access tokens are short-lived and are not stored server-side. Refresh tokens are held as hashes in user_sessions, so POST /auth/logout revokes the session immediately rather than waiting for a token to expire.
Common headers
Authorization: Bearer <token>
Content-Type: application/json
Accept: application/json
X-Request-ID: <uuid>
Idempotency-Key: <uuid>Idempotency
Idempotency-Key is required for state-changing operations where a duplicate request would create a duplicate outcome:
- create journey
- accept match
- create booking
- confirm booking
- start journey
- complete journey
- cancel journey
- create contribution
- emergency
These are exactly the operations where a mobile client retrying on a flaky connection would otherwise double-book a passenger.
Standard response
Single resource:
{ "data": {}, "meta": { "requestId": "req_123" } }Paginated collection:
{
"data": [],
"pagination": { "nextCursor": "cursor", "hasMore": true }
}Standard error
{
"error": {
"code": "JOURNEY_NOT_ELIGIBLE",
"message": "The journey cannot currently accept this request.",
"requestId": "req_123",
"details": []
}
}details is an array. It is always present; it is empty when there is nothing field-level to report.
Error codes
| Code | Meaning |
|---|---|
AUTH_REQUIRED | No credentials supplied |
AUTH_INVALID | Credentials present but invalid or expired |
IDENTITY_NOT_VERIFIED | Identity verification required or expired |
DRIVER_NOT_ELIGIBLE | Driver profile fails a mandatory rule |
VEHICLE_NOT_VERIFIED | Vehicle verification required or expired |
JOURNEY_NOT_FOUND | Journey does not exist or is not visible to the caller |
JOURNEY_NOT_ELIGIBLE | Journey cannot currently accept this request |
JOURNEY_FULL | No seats remain |
NO_MATCH_FOUND | No compatible journey exists |
MATCH_EXPIRED | Offer window elapsed |
BOOKING_NOT_AVAILABLE | Booking cannot be created from this match |
BOOKING_ALREADY_CONFIRMED | Booking already confirmed |
CONTRIBUTION_NOT_AVAILABLE | Contribution disabled or mode not approved by policy |
ACCOUNT_RESTRICTED | Account is restricted, suspended or blocked |
COMPLIANCE_REVIEW_REQUIRED | Held for human review |
COMPLIANCE_BLOCKED | Blocked by a mandatory policy rule |
RATE_LIMITED | Rate limit exceeded |
VALIDATION_ERROR | Request failed validation |
INTERNAL_ERROR | Unexpected server failure |
Compliance decisions are not error codes. A REVIEW outcome is returned as a normal response carrying the decision, not as an error, because the operation succeeded — it was held.
Pagination
Cursor-based:
GET /api/v1/journeys?cursor=<cursor>&limit=20{
"data": [],
"pagination": { "nextCursor": "cursor", "hasMore": true }
}Cursor pagination is used rather than offset pagination because journey and compliance lists grow continuously and offset pagination skips or repeats rows when rows are inserted mid-scroll — which for an auditable list is a correctness problem, not just a UX one.
Versioning
Current: /api/v1. Breaking changes: /api/v2.
The meaning of an existing field must never change silently. Adding an optional field, a new endpoint, or a new enum value that existing clients already tolerate is not a breaking change; renaming, removing, narrowing, or changing the semantics of a field is.
Security
Required controls on every endpoint:
- TLS
- Bearer authentication
- RBAC
- input validation
- rate limiting
- CORS restrictions
- request IDs
- idempotency on material mutations
- audit logging
- sensitive-data encryption
- token rotation
- session revocation
- abuse detection
Role-based access
Administrative roles:
SUPER_ADMIN
COMPLIANCE_ADMIN
SAFETY_ADMIN
SUPPORT_AGENT
ANALYST| Area | Minimum role |
|---|---|
| Compliance rules and events | COMPLIANCE_ADMIN |
| Incidents and emergency review | SAFETY_ADMIN |
| User restrictions, support actions | SUPPORT_AGENT |
| Reporting and analytics | ANALYST |
| Role and policy assignment | SUPER_ADMIN |
Internal risk scores, rule detail and evidence are available only to authorised administrative roles. Ordinary users see only what they need to make a booking decision — never a risk score, never an internal compliance reason code.
Realtime
Live journey state is delivered over WebSocket at /ws/v1/journeys/{journeyId}. See Realtime.
