Menu Management (Owner)
Build a bilingual food-truck menu — categories, items, additions, availability schedules — and understand exactly when an item goes publicly live.
This guide is for Flutter engineers wiring up the food-truck owner menu surface: category and item CRUD, additions, recurring availability windows, plus the two public read surfaces customers hit. Every owner call lives under /api/v1/owner/trucks/:truckId/menu/* and needs a Bearer token from an account with an active owner membership that owns the target truck.
Auth header on every owner call:
Authorization: Bearer oat_xxxxxxxxxxxxxxxxxxxxxxxxxThe two public read surfaces — GET /api/v1/trucks/:truckId/menu and GET /api/v1/menu/items/search — take no auth.
There is no publish button, and "created" does not mean "publicly live". A new item is created isAvailable: true and shows up in your owner list immediately — but it only appears on the public customer menu when all of these hold at once: the truck is status: "active", the item is isAvailable: true and not deleted, and its category is isActive: true (or the item has no category). If the truck is not active yet, owner calls still return 201/200 while the public menu shows nothing.
The flow at a glance
Step 1 — Authenticate and pick a truck
Get a Bearer token, then choose a truckId the caller owns. Every menu call is scoped to that truck and gated in this order: active owner membership → truck exists (else 404) → truck.ownerId === caller (else 403).
Step 2 — Create categories
POST /api/v1/owner/trucks/:truckId/menu/categories for each section (Burgers, Sides...). Categories are created isActive: true automatically — there is no isActive field on create. sortOrder controls display order.
Step 3 — Create items
POST /api/v1/owner/trucks/:truckId/menu/items with priceMinor (integer minor units), an optional categoryId (validated against the truck), optional additions[], an optional single photo via fileId, and optional Arabic translations. isAvailable defaults to true.
Step 4 — (Optional) Set an availability schedule
PATCH /api/v1/owner/trucks/:truckId/menu/items/:itemId/availability with stacked day/time windows. Omitting this (or sending rules: []) means the item sells whenever isAvailable is true.
Step 5 — Review and tweak
GET /api/v1/owner/trucks/:truckId/menu/items shows everything including unavailable items. Adjust price, availability, popularity, and photo via PATCH .../items/:itemId. Sending the additions array replaces all additions.
Step 6 — Go live and verify
Once the truck is active and the category is active, the item is live. Verify against the DB-backed public read GET /api/v1/trucks/:truckId/menu (immediate). The search surface GET /api/v1/menu/items/search lags a few seconds while the background worker indexes — do not use it as your "did it save?" check.
Step 7 — Take things down
Toggle isAvailable: false (reversible) or DELETE the item (soft delete, gone). Deleting a category detaches its items to uncategorised — it does not delete them.
Per-step detail
Categories
List categories
GET /api/v1/owner/trucks/trk_01j.../menu/categories
Authorization: Bearer oat_xxx
Accept-Language: enReturns active, non-deleted categories ordered by sortOrder ascending, each with an optional image. Add ?include=translations for a { name: { en, ar } } map.
{
"data": {
"items": [
{
"id": "mct_01jq8zb1a3c5e7g9j1l3n5p7q9",
"truckId": "trk_01j...",
"name": "Burgers",
"sortOrder": 0,
"isActive": true,
"langActual": "en",
"image": null,
"createdAt": "2026-06-21T09:00:00.000Z",
"updatedAt": "2026-06-21T09:00:00.000Z"
}
]
},
"meta": { "requestId": "req_01j..." }
}Create a category
POST /api/v1/owner/trucks/trk_01j.../menu/categories
Authorization: Bearer oat_xxx
Content-Type: application/json
{
"name": "Sides",
"sortOrder": 2,
"translations": { "ar": { "name": "الأطباق الجانبية" } }
}Body: name (required, 1–100), sortOrder (optional, >= 0, default 0), translations.ar.name (optional). The category is created isActive: true — you cannot set isActive on create. The created entity comes back nested under category:
{
"data": {
"category": {
"id": "mct_01j...",
"truckId": "trk_01j...",
"name": "Sides",
"sortOrder": 2,
"isActive": true,
"langActual": "en",
"createdAt": "2026-06-21T09:01:00.000Z",
"updatedAt": "2026-06-21T09:01:00.000Z"
}
},
"meta": { "requestId": "req_01j..." }
}Update a category
PATCH /api/v1/owner/trucks/trk_01j.../menu/categories/mct_01j...
Authorization: Bearer oat_xxx
Content-Type: application/json
{ "name": "Loaded Sides", "sortOrder": 2, "isActive": false }All fields optional: name, sortOrder, isActive, translations.ar.name, and the photo controls fileId (string = set, null = detach, omit = leave) or fileIds (array, max 1).
Setting isActive: false hides the category and every item under it from the public menu — even though those items keep isAvailable: true. The items are not broken; they are suppressed by the parent. Make category visibility obvious in your UI.
Returns 404 if the category is not on this truck.
Delete a category
DELETE /api/v1/owner/trucks/trk_01j.../menu/categories/mct_01j...
Authorization: Bearer oat_xxxSoft-deletes the category. Its items are not deleted — they are detached (categoryId set to null) and kept. Uncategorised items still appear on the public menu, so they stay live.
{ "data": { "success": true }, "meta": { "requestId": "req_01j..." } }Items
List items
GET /api/v1/owner/trucks/trk_01j.../menu/items
Authorization: Bearer oat_xxxOwner view — returns non-deleted items regardless of isAvailable (the public menu hides unavailable ones), ordered by sortOrder, each with additions[] and image.
Admin-moderated (hidden) items are soft-deleted, so they disappear from this owner list too. If an item vanishes with no owner action, it was likely moderated — see Implementation notes.
Create an item
POST /api/v1/owner/trucks/trk_01j.../menu/items
Authorization: Bearer oat_xxx
Content-Type: application/json
{
"categoryId": "mct_01jq8zb1a3c5e7g9j1l3n5p7q9",
"name": "Smash Double",
"description": "Two smashed beef patties, american cheese, house sauce.",
"priceMinor": 3500,
"currencyCode": "SAR",
"prepTimeMinutes": 8,
"isAvailable": true,
"isPopular": true,
"sortOrder": 1,
"additions": [{ "name": "Cheese", "priceMinor": 300, "isAvailable": true }],
"fileId": "fil_01jq8zd1a3c5e7g9j1l3n5p7q9",
"translations": { "ar": { "name": "سماش دبل" } }
}Field rules:
| Field | Required | Notes |
|---|---|---|
name | yes | 1–200 chars |
priceMinor | yes | integer minor units, >= 0 (e.g. 3500 = 35.00 SAR) |
categoryId | no | must belong to this truck, else rejected |
description | no | <= 2000 chars |
currencyCode | no | 3-char, default SAR |
prepTimeMinutes | no | 0–720 |
isAvailable | no | default true |
isPopular | no | default false |
sortOrder | no | default 0 |
additions[] | no | max 50; each needs name + priceMinor; isAvailable defaults true |
fileId / fileIds | no | single photo (fileIds max length 1) |
translations.ar.{name,description} | no | Arabic optional, falls back to English |
Returns 201 with the item nested under item:
{
"data": {
"item": {
"id": "mit_01j...",
"truckId": "trk_01j...",
"categoryId": "mct_01j...",
"name": "Smash Double",
"description": "Two smashed beef patties, american cheese, house sauce.",
"priceMinor": 3500,
"currencyCode": "SAR",
"prepTimeMinutes": 8,
"isAvailable": true,
"isPopular": true,
"sortOrder": 1,
"additions": [
{ "id": "mad_01j...", "name": "Cheese", "priceMinor": 300, "isAvailable": true, "sortOrder": 0 }
],
"langActual": "en",
"image": null,
"createdAt": "2026-06-21T09:05:00.000Z",
"updatedAt": "2026-06-21T09:05:00.000Z"
}
},
"meta": { "requestId": "req_01j..." }
}The item is live-eligible immediately, but only publicly visible once the truck is active and the category is active.
Update an item
PATCH /api/v1/owner/trucks/trk_01j.../menu/items/mit_01j...
Authorization: Bearer oat_xxx
Content-Type: application/json
{
"priceMinor": 3800,
"isAvailable": false,
"additions": [{ "name": "Cheese", "priceMinor": 300, "isAvailable": true }]
}All fields optional and patch-style. Key behaviours:
additionsis replace-all. Sending the array deletes all existing additions and recreates from the payload. Omit the field to leave additions untouched. To keep one, resend it (optionally with itsid); to remove one, omit it from the array.fileId: string = replace photo,null= detach, omit = leave alone (fileIdsbehaves the same, max 1).- Changing
categoryIdre-validates that the category belongs to the truck. isAvailable: falsedrops the item from the public menu and removes it from search.
Returns 404 if the item is not on this truck.
Set the availability schedule
PATCH /api/v1/owner/trucks/trk_01j.../menu/items/mit_01j.../availability
Authorization: Bearer oat_xxx
Content-Type: application/json
{
"rules": [
{ "dayOfWeek": 1, "startMinute": 720, "endMinute": 900 },
{ "dayOfWeek": 1, "startMinute": 1080, "endMinute": 1380 }
]
}rules is an array (max 50 rows). Each row: dayOfWeek 0–6 (Sunday = 0), startMinute 0–1439, endMinute 1–1440 (1440 = midnight next day). Minutes are minute-of-day. Rules stack — the example above encodes a lunch window (12:00–15:00) and a dinner window (18:00–23:00) on Monday as two separate rows.
Pass rules: [] to clear the schedule; the item then sells whenever isAvailable is true. endMinute is exclusive (a window { startMinute: 720, endMinute: 900 } covers 12:00 up to but not including 15:00; 1440 means midnight next day). A 22:00 → 02:00 overnight shift is two rows: one ending at 1440 on day N, one starting at 0 on day N+1.
The schedule is stored, not enforced server-side on the public read. GET /api/v1/trucks/:truckId/menu does not return an isAvailableNow flag and does not hide items whose window is currently closed — it only filters on isAvailable + active category. If you want to grey out an item outside its window, compute it client-side from availabilityRules. The stored rules are not even echoed on the public menu response; only the owner availability PATCH echoes them back.
{
"data": {
"id": "mit_01j...",
"availabilityRules": [
{ "dayOfWeek": 1, "startMinute": 720, "endMinute": 900 },
{ "dayOfWeek": 1, "startMinute": 1080, "endMinute": 1380 }
]
},
"meta": { "requestId": "req_01j..." }
}Delete an item
DELETE /api/v1/owner/trucks/trk_01j.../menu/items/mit_01j...
Authorization: Bearer oat_xxxSoft-deletes the item (sets deletedAt), detaches its image, and enqueues a search-index removal. Gone from every surface. Returns 404 if not on this truck.
{ "data": { "success": true }, "meta": { "requestId": "req_01j..." } }Public reads (no auth)
One truck's live menu (DB-backed, immediate)
GET /api/v1/trucks/trk_01j.../menu
Accept-Language: arReturns only if truck.status === "active" and not deleted (else 404). Includes categories where isActive: true and items where isAvailable: true and (uncategorised or under an active category). Additions are filtered to isAvailable: true. Use this as the owner's own preview — it reflects changes instantly.
Cross-truck item search (Meilisearch, eventually consistent)
GET /api/v1/menu/items/search?q=smash&truckId=trk_01j...&limit=20
Accept-Language: enQuery: q (required, 1–200), truckId (optional scope), limit (optional, 1–50, default 20). Only items with is_available = true on active trucks are indexed. Hydrated entirely from the index — no DB hit.
{
"data": {
"items": [
{
"id": "mit_01j...",
"truckId": "trk_01j...",
"truckName": "Smash Lab",
"name": "Smash Double",
"description": "Two smashed beef patties...",
"priceMinor": 3500,
"isAvailable": true,
"langActual": "en"
}
],
"estimatedTotal": 1
},
"meta": { "requestId": "req_01j..." }
}Search is eventually consistent. A just-created or just-edited item appears here only after the background search worker drains the outbox — a few seconds, not instant. The per-truck read above is immediate.
Item & category lifecycle
State table
| State | Meaning | How you got here | What's allowed next |
|---|---|---|---|
category.isActive = true | Visible on public menu | Default on create | Rename, reorder, set isActive: false, delete |
category.isActive = false | Hidden publicly; its items suppressed too | PATCH category with isActive: false | Set isActive: true to re-show, or delete |
category.deletedAt set | Gone everywhere; items detached to categoryId: null (kept, still live) | DELETE category | — (items live on as uncategorised) |
item.isAvailable = true | Eligible to be live / searchable | Default on create | Edit, schedule, set isAvailable: false, delete |
item.isAvailable = false | Hidden from public menu; removed from search | PATCH item with isAvailable: false | Set isAvailable: true to re-show |
item.deletedAt set (owner) | Gone everywhere; search removal enqueued | DELETE item | — (recreate a new item) |
item.deletedAt set (admin moderation) | Hidden from every surface including the owner's own list | Admin moderation (out of owner's control) | Owner cannot reverse — appeal via support |
| Item live publicly | Customer-visible | truck.status = "active" AND isAvailable = true AND not deleted AND (no category OR category.isActive = true) | Customers can see/order |
Transitions
- (none) → category active:
POST .../menu/categories - category active → category hidden:
PATCH .../menu/categories/:id{ "isActive": false } - category (any) → soft-deleted, items detached:
DELETE .../menu/categories/:id - (none) → item available (owner-visible):
POST .../menu/items - item available → item unavailable:
PATCH .../menu/items/:id{ "isAvailable": false } - item (no schedule) → item with windows:
PATCH .../menu/items/:id/availability - item → soft-deleted:
DELETE .../menu/items/:id - enqueued → indexed in search: background worker drains the search outbox (eventually consistent)
- item visible → hidden by admin: admin moderation only (owner cannot undo)
Implementation Notes
- Created item not visible to customers. Created ≠ live. The item is in your owner list but goes public only when
truck.status = "active"ANDisAvailable = trueAND not deleted AND (uncategorised ORcategory.isActive = true). Most often the truck is not active yet. Fix: activate the truck; verify withGET /api/v1/trucks/:truckId/menu. - "A whole section disappeared from the public menu." You set the category
isActive: false; that suppresses every item under it even though they are stillisAvailable: true. Fix: set the categoryisActive: trueagain. - "Search does not show my new item." Search is eventually consistent via the background indexer. Fix: wait a few seconds, or use the DB-backed
GET /api/v1/trucks/:truckId/menufor an instant check — never use search as your save confirmation. - "My additions got wiped on update." Sending the
additionsarray is replace-all, not merge. Fix: resend every addition you want to keep, or omit theadditionsfield entirely to leave them untouched. - "The photo didn't change / got removed." Photo semantics on
PATCH:fileIdwith a value replaces,fileId: null(orfileIds: []) detaches, omitting the field leaves it. Only one photo per item/category (fileIdsmax 1). Note the field isfileId/fileIds— notimageFileId. - "Price looks 100x off."
priceMinoris integer minor units, not a decimal —3500is 35.00 SAR.currencyCodedefaults toSAR. - Negative price rejected by validation.
priceMinoris validated as>= 0, so a negative value is rejected as a422validation error onpriceMinor— it never reaches the create/update logic. (Additions'priceMinoris validated the same way.) - "I deleted a category and lost all its items." No — deleting a category detaches its items (
categoryId → null) and keeps them live as uncategorised. There is no cascade delete. - "An item vanished and I didn't touch it." An admin can moderate (hide) an item; that reuses the soft-delete column, so it disappears from your owner list too and you cannot restore it. Fix: appeal via support.
- "404 vs 403 confusion." A non-existent truck →
404 NOT_FOUND; a truck you do not own →403 FORBIDDEN; acategoryIdnot on the truck (when creating/updating an item) →404 NOT_FOUNDfor the category lookup. - "My schedule windows behave oddly." Rules stack and use minute-of-day with a 0-based week (Sunday = 0).
startMinute0–1439,endMinute1–1440(1440 = midnight next day).endMinuteis exclusive. Two windows in a day = two rows.rules: []clears the schedule. The public menu does not evaluate these windows for you — there is noisAvailableNowon the public read; gate the UI client-side fromavailabilityRules. - "Arabic is not showing." Locale is header-driven: send
Accept-Language: ar. The server never readsuser.language. Arabic is optional with per-field fallback to English. Add?include=translationsto get the{ field: { en, ar } }map alongside the resolved top-level fields andlangActual.
Related
Team & Staff
How a truck owner invites managers or cashiers, how invitees accept or decline, and how staff rows move through pending, active, declined, and revoked states.
Jobs — Post, Publish, Hire
How truck owners post staffing listings that go live instantly, optionally promote them with a paid term, and hire — and how job-seekers discover, apply to, and track jobs.