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": []
}
]
}
]
}
Fetch API
Fetch a Tree
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": []
}
]
}
]
}
Fetch a Menu Tree - a hierarchical collection of records assembled from a Data Storage using
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.
parentKey and position defaults, with each node rendered through a Detail Block.
Path Parameters
string
required
Your project’s Fetch token, embedded in the subdomain.
string
required
The tree’s slug, e.g.
<tree-slug>. Per project - see your tree’s detail view in the API Builder.Query Parameters
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).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 honourfs-context, fs-domain, fs-version, and fs-secret (only when the project has fetch keys configured).
Response
The response body wraps the tree in anitems 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.
array
required
The tree’s top-level nodes.
Show Node properties
Show Node properties
string
required
The node’s identifier, taken from the storage record’s primary field.
array
required
Child nodes, same shape as the parent. Empty on leaves.
any
Other fields come from the tree’s Detail Block - they vary per project. The example shown uses a block with
name and a Route field called link.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
| Code | When |
|---|---|
200 | Tree (or subtree) returned |
401 | fs-secret missing or wrong (only when the project has fetch keys configured) |
403 | Project’s plan limit for Fetch API requests exceeded |
404 | Tree slug doesn’t exist, or key doesn’t match a node |