Skip to main content
GET
/
tree
/
{slug}
curl 'https://fetch-<project-token>.frontic.com/tree/<tree-slug>?key=<starting-node>&depth=2' \
  -H 'fs-context: <context-key>'
{
  "items": [
    {
      "key": "shop",
      "name": "Shop",
      "link": {
        "slug": "shop",
        "path": "/en/shop",
        "url": "<your-shop>/en/shop",
        "href": "https://<your-shop>/en/shop"
      },
      "$items": [
        {
          "key": "women",
          "name": "Women",
          "link": {
            "slug": "shop/women",
            "path": "/en/shop/women",
            "url": "<your-shop>/en/shop/women",
            "href": "https://<your-shop>/en/shop/women"
          },
          "$items": []
        }
      ]
    }
  ]
}

Documentation Index

Fetch the complete documentation index at: https://docs.frontic.com/llms.txt

Use this file to discover all available pages before exploring further.

Fetch a Menu Tree — a hierarchical collection of records assembled from a Data Storage using parentKey and position defaults, with each node rendered through a Detail Block.

Path Parameters

project-token
string
required
Your project’s Fetch token, embedded in the subdomain.
slug
string
required
The tree’s slug, e.g. <tree-slug>. Per project — see your tree’s detail view in the API Builder.

Query Parameters

key
string
Optional starting node. When provided, items contains a single entry — the node with this key, plus its descendants. Without a key, items contains every root-level node (records with no parent).
depth
integer
Optional level limit. Controls how many levels of $items are included. Without it, all levels are returned (subject to the 1,000-node cap).

Headers

See Headers on the overview for the full set. Trees honour fs-context, fs-domain, fs-version, and fs-secret (only when the project has fetch keys configured).

Response

The response body wraps the tree in an items array. When called without a key, this array lists every root-level node (records with no parent); when called with one, it holds only the matching node — still wrapped in a list, for shape consistency with the unkeyed call. Each node’s subtree is carried on its own $items field.
items
array
required
The tree’s top-level nodes.
A single response is capped at 1,000 nodes total. When a level wouldn’t fit within the budget, the entire level is omitted (partial levels are never returned) and a warning is included in the response header.
curl 'https://fetch-<project-token>.frontic.com/tree/<tree-slug>?key=<starting-node>&depth=2' \
  -H 'fs-context: <context-key>'
{
  "items": [
    {
      "key": "shop",
      "name": "Shop",
      "link": {
        "slug": "shop",
        "path": "/en/shop",
        "url": "<your-shop>/en/shop",
        "href": "https://<your-shop>/en/shop"
      },
      "$items": [
        {
          "key": "women",
          "name": "Women",
          "link": {
            "slug": "shop/women",
            "path": "/en/shop/women",
            "url": "<your-shop>/en/shop/women",
            "href": "https://<your-shop>/en/shop/women"
          },
          "$items": []
        }
      ]
    }
  ]
}

Status codes

CodeWhen
200Tree (or subtree) returned
401fs-secret missing or wrong (only when the project has fetch keys configured)
403Project’s plan limit for Fetch API requests exceeded
404Tree slug doesn’t exist, or key doesn’t match a node