Skip to main content

Endpoint

POST /api/menu

Authentication

This endpoint requires authentication and store employee authorization.
Only store owners can create menu items. The system automatically associates the menu item with the authenticated user’s store.

Request

This endpoint accepts multipart/form-data for image uploads.

Headers

Authorization
string
required
Bearer token for authentication
Content-Type
string
required
Must be multipart/form-data

Body parameters

name
string
required
Name of the menu item. Will be trimmed of whitespace.
price
number
required
Price of the menu item. Must be a positive number (minimum 0).
description
string
Optional description of the menu item.
category
string
Optional category for the menu item (e.g., “Burgers”, “Drinks”, “Desserts”).
image
file
Optional image file for the menu item. Accepted formats depend on server configuration.

Response

success
boolean
Indicates if the request was successful
message
string
Human-readable message describing the result
data
object
Contains the created menu item data
data.menuItem
object
The created menu item object
data.menuItem.id
string
Unique identifier for the menu item
data.menuItem.store_id
string
ID of the store this item belongs to
data.menuItem.name
string
Name of the menu item
data.menuItem.description
string
Description of the menu item (null if not provided)
data.menuItem.price
number
Price of the menu item
data.menuItem.image_url
string
URL to the menu item image (null if not uploaded)
data.menuItem.category
string
Category of the menu item (null if not provided)
data.menuItem.is_available
boolean
Availability status (defaults to true)
data.menuItem.created_at
string
ISO 8601 timestamp of creation
data.menuItem.updated_at
string
ISO 8601 timestamp of last update

Examples

curl -X POST https://api.campusbite.com/api/menu \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -F "name=Classic Cheeseburger" \
  -F "description=Juicy beef patty with cheddar cheese, lettuce, tomato, and our special sauce" \
  -F "price=8.99" \
  -F "category=Burgers" \
  -F "image=@/path/to/burger.jpg"

Success response (201)

{
  "success": true,
  "message": "Menu item added successfully.",
  "data": {
    "menuItem": {
      "id": "507f1f77bcf86cd799439011",
      "store_id": "507f191e810c19729de860ea",
      "name": "Classic Cheeseburger",
      "description": "Juicy beef patty with cheddar cheese, lettuce, tomato, and our special sauce",
      "price": 8.99,
      "image_url": "https://api.campusbite.com/uploads/burger-1234567890.jpg",
      "category": "Burgers",
      "is_available": true,
      "created_at": "2026-03-04T10:30:00.000Z",
      "updated_at": "2026-03-04T10:30:00.000Z"
    }
  }
}

Error responses

If you don’t own a store, you’ll receive a 404 error.

404 - No store found

{
  "success": false,
  "message": "You do not own a store."
}

401 - Unauthorized

{
  "success": false,
  "message": "Authentication required."
}

403 - Forbidden

{
  "success": false,
  "message": "Insufficient permissions."
}

Build docs developers (and LLMs) love