Menus API

Admin-managed navigation menus by location (header, footer, sidebar, etc.). Returns the menu items as a nested tree, ready to render in any frontend framework.

GET /api/v1/menus/{location}

Fetch the menu assigned to a location.

curl https://your-site.com/api/v1/menus/header

Standard locations: header, footer, sidebar, mobile. These are conventions, not enforced — you can use any string. The mapping (location → menu_id) is stored in settings under menu_locations.{location}.

Response:

{
  "success": true,
  "message": "Menu retrieved successfully",
  "data": {
    "location": "header",
    "items": [
      {
        "id": 1,
        "label": "Home",
        "url": "/",
        "type": "custom_link",
        "target": "_self",
        "sort_order": 1,
        "children": []
      },
      {
        "id": 2,
        "label": "Blog",
        "url": "/blog",
        "type": "custom_link",
        "target": "_self",
        "sort_order": 2,
        "children": [
          {
            "id": 5,
            "label": "Tutorials",
            "url": "/blog/category/tutorials",
            "type": "custom_link",
            "target": "_self",
            "sort_order": 1,
            "children": []
          }
        ]
      }
    ]
  }
}

Tree Structure

Items are nested by parent_id (0 = root). Children are sorted by sort_order. The API does the tree-building for you — your frontend just renders recursively.

404 When No Menu Assigned

If a location has no menu assigned in settings, the API returns:

{
  "success": false,
  "message": "No menu assigned to location: header",
  "errors": { "code": "NOT_FOUND" }
}

This is intentional. It lets your frontend fall back to a hard-coded menu (or hide the nav entirely) rather than rendering an empty container.

Caching

Menu responses are cached for 10 minutes per location. Admins editing menus invalidate the cache automatically. If you need real-time menu updates in a frontend, subscribe to webhooks for menu change events (coming in a future release).

Admin Endpoints

Menu CRUD admin endpoints are not yet exposed in v1. Edit menus through the admin UI at /admin/menus. Programmatic menu management lands in v1.2.