Skip to main content

Endpoint

PUT /api/menu/:id

Authentication

This endpoint requires authentication and store employee authorization.
Only the owner of the store that owns this menu item can update it. Attempting to update another store’s menu item will result in a 403 Forbidden error.

Request

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

Path parameters

id
string
required
MongoDB ObjectId of the menu item to update

Headers

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

Body parameters

All body parameters are optional. Only include the fields you want to update.
name
string
Name of the menu item. Will be trimmed of whitespace.
price
number
Price of the menu item. Must be a positive number (minimum 0).
description
string
Description of the menu item. Pass empty string or null to clear.
category
string
Category for the menu item. Pass empty string or null to clear.
is_available
boolean
Availability status. Accepts boolean or string “true”/“false”.
image
file
New image file for the menu item. This will replace the existing image.

Response

success
boolean
Indicates if the request was successful
message
string
Human-readable message describing the result
data
object
Contains the updated menu item data
data.menuItem
object
The updated 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
data.menuItem.price
number
Price of the menu item
data.menuItem.image_url
string
URL to the menu item image
data.menuItem.category
string
Category of the menu item
data.menuItem.is_available
boolean
Availability status
data.menuItem.created_at
string
ISO 8601 timestamp of creation
data.menuItem.updated_at
string
ISO 8601 timestamp of last update

Examples

curl -X PUT https://api.campusbite.com/api/menu/507f1f77bcf86cd799439011 \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -F "price=9.99" \
  -F "is_available=true"

Success response (200)

{
  "success": true,
  "message": "Menu item updated successfully.",
  "data": {
    "menuItem": {
      "id": "507f1f77bcf86cd799439011",
      "store_id": "507f191e810c19729de860ea",
      "name": "Premium Burger",
      "description": "The best burger in town",
      "price": 12.99,
      "image_url": "https://api.campusbite.com/uploads/burger-1234567890.jpg",
      "category": "Premium Items",
      "is_available": true,
      "created_at": "2026-03-04T10:30:00.000Z",
      "updated_at": "2026-03-04T11:45:00.000Z"
    }
  }
}

Error responses

404 - Menu item not found

{
  "success": false,
  "message": "Menu item not found."
}

403 - Not authorized

This error occurs when you try to update a menu item that belongs to another store.
{
  "success": false,
  "message": "You are not authorized to update this menu item."
}

401 - Unauthorized

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

Build docs developers (and LLMs) love