TrackMe API Docs
Getting started

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:

AudienceAppWhat it does
CustomerFlutter mobile appDiscovery, ordering, reviews, chat, community.
OwnerFlutter mobile app (same binary, type-gated)Truck management, orders, menu, jobs, marketplace listings, paid promotion.
AdminReact + 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:

PrefixAudienceAuth
/api/v1/{trucks/search,categories,currencies}Public discoverynone (anonymous)
/api/v1/auth/*Authentication statenone / Bearer
/api/v1/me/*The caller's own profileBearer (oat_…)
/api/v1/owner/*Truck ownerBearer + active owner membership
/api/v1/admin/*Admin operatorBearer + admin role gate
/api/v1/payments/webhook/*Payment gateway callbacksprovider signature (you never call these)
/t/:tokenShort location-share linknone (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):

CodeMeaning
AUTH_REQUIREDNo / invalid Bearer token.
FORBIDDENAuthenticated but not allowed (e.g. no owner membership).
NOT_FOUNDEntity does not exist or is not visible to you.
VALIDATION_ERRORBad request body / query; often carries a field.
CONFLICTState conflict (e.g. illegal status transition, duplicate).
RATE_LIMITEDSlow down and retry later.
SOCIAL_TOKEN_INVALIDGoogle/Apple token rejected during social login.
INTERNAL_ERRORServer 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.

HeaderEffectDefault
Accept-Language: arArabic error messages, notification copy, and emails.en
X-Timezone: Asia/RiyadhIANA 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:

Owner app:

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.

On this page