TrackMe API Docs
Admin

Surfaces & Auth

How admin routes are split between bearer JSON endpoints and the cookie-authenticated Inertia dashboard.

Admin has two route trees, and they are not interchangeable.

Route families

FamilyPrefixAuthRender/responseWhere documented
Admin JSON API/api/v1/admin/*Authorization: Bearer <oat_...> + requireAdmin()JSON envelopeAPI reference, grouped under Admin tags.
Domain admin JSON API/api/v1/admin/... in domain modulesBearer + requireAdmin() plus per-action abilitiesJSON envelopeAPI reference.
Admin SPA pages/actions/admin/*/admin/login web session + requireAdmin()Inertia HTML/redirectsThis Admin section.
Public admin login/admin/loginAnonymousInertia login page / session mutationThis page.

/admin redirects to /admin/login. After login, page visits and mutations use the web session. The React dashboard does not bridge a Bearer token into useForm; it submits to /admin/* web routes.

Shared Inertia props

Every admin Inertia render receives:

PropMeaning
errorsFlashed validation errors from the previous redirect.
flashSuccess/error toasts and temporary admin-password reveal payloads.
userMinimal admin user: id, fullName, email, roles, isSuperAdmin.
locale / directionen/ar and ltr/rtl.
tFlat admin translation dictionary for the active locale.
navCountsRole-scoped sidebar counts: reports, support, or null when the operator's roles cannot see that queue.

Role names come from active memberships on the authenticated user. The admin shell filters navigation using those roles before the user sees a link, but backend abilities still enforce every action.

JSON API coverage

The generated API reference includes admin JSON for:

DomainExamples
Dashboard and metrics/api/v1/admin/dashboard/snapshot, metrics, user growth, order volume, revenue, queue stats.
Users and operators/api/v1/admin/users, user detail/activity, suspend/anonymize/restore, clear OTP, /api/v1/admin/admins.
Content and opscountries, cities, categories, FAQs, legal documents, about content, announcements, settings, activity log, security events.
Moderationreports, reviews, food trucks, menu moderation, jobs, marketplace listings and ads.
Commercepricing, payment orders, invoices, refunds, cancellations, financial reports, orders.
Supportsupport tickets, ticket detail, replies, status updates.

The /admin/* HTML routes are excluded from OpenAPI by app/lib/openapi/bootstrap.ts; use Pages & actions for those.

Countries and cities have dedicated CRUD pages at /admin/countries and /admin/cities, with matching JSON CRUD at /api/v1/admin/countries and /api/v1/admin/cities. Super admins, admins and content managers can edit bilingual names, activation, and display order. Cities can be filtered by countryCode; their value is the canonical registration and community-room identifier. Deactivating a country hides all its cities from the public catalog. Catalog edits immediately affect /api/v1/locations/*; rooms derive from active catalog entries. Renaming a country code or city value preserves existing profile and post references.

Admin-only helpers

The SPA also has cookie-authenticated helper routes:

RoutePurpose
GET /admin/lookups/trucksAsync-select truck search for admin forms.
GET /admin/lookups/usersAsync-select user search for admin forms.
POST /admin/uploadsAdmin file upload mirror used by dashboard forms.

These helpers are not normal mobile APIs. They exist for the React dashboard.

On this page