Nano Store - Ecommerce Docs
Developer Resourcesnavigation

Navigation API Reference

Endpoint reference for the admin and storefront navigation menu — contracts, error codes, and integration rules.

Navigation Module — API Reference

Audience: Admin and storefront engineers integrating with the navigation menu.

All endpoints are prefixed with /api. Admin endpoints need a JWT and the listed permission. The storefront endpoint is public and IP-throttled.


Route Surfaces

SurfaceBase PathAuth
Admin/api/admin/navigationJWT + Navigation_READ / Navigation_UPDATE
Storefront (mobile prefix)/api/mobile/navigationNone (@Public()), RATE_LIMITS.PUBLIC_HIGH_FREQUENCY (300 per 60 s per IP)

Endpoint Reference

MethodPathAuthDescription
GET/api/admin/navigationNavigation_READThe stored menu with live targetStatus per row
PUT/api/admin/navigationNavigation_UPDATEReplace the whole menu; requires the last-read version
GET/api/mobile/navigationNoneThe served menu: filtered, with slugs and expanded auto children

Wire Enums

NameValues
NavTargetKindsystem, category, brand, series, url
NavSystemKeyall_products, brands, sale
NavChildrenModenone, auto, manual
NavTargetStatus (admin response only)ok, hidden, deleted, invalid

System default labels: all_products is "All Products", brands is "Brands", sale is "On Sale".


Key Contracts

GET /api/admin/navigation

{
  "message": "Navigation fetched successfully",
  "errorCode": null,
  "data": {
    "version": 1,
    "updatedAt": "2026-10-12T10:00:00.000Z",
    "items": [
      {
        "publicId": "01a12f89-4b69-7bba-b90b-de9c359ee97c",
        "label": null,
        "displayLabel": "All Products",
        "isEnabled": true,
        "targetKind": "system",
        "systemKey": "all_products",
        "categoryPublicId": null,
        "brandPublicId": null,
        "seriesPublicId": null,
        "url": null,
        "childrenMode": "none",
        "children": [],
        "targetName": null,
        "targetStatus": "ok",
        "targetStatusReason": null
      }
    ]
  }
}
  • label is the stored value; displayLabel is label, else the live target name, else the system default.
  • targetName is "Root › Child" for depth-1 categories and "Brand › Series" for series.
  • targetStatusReason is non-null exactly when targetStatus is not ok.
  • children holds stored manual children only. Auto children are not materialised here (every auto row returns children: []).
  • Child rows always have childrenMode: "none".
  • Ids are UUIDv7. Without a token the endpoint answers 401 AUTH_UNAUTHENTICATED.

PUT /api/admin/navigation

Request:

{
  "version": 1,
  "items": [
    {
      "label": null,
      "isEnabled": true,
      "targetKind": "system",
      "systemKey": "all_products",
      "categoryPublicId": null,
      "brandPublicId": null,
      "seriesPublicId": null,
      "url": null,
      "childrenMode": "none",
      "children": []
    },
    {
      "label": "Deals",
      "isEnabled": true,
      "targetKind": "url",
      "systemKey": null,
      "categoryPublicId": null,
      "brandPublicId": null,
      "seriesPublicId": null,
      "url": "/sale",
      "childrenMode": "manual",
      "children": [
        {
          "label": "Clearance",
          "isEnabled": true,
          "targetKind": "url",
          "systemKey": null,
          "categoryPublicId": null,
          "brandPublicId": null,
          "seriesPublicId": null,
          "url": "https://example.com/clearance"
        }
      ]
    }
  ]
}

(The menu must also contain the brands and sale system items; this example is shortened.)

Request rules:

  • version: integer, at least 1.
  • items: 1 to 16 entries. Each item has children of at most 30 entries.
  • Every key is required on every item; use explicit null for unused target fields. A child has no childrenMode and no children key; sending one is rejected.
  • label: null or a string of 1 to 40 characters (after trim and NFC), with no control or format characters. Required for url targets.
  • url: a site-relative path starting with a single /, or an absolute https: URL with no credentials, at most 2048 characters. Absolute URLs are stored in normalised form.
  • childrenMode: "auto" is valid only on brand targets and depth-0 category targets. children must be [] unless childrenMode is manual.
  • Manual children may be category, brand, series or url targets (not system). The global ValidationPipe runs with whitelist: true and forbidNonWhitelisted: true, so any key not declared on the DTO, including the brand and series keys older admin builds sent on category rows, is rejected with a 400.
  • The whole menu has at most 200 rows.

Success: 200 with the same envelope as GET, message "Navigation updated successfully", and the new version (previous plus 1). Item publicIds are new.

409 response (stale version, confirmed live):

{
  "message": "The navigation was saved elsewhere since you loaded it. Reload to see the latest.",
  "errorCode": "NAVIGATION_VERSION_CONFLICT"
}

400 response with rule violations (shape):

{
  "message": "The navigation has 2 problems.",
  "errorCode": "NAVIGATION_TARGET_NOT_FOUND",
  "details": {
    "violations": [
      {
        "path": "items[3]",
        "code": "NAVIGATION_TARGET_NOT_FOUND",
        "message": "..."
      },
      {
        "path": "items[4].children[0]",
        "code": "NAVIGATION_TARGET_INVALID",
        "message": "..."
      }
    ]
  }
}

errorCode is the code of the first violation. path is items[i], items[i].children[j], or items for menu-level rules (missing or duplicate system keys, row limit). A body that fails DTO validation returns the standard validation 400 with no NAVIGATION_* code and no details.violations.

GET /api/mobile/navigation

{
  "message": "Navigation fetched successfully",
  "errorCode": null,
  "data": {
    "items": [
      {
        "id": "01a12f89-4b69-7bba-b90b-de9c359ee97c",
        "label": "All Products",
        "target": {
          "kind": "system",
          "systemKey": "all_products",
          "categorySlug": null,
          "parentCategorySlug": null,
          "brandSlug": null,
          "seriesSlug": null,
          "url": null
        },
        "children": []
      }
    ]
  }
}
  • label is always resolved and never empty.
  • parentCategorySlug is non-null only for depth-1 categories.
  • For a series target, brandSlug is the owning brand.
  • Auto children are materialised, with the target entity's publicId as id. Children have children: [].
  • data.items may be [] if everything is disabled.

Error Reference

CodeHTTPMeaning
NAVIGATION_VERSION_CONFLICT409Saved elsewhere since load; reload and reapply
NAVIGATION_TARGET_INVALID400A shape, label, URL, depth or consistency rule failed
NAVIGATION_TARGET_NOT_FOUND400Referenced category, brand or series is missing, soft-deleted or has no current slug
NAVIGATION_SYSTEM_ITEMS_INVALID400System items missing, duplicated or nested
NAVIGATION_LIMIT_EXCEEDED400More than 200 rows
NAVIGATION_MENU_MISSING500The header menu row is absent (integrity fault; accepted per the frozen contract)
AUTH_UNAUTHENTICATED401Missing or invalid token on an admin route
NAVIGATION_MENU_OVERFLOW500Admin GET, or the PUT's before or after snapshot, found more than 200 rows (integrity fault; message "The menu has more items than the editor can safely load. Contact an engineer.")
SYS_TRANSACTION_CONFLICT409PUT kept hitting serialization failures or deadlocks and the retries were exhausted; retry and keep your edits (the message is "The change conflicted with another update. Please retry.")

Integration Notes

  • Hrefs are the storefront's job. The API returns slugs; the storefront builds /categories/<slug>, /categories/<parent>/<child>, /brands/<brand>, and /brands/<brand>?series=<series>. Category links carry no query string.
  • The storefront groups a dropdown's children by target kind: category children under "Shop by category", brand and series under "Shop by brand", url under "More", in that order, with no headings when only one group is non-empty. The response shape is unchanged.
  • The storefront fetch is cached for 3600 s under the tag navigation only. Menu saves and category, brand and series writes purge it.
  • On any failed read the storefront renders a three-link fallback (All Products, Brands, On Sale).
  • The admin invalidates the storefront after a save with the navigation.changed event; category.changed, brand.changed and brand-series.changed also carry the navigation tag.
  • A role given Navigation_UPDATE also needs Categories_READ, Brands_READ and BrandSeries_READ for the pickers.

Guardrail Summary

  • Always send the version you last read, and adopt the returned version and ids after a save.
  • Never cache the admin read; the targetStatus values are live.
  • Never build a storefront link from a name; use the served slugs.
  • Never nest below two levels or put a system item anywhere but the top level.
  • Treat a validation 400 without a NAVIGATION_* code as a client defect.

See Also