API Endpoints

Reference for the HTTP API. Start with the conventions below, then jump to a resource.

Base URL & versioning

All endpoints are prefixed with /api/v1. Paths in the resource docs are written relative to that prefix (e.g. POST /orders means POST /api/v1/orders). Responses are always JSON.

A liveness probe is available at /health.

Authentication

Auth uses bearer tokens. Send the token on every protected request:

Authorization: Bearer {token}

There are two token types:

Token Used by How to get a token
User token customers & drivers Phone OTP (or dev token in non-prod)
Admin token back-office admins POST /admin/auth/login (email + password)

Roles & access

A single user may be a customer, a driver, or both. Protected non-admin routes are further gated by role:

Access Requires
Client-only The user has a client profile / acts as a customer.
Driver-only The user has a driver profile / acts as a cisternero.
Admin-only An authenticated admin, scoped to their assigned cities.

Common errors

Any protected endpoint may return these. They are not repeated in each resource doc.

Status Body When
401 { "error": "Unauthorized" } Missing, invalid, or expired bearer token.
403 { "error": "Forbidden" } Authenticated but not allowed (wrong role/owner).
404 { "error": "<message>" } Route or resource not found.
422 { "error": "ValidationError", "details": { "fieldErrors": { … } } } Request body failed validation.

Validation error shape (422):

{
  "error": "ValidationError",
  "details": {
    "fieldErrors": {
      "phone": ["The phone field format is invalid."]
    }
  }
}

Domain errors are returned by individual endpoints as a machine-readable error code plus an optional human message, with an appropriate status (commonly 409 Conflict):

{ "error": "ActiveOrderExists", "message": "Ya tienes un pedido activo." }

Pagination

List endpoints use one of three shapes (page-based, cursor-based, or flat). See Pagination.

Resources

Every resource is documented; follow a link for its endpoints, request fields, responses, and errors. All resources share the conventions above.

Auth & profile

Resource Description Docs
Auth Phone OTP login, token refresh/logout, me profile endpoints/auth
Addresses Customer saved delivery addresses endpoints/addresses
Device tokens Register/unregister device push tokens endpoints/device-tokens
Notifications Inbox: list, unread count, mark read, delete endpoints/notifications

Customer

Resource Description Docs
Orders Create/track orders, delivery, receipts, history endpoints/orders
Order offers Driver candidacies & counter-offers; client accept/reject endpoints/order-offers
Payments Online charges (Pago Móvil / Sypago) endpoints/payments
Payment methods Available payment integrations endpoints/payment-methods
Payment forms Manual payment instructions endpoints/payment-forms
Ratings Rate a driver after delivery endpoints/ratings
Incidents Raise/track order incidents endpoints/incidents
Chat In-order chat rooms: client ↔ driver and driver ↔ support endpoints/chat
Stations Filling stations directory & comments endpoints/stations
Geocoding Address ↔ coordinates helpers endpoints/geocoding
Exchange rate Current currency rate endpoints/exchange-rate
Wallet Balance, transactions, cash debt endpoints/wallet
Surplus Surplus water listings endpoints/surplus
Solidarity Solidarity fund contributions endpoints/solidarity
WS config WebSocket connection config endpoints/ws-config

Driver

Resource Description Docs
Drivers Online toggle, stats, available orders, driver order history endpoints/drivers
Driver documents KYC document upload & status endpoints/driver-documents
Order support Driver ↔ back-office support room (see Chat) endpoints/chat

Admin (back office)

Resource Description Docs
Admin auth Admin login/logout endpoints/admin-auth
Admin dashboard Operational KPIs endpoints/admin-dashboard
Admin users Manage admin accounts endpoints/admin-users
Admin customers Browse customers & their orders endpoints/admin-customers
Admin drivers Review/manage drivers & KYC endpoints/admin-drivers
Admin vehicles Manage vehicles endpoints/admin-vehicles
Admin orders Browse/intervene on orders endpoints/admin-orders
Admin order reports Detailed, cancellation & operational order reports endpoints/admin-reports-orders
Admin client reports Detailed clients & activity/retention reports endpoints/admin-reports-clients
Admin driver reports Detailed drivers, performance & documentation/KYC reports endpoints/admin-reports-drivers
Admin order support Support queue & per-order support chat endpoints/admin-order-support
Admin payments Payments oversight endpoints/admin-payments
Admin payment forms Manage manual payment forms endpoints/admin-payment-forms
Admin finance Financial reports & payouts endpoints/admin-finance
Admin solidarity fund Solidarity fund administration endpoints/admin-solidarity-fund
Admin incidents Incident resolution endpoints/admin-incidents
Admin stations Manage filling stations endpoints/admin-stations
Admin cities Manage cities endpoints/admin-cities
Admin communities Manage communities endpoints/admin-communities
Admin currencies Manage currencies & rates endpoints/admin-currencies
Admin config Payment-method, solidary & support configuration endpoints/admin-config
Admin settings Platform settings (key/value) endpoints/admin-settings