> ## 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.

# Create Menu

> Create a new navigation menu

# Create Menu

Creates a new navigation menu in the store.

## Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.launchmystore.io/api/v1/menus.json" \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "title": "Footer Navigation",
      "handle": "footer",
      "links": [
        {
          "title": "About Us",
          "url": "/pages/about-us",
          "type": "page"
        },
        {
          "title": "Contact",
          "url": "/pages/contact",
          "type": "page"
        },
        {
          "title": "Privacy Policy",
          "url": "/policies/privacy-policy",
          "type": "policy"
        }
      ]
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.launchmystore.io/api/v1/menus.json', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      title: 'Footer Navigation',
      handle: 'footer',
      links: [
        {
          title: 'About Us',
          url: '/pages/about-us',
          type: 'page'
        },
        {
          title: 'Contact',
          url: '/pages/contact',
          type: 'page'
        },
        {
          title: 'Privacy Policy',
          url: '/policies/privacy-policy',
          type: 'policy'
        }
      ]
    })
  });
  ```
</CodeGroup>

## Body Parameters

<ParamField body="title" type="string" required>
  The menu title
</ParamField>

<ParamField body="handle" type="string">
  URL-safe handle. Auto-generated from title if not provided. Common handles include `main-menu`, `footer`, `header`.
</ParamField>

<ParamField body="links" type="array">
  Array of menu links

  <Expandable title="Link Object">
    <ParamField body="title" type="string" required>
      Link title/label
    </ParamField>

    <ParamField body="url" type="string" required>
      Link URL (can be relative or absolute)
    </ParamField>

    <ParamField body="type" type="string" default="http">
      Link type: `http`, `collection`, `product`, `page`, `blog`, `search`, `catalog`, `policy`
    </ParamField>

    <ParamField body="resource_id" type="string">
      ID of linked resource (for collection, product, page, blog types)
    </ParamField>

    <ParamField body="links" type="array">
      Nested child links (same structure). Max 3 levels deep.
    </ParamField>
  </Expandable>
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Whether the request succeeded
</ResponseField>

<ResponseField name="data" type="object">
  The created menu object with all links
</ResponseField>

## Example Response

```json theme={null}
{
  "success": true,
  "data": {
    "id": "menu_new789",
    "title": "Footer Navigation",
    "handle": "footer",
    "links": [
      {
        "id": "link_new001",
        "title": "About Us",
        "url": "/pages/about-us",
        "type": "page",
        "resource_id": null,
        "position": 1,
        "links": []
      },
      {
        "id": "link_new002",
        "title": "Contact",
        "url": "/pages/contact",
        "type": "page",
        "resource_id": null,
        "position": 2,
        "links": []
      },
      {
        "id": "link_new003",
        "title": "Privacy Policy",
        "url": "/policies/privacy-policy",
        "type": "policy",
        "resource_id": null,
        "position": 3,
        "links": []
      }
    ],
    "created_at": "2024-03-20T10:00:00Z",
    "updated_at": "2024-03-20T10:00:00Z"
  }
}
```

## Nested Links Example

Create a menu with dropdown items:

```json theme={null}
{
  "title": "Main Menu",
  "handle": "main-menu",
  "links": [
    {
      "title": "Shop",
      "url": "/collections/all",
      "type": "collection",
      "links": [
        {
          "title": "Men",
          "url": "/collections/men",
          "type": "collection"
        },
        {
          "title": "Women",
          "url": "/collections/women",
          "type": "collection"
        },
        {
          "title": "Sale",
          "url": "/collections/sale",
          "type": "collection"
        }
      ]
    }
  ]
}
```

## Error Codes

| Code               | Description                              |
| ------------------ | ---------------------------------------- |
| `UNAUTHORIZED`     | Invalid or missing access token          |
| `FORBIDDEN`        | App doesn't have `write_content` scope   |
| `VALIDATION_ERROR` | Invalid request body (see error details) |
| `DUPLICATE_HANDLE` | A menu with this handle already exists   |
