Overview
What the TrackMe API docs are, the three audiences they serve, the /api/v1 base, and how to navigate between task-based flows and the API reference.
This site is the integration manual for the TrackMe backend — the KSA food-truck platform that serves the customer app, the owner app, and the admin dashboard from one AdonisJS server. The flow guides are written for Flutter mobile engineers; the admin guide covers the React + Inertia operator surface; the API reference is generated from the backend OpenAPI snapshot.
Read this page once, then jump to the flow for whatever screen you are building.
Important integration rule: not every create call has the same lifecycle. Some creates are already live (owner/trucks, owner/jobs, marketplace listings, community posts, support tickets, orders); payment-order creates are pending until the webhook settles; uploads are orphaned until a feature endpoint anchors the fileId. Every flow guide includes the relevant state table so clients can distinguish immediate state changes from asynchronous settlement.
What you are looking at
One backend powers three audiences:
| Audience | App | What it does |
|---|---|---|
| Customer | Flutter mobile app | Discovery, ordering, reviews, chat, community. |
| Owner | Flutter mobile app (same binary, type-gated) | Truck management, orders, menu, jobs, marketplace listings, paid promotion. |
| Admin | React + Inertia SPA at /admin/* plus admin JSON under /api/v1/admin/* | Moderation, support, finance, operators, settings, security, legal/content, and operational analytics. |
The customer and owner apps ship as the same Flutter binary; owner capabilities are gated by an active owner membership on the user, not by a separate app. A user can be both.
Base URL and URL families
Every JSON endpoint lives under /api/v1. Authenticated calls send a Bearer token:
Authorization: Bearer oat_a1b2c3d4...The token is issued by the auth endpoints (/api/v1/auth/register, /api/v1/auth/login, /api/v1/auth/social/{google,apple}, /api/v1/auth/guest) — see Authentication.
URL prefixes tell you what auth a route needs before you read its docs:
| Prefix | Audience | Auth |
|---|---|---|
/api/v1/{trucks/search,categories,currencies} | Public discovery | none (anonymous) |
/api/v1/auth/* | Authentication state | none / Bearer |
/api/v1/me/* | The caller's own profile | Bearer (oat_…) |
/api/v1/owner/* | Truck owner | Bearer + active owner membership |
/api/v1/admin/* | Admin operator | Bearer + admin role gate |
/api/v1/payments/webhook/* | Payment gateway callbacks | provider signature (you never call these) |
/t/:token | Short location-share link | none (single-use token) |
Hitting an /api/v1/owner/* route with a valid token but without an active owner membership returns 403 FORBIDDEN, not 401. If your owner screens 403 unexpectedly, check the membership, not the token.
The response envelope
Every JSON response — success or error — uses one of exactly two shapes. Parse the envelope first, then the payload.
Success:
{
"data": { "id": "truck_01H...", "name": "Falafel Wheels" },
"meta": { "requestId": "req_01J..." }
}Error:
{
"error": {
"code": "VALIDATION_ERROR",
"message": "The name field is required.",
"field": "name"
},
"meta": { "requestId": "req_01J..." }
}Always log meta.requestId — it is the single value the backend team needs to trace a failed call.
Error codes
error.code comes from a fixed set. Branch on code, never on message (the message is localized and changes):
| Code | Meaning |
|---|---|
AUTH_REQUIRED | No / invalid Bearer token. |
FORBIDDEN | Authenticated but not allowed (e.g. no owner membership). |
NOT_FOUND | Entity does not exist or is not visible to you. |
VALIDATION_ERROR | Bad request body / query; often carries a field. |
CONFLICT | State conflict (e.g. illegal status transition, duplicate). |
RATE_LIMITED | Slow down and retry later. |
SOCIAL_TOKEN_INVALID | Google/Apple token rejected during social login. |
INTERNAL_ERROR | Server fault — retry, then report with the requestId. |
The message is already resolved to the request locale (see below); render it directly, or map the code to your own copy.
List pagination
List endpoints (trucks, chat messages, payments, …) are cursor-paginated. The items are in data.items; the cursor lives under meta.pagination:
{
"data": {
"items": [ { "id": "truck_01H..." } ]
},
"meta": {
"requestId": "req_01J...",
"pagination": { "nextCursor": "eyJpZCI6...", "hasMore": true, "limit": 20 }
}
}To fetch the next page, pass the opaque nextCursor back as ?cursor=. Stop when hasMore is false (nextCursor becomes null). Do not parse or construct cursors yourself — they are opaque tokens.
Pagination shape is not uniform across every endpoint. Cursor pagination (meta.pagination) is the dominant list pattern, but some feeds return all rows with a side count instead (e.g. the notification inbox returns data.items plus meta.unreadCount, no cursor). Check the specific endpoint in the API reference for its exact shape rather than assuming.
Localisation and timezone
Two request headers change how the server renders strings back to you. Wire data (IDs, money, timestamps) is unaffected — only human-facing copy.
| Header | Effect | Default |
|---|---|---|
Accept-Language: ar | Arabic error messages, notification copy, and emails. | en |
X-Timezone: Asia/Riyadh | IANA timezone for server-rendered display strings (push copy, email subjects, pretty-printed pickup times). | Asia/Riyadh |
Accept-Language on the first authenticated request is persisted as the user's preferred language — so send it from the start. Timezone resolution order is ?tz= > session > X-Timezone > Accept-Timezone > Asia/Riyadh fallback; mobile clients should send X-Timezone with the device IANA name on every request.
All wire-format timestamps are UTC ISO-8601 with a Z suffix (2026-06-21T08:30:00.000Z). Any datetime you send the server (scheduled pickup, ready-at estimates) must also be UTC. The timezone header never changes the wire format — it only affects strings the server formats for display.
How to navigate
The docs are split into two complementary halves. Use them together:
- Flows (
/docs/flows/*) — task-oriented, end-to-end walkthroughs. Start with the Coverage map, then open the flow for the screen you are building. Each flow gives you the full call sequence, per-step request/response examples, lifecycle state tables where relevant, and implementation notes. Use a flow when building any user-facing screen or state machine. - Admin — the React + Inertia dashboard, role-scoped navigation, dashboard payload, and
/admin/*page/action map. Use this for the operator SPA because those HTML routes are intentionally excluded from OpenAPI. - API reference — the generated, exhaustive JSON endpoint list (every path, method, param, and response schema), including
/api/v1/admin/*. Use it to look up the precise shape of a single endpoint once you know which one you need. Do not try to learn a multi-step flow from the reference — it lists endpoints, not order of operations.
Start with the flow for your screen
Customer app:
- Coverage Map — confirms core flows, monetization, chats, realtime, admin, and API reference coverage.
- Authentication — register, login, social, guest, OTP, password reset. Every other flow needs the token from here.
- Profile — the caller's
/meprofile, preferences, notification settings, avatar. - Discovery & Search — public truck discovery and federated search.
- App & Legal Content — About-app copy, social links, privacy, terms, account deletion, support docs.
- Cart & Checkout — build a single-truck cart and place an order.
- Order Lifecycle — the strict order state machine and tracking screen.
- Payments — payment-gateway flow and saved cards.
- Chat & Realtime — direct messages and live events.
- Notifications & Push — the inbox, push preferences, and FCM/APNs tokens.
- Community · Support · Reports · Uploads.
Owner app:
- Owner Dashboard — the one-round-trip landing screen.
- Truck Management — create, configure, open/close, share location, feature, and restore a truck.
- Team & Staff — invite managers/cashiers, accept or decline invites, change roles, revoke access.
- Menu Management — categories and items.
- Jobs — post jobs and decide on applicants; paid publish/renew is optional promotion.
- Marketplace — equipment/supplies listings, distribution, and ads.
- Paid Services & Invoices · Subscriptions — promotion, featured placement, and billing.
Admin dashboard:
- Admin overview — the two admin route trees and how to choose the guide vs generated reference.
- Surfaces & auth —
/admin/*session routes,/api/v1/admin/*bearer routes, shared Inertia props, and uploads/lookups. - Dashboard & navigation — role scopes, dashboard widgets, realtime refreshes, and sidebar badges.
- Pages & actions — every admin page group and the mutations wired from the React dashboard.
A minimal first call
To prove your client is wired correctly, hit a public endpoint that needs no token:
GET /api/v1/trucks/search?limit=5 HTTP/1.1
Accept-Language: en
X-Timezone: Asia/Riyadh{
"data": { "items": [ { "id": "truck_01H...", "name": "Falafel Wheels" } ] },
"meta": {
"requestId": "req_01J...",
"pagination": { "nextCursor": "eyJpZCI6...", "hasMore": true, "limit": 5 }
}
}Then register a user in Authentication, capture the oat_… token, and send it as Authorization: Bearer … on everything under /api/v1/me/* and /api/v1/owner/*.
Reference-only routes
The generated reference also includes deployment and tooling routes (/health/live, /health/ready, /metrics, /api.json, /api.yaml) and gateway web pages/callbacks (/payments/return, /payments/webhook/paymob). They are not client workflow endpoints: health/OpenAPI routes are for operations and tooling, /payments/return is a display-only gateway return page, and payment webhooks are gateway-to-server only.