Skip to content

Create a menu

POST
/stores/{storeRef}/menus
curl --request POST \
--url https://apibase.ecomweb.app/api/v1/stores/example/menus \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '{ "name": "Header Navigation", "ref": "header-menu", "menu_items": [ { "label": "Electronics", "parent_id": 1, "entity_type": "category", "entity_id": "123", "custom_url": "https://example.com", "target": "_self", "children": [] } ] }'

Creates a navigation menu, optionally with its items. Items can be nested to any depth through children. The ref must be unique within the store.

Required scopes: write:menus

storeRef
required
string

The store’s ref, as returned by GET /stores.

Media typeapplication/json
object
name
required

Menu name

string
<= 255 characters

Example

Header Navigation
ref
required

Menu reference for code usage (unique per store)

string
<= 100 characters

Example

header-menu
menu_items

Menu items with nested structure

Array<object>
object
label
required

Menu item label

string

Example

Electronics
parent_id

Parent menu item ID for nesting

number
nullable

Example

1
entity_type

Entity type: product, category, collection, blog_post, blog_category, content_page, search, home, orders, profile, custom

string
nullable

Example

category
entity_id

Entity ID (referenced entity)

string
nullable

Example

123
custom_url

Custom URL for external links

string
nullable

Example

https://example.com
target

Link target: _self, _blank, _parent, _top

string
default: _self nullable

Example

_self
children
Array<object> recursive
Media typeapplication/json
object
deleted_at

When the menu was deleted. Always null on menus you can read.

string
nullable
menu_items

The menu’s top-level items, each with its nested children. Present only when items are included in the response.

Array<object>
object
parent_id

ID of the parent item, or null for a top-level item.

number
nullable
entity_type

What the link points at: product, category, collection, blog_post, blog_category, content_page, search, home, orders, profile or custom. Null for a plain URL.

string
nullable
entity_id

ID of the referenced record, as a string. Null when the link has no target record.

string
nullable
entity_slug

Slug of the referenced record. Filled in for product, collection, blog_post, blog_category and content_page links; absent otherwise.

string
nullable
custom_url

URL for external or custom links. Null when the link points at a record.

string
nullable
target

How the link opens: _self, _blank, _parent or _top.

string
nullable
children
Array<object> recursive
description

Description of the referenced record, filled in together with entity_slug.

string
nullable
id
required

Item ID.

number
menu_id
required

ID of the menu the item belongs to.

number
label
required

Text shown for the link.

string
created_at
required

When the item was created, as an ISO 8601 timestamp.

string
updated_at
required

When the item was last updated, as an ISO 8601 timestamp.

string
id
required

Menu ID.

number
name
required

Menu name.

string
ref
required

Reference used to look the menu up, unique within the store, such as header-menu.

string
created_at
required

When the menu was created, as an ISO 8601 timestamp.

string
updated_at
required

When the menu was last updated, as an ISO 8601 timestamp.

string

Example generated

{
"deleted_at": "example",
"menu_items": [
{
"parent_id": 1,
"entity_type": "example",
"entity_id": "example",
"entity_slug": "example",
"custom_url": "example",
"target": "example",
"children": [],
"description": "example",
"id": 1,
"menu_id": 1,
"label": "example",
"created_at": "example",
"updated_at": "example"
}
],
"id": 1,
"name": "example",
"ref": "example",
"created_at": "example",
"updated_at": "example"
}

The request is malformed or failed validation.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

The key is missing, invalid, revoked or expired.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

The key may not do this: a missing scope, a readonly key, a publishable key on a Store API route, or a disallowed origin.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}