> ## Documentation Index
> Fetch the complete documentation index at: https://docs.launchmystore.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Menu

> Update an existing navigation menu

# Update Menu

Updates an existing navigation menu. Only the fields you supply are changed; everything else is left intact. The request body may be sent flat or wrapped in a `menu` object.

## Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PUT "https://api.launchmystore.io/api/v1/menus/a1b2c3d4-0001-4e5f-8a9b-0c1d2e3f4a5b.json" \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Shop",
      "handle": "shop",
      "url": "/collections/all",
      "menuType": "header",
      "menuItemType": "category",
      "order": 1
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.launchmystore.io/api/v1/menus/a1b2c3d4-0001-4e5f-8a9b-0c1d2e3f4a5b.json', {
    method: 'PUT',
    headers: {
      'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: 'Shop',
      handle: 'shop',
      url: '/collections/all',
      menuType: 'header',
      menuItemType: 'category',
      order: 1
    })
  });
  ```
</CodeGroup>

## Path Parameters

<ParamField path="id" type="string" required>
  The unique menu ID (UUID) to update
</ParamField>

## Body Parameters

All parameters are optional. Only provided fields are updated. Fields may be sent flat (as below) or nested under a top-level `menu` object.

<ParamField body="name" type="string">
  Menu name
</ParamField>

<ParamField body="handle" type="string">
  URL-safe handle
</ParamField>

<ParamField body="slug" type="string">
  URL-safe slug
</ParamField>

<ParamField body="url" type="string">
  Destination URL for this menu item
</ParamField>

<ParamField body="menuType" type="string">
  Where the menu is used (e.g. `header`, `footer`)
</ParamField>

<ParamField body="menuItemType" type="string">
  Item resource type (e.g. `page`, `product`, `category`, `customized`)
</ParamField>

<ParamField body="child" type="array">
  Array of nested child menu-item objects (stored as JSON)
</ParamField>

<ParamField body="selected" type="boolean">
  Whether the menu item is enabled
</ParamField>

<ParamField body="depth" type="integer">
  Nesting depth (0 for top level)
</ParamField>

<ParamField body="order" type="integer">
  Sort order within its level
</ParamField>

<ParamField body="parentId" type="string">
  Parent menu ID, or `null` for a top-level item
</ParamField>

<ParamField body="productId" type="string">
  Linked product ID, when `menuItemType` is `product`
</ParamField>

<ParamField body="categoryId" type="string">
  Linked category ID, when `menuItemType` is `category`
</ParamField>

<ParamField body="pageId" type="string">
  Linked page ID, when `menuItemType` is `page`
</ParamField>

## Response

Returns the standard envelope (`status`, `state`, `message`, `data`, `count`, `pagination`) with the updated menu nested under `data.menu`.

## Example Response

```json theme={null}
{
  "status": 200,
  "state": "success",
  "message": null,
  "data": {
    "menu": {
      "menuId": "a1b2c3d4-0001-4e5f-8a9b-0c1d2e3f4a5b",
      "name": "Shop",
      "handle": "shop",
      "slug": "shop",
      "url": "/collections/all",
      "menuType": "header",
      "menuItemType": "category",
      "child": [],
      "selected": true,
      "depth": 0,
      "order": 1,
      "parentId": null,
      "productId": null,
      "categoryId": "c0ffee00-1111-4222-8333-444455556666",
      "pageId": null,
      "createdAt": "2024-01-01T10:00:00.000Z",
      "updatedAt": "2024-03-20T15:30:00.000Z"
    }
  },
  "count": null,
  "pagination": null
}
```

## Error Response

When the menu does not exist, the endpoint returns the standard envelope with an `error` state:

```json theme={null}
{
  "status": 404,
  "state": "error",
  "message": "Menu not found",
  "data": null
}
```

## Notes

* Changing the handle may affect theme templates that reference menus by handle.

## Error Codes

| HTTP Status | Description                               |
| ----------- | ----------------------------------------- |
| `401`       | Invalid or missing access token           |
| `403`       | App doesn't have `write_content` scope    |
| `404`       | Menu with the specified ID does not exist |
