Example: the API of one site
On this page
- A site gets its own
- Every route
- Shapes every collection shares
- A file
- Rich text
- A list
- Author
- List author items
- Get one author
- The author fields
- Page
- List page items
- Get one page
- The page fields
- The page tree
- Post
- List post items
- Get one post
- The post fields
- Tag
- List tag items
- Get one tag
- The tag fields
- Globals
- The navigation global
- The siteSettings global
- Search
- Where this comes from
A worked example of the content API: every route, parameter and response of a site with 4 public collections (author, page, post, tag), 2 globals (navigation, siteSettings) and a website search. This page is generated from an OpenAPI document when the website is built, so it is exactly what tinyzoo openapi writes for that site. What every site shares (routes, preview, caching, errors) is in the content API reference.
A site gets its own
The collections, fields and filters below belong to this example site. Yours come from your cms.config.ts, and you get the same reference for them in four ways:
/api/openapi.jsonon your site: the OpenAPI 3.1 document, always on (behind the content token when you set one)./api/openapi: the same document as an interactive reference (Scalar), in development, or in production withcms.content.docs: true.tinyzoo openapi: writes the document to a file (openapi.json), for a code generator or a CI step. Without a running site.- The typed client:
tinyzoo clientwritescms-content.tswith the types of every collection below, and@tinyzoo/clientfetches them (the typed client).
Every route
| Method | Path | What it returns |
|---|---|---|
GET | /api/content/author | List author items |
GET | /api/content/author/{slug} | Get one author by id |
GET | /api/content/page | List page items |
GET | /api/content/page/{slug} | Get one page by its address (the chain of address parts, o-nas/tym) or id |
GET | /api/content/post | List post items |
GET | /api/content/post/{slug} | Get one post by slug (falling back to id) |
GET | /api/content/tag | List tag items |
GET | /api/content/tag/{slug} | Get one tag by id |
GET | /api/content/_tree/page | The page tree, for navigation |
GET | /api/content/_global/navigation | Get the navigation global |
GET | /api/content/_global/siteSettings | Get the siteSettings global |
GET | /api/content/_search | Search the website |
Shapes every collection shares
Every item has an id, createdAt and updatedAt; a collection that is translated adds locale, locales and, when its items have addresses, paths. Files and rich text look the same everywhere:
A file
| Field | Type | Notes |
|---|---|---|
id | uuid string | — |
url | uri string | — |
width | integer | may be null |
height | integer | may be null |
alt | string | may be null |
mime | string | — |
focal | { x: integer, y: integer } | may be null |
{
"id": "8f2a6c1e-4b7d-4e19-9a53-0c6d2f81b7a4",
"url": "https://cms.example.com/media/tulips.jpg",
"width": 1600,
"height": 1066,
"alt": "A bunch of tulips on a table",
"mime": "image/jpeg",
"focal": { "x": 50, "y": 40 }
}A gallery is a list of files, each with a caption (string, or null). A relation to another public collection arrives as the nested item (written Author (nested) below) with its plain fields only: no relations, files, galleries, groups, lists or blocks of its own. One to a collection that is not public arrives as { id, title }.
Rich text
Stored as a ProseMirror document: render it with <CmsContent :doc="item.body" /> and never as HTML. A node has a type, and optionally text, content, marks and attrs.
{
"type": "doc",
"content": [
{
"type": "paragraph",
"content": [{ "type": "text", "text": "The text, one paragraph." }]
}
]
}A list
Every list answers with its items, the total number of matches, and the page asked for:
{ "items": ["…"], "total": 1, "page": 1, "limit": 20 }Author
author is a public collection; Author is the shape of one item.
List author items
GET /api/content/author
| Parameter | In | Type | What it does |
|---|---|---|---|
page | query | integer | Min 1, default 1. |
limit | query | integer | Min 1, max 100, default 20. |
sort | query | "createdAt" | "updatedAt" | "name" | "position" | Default "createdAt". |
dir | query | "asc" | "desc" | Default "desc". |
q | query | string | Substring match against name. |
Filters, each one a query parameter named after the field. Exact match: name.
| Status | Meaning |
|---|---|
200 | OK |
Example response, /api/content/author?limit=1:
{
"items": [
{
"id": "8f2a6c1e-4b7d-4e19-9a53-0c6d2f81b7a4",
"name": "Ada Lovelace",
"position": 1,
"bio": {
"type": "doc",
"content": [
{
"type": "paragraph",
"content": [{ "type": "text", "text": "The text, one paragraph." }]
}
]
},
"createdAt": "2026-03-14T09:30:00.000Z",
"updatedAt": "2026-03-14T09:30:00.000Z"
}
],
"total": 1,
"page": 1,
"limit": 1
}Get one author
GET /api/content/author/{slug}. Get one author by id.
| Parameter | In | Type | What it does |
|---|---|---|---|
slug | path | string | Required. |
| Status | Meaning |
|---|---|
200 | OK |
404 | Not found or not published |
The answer is { "item": { … } }, the item shaped exactly as in the list above.
The author fields
| Field | Type | Notes |
|---|---|---|
id | uuid string | — |
name | string | — |
position | integer | may be null |
bio | RichTextDoc | may be null |
createdAt | date-time string | — |
updatedAt | date-time string | — |
Page
page is a public collection; Page is the shape of one item.
List page items
GET /api/content/page. Returns only published items.
| Parameter | In | Type | What it does |
|---|---|---|---|
page | query | integer | Min 1, default 1. |
limit | query | integer | Min 1, max 100, default 20. |
sort | query | string | 8 values: createdAt, updatedAt, title, slug, status, … Default "createdAt". |
dir | query | "asc" | "desc" | Default "desc". |
q | query | string | Substring match against title. |
locale | query | "cs" | "en" | Language to serve. Untranslated fields fall back to the default language. Default "cs". |
Filters, each one a query parameter named after the field. Exact match: title, slug, status, parent, metaTitle, metaDescription.
| Status | Meaning |
|---|---|
200 | OK |
Example response, /api/content/page?limit=1&locale=en:
{
"items": [
{
"id": "8f2a6c1e-4b7d-4e19-9a53-0c6d2f81b7a4",
"title": "About us",
"slug": "about-us",
"status": "published",
"sections": [
{
"id": "b7e4a1",
"type": "hero",
"heading": "Example heading",
"lead": "Example lead",
"image": {
"id": "3d9e5b70-1c2a-48f6-b0e7-5a4c9d13e862",
"url": "https://cms.example.com/media/tulips.jpg",
"width": 1600,
"height": 1066,
"alt": "A bunch of tulips on a table",
"mime": "image/jpeg",
"focal": { "x": 50, "y": 40 }
},
"buttonLabel": "Example button label",
"buttonUrl": "Example button url"
}
],
"parent": null,
"position": 1,
"metaTitle": "About us — Example",
"metaDescription": "A short description for search engines.",
"ogImage": {
"id": "c41b8e92-7f05-4d3a-a6c8-12e9b05f7d3c",
"url": "https://cms.example.com/media/tulips.jpg",
"width": 1600,
"height": 1066,
"alt": "A bunch of tulips on a table",
"mime": "image/jpeg",
"focal": { "x": 50, "y": 40 }
},
"createdAt": "2026-03-14T09:30:00.000Z",
"updatedAt": "2026-03-14T09:30:00.000Z",
"locale": "cs",
"locales": ["cs", "en"],
"paths": { "cs": "/blog/ahoj-svete", "en": "/en/blog/hello-world" },
"path": "/blog/hello-world",
"breadcrumbs": [{ "title": "About us", "path": "/blog/hello-world" }]
}
],
"total": 1,
"page": 1,
"limit": 1
}Get one page
GET /api/content/page/{slug}. Get one page by its address (the chain of address parts, o-nas/tym) or id. The key is the chain of address parts from the top of the tree down, as one path segment with the slashes escaped (o-nas%2Ftym), looked up in the language asked for and then in the default one. A page under an unpublished page is not found.
| Parameter | In | Type | What it does |
|---|---|---|---|
slug | path | string | Required. |
locale | query | "cs" | "en" | Language to serve. Untranslated fields fall back to the default language. Default "cs". |
| Status | Meaning |
|---|---|
200 | OK |
404 | Not found or not published |
The answer is { "item": { … } }, the item shaped exactly as in the list above.
The page fields
| Field | Type | Notes |
|---|---|---|
id | uuid string | — |
title | string | — |
slug | string | pattern ^[a-z0-9]+(?:-[a-z0-9]+)*$ |
status | "draft" | "published" | — |
sections | (object | object | object | object | object | object)[] | — |
parent | string | may be null |
position | integer | — |
metaTitle | string | may be null |
metaDescription | string | may be null |
ogImage | CmsMedia | may be null |
createdAt | date-time string | — |
updatedAt | date-time string | — |
locale | "cs" | "en" | The language this item is served in. |
locales | ("cs" | "en")[] | Languages this item exists in. |
paths | object | The item's address in each language it exists in. |
path | string | may be null. The page's address in the language served: its ancestors' address parts and its own (/o-nas/tym), language prefix included. |
breadcrumbs | { title: string, path: string }[] | From the top of the tree down to this page (the page itself last): title and address of each, in the language served. Only live pages. |
The page tree
GET /api/content/_tree/page. Live pages only, top level first, each level in the order editors arranged it. A page under an unpublished page is left out with everything below it.
| Parameter | In | Type | What it does |
|---|---|---|---|
locale | query | "cs" | "en" | Language to serve. Untranslated fields fall back to the default language. Default "cs". |
{
"items": [
{
"id": "8f2a6c1e-4b7d-4e19-9a53-0c6d2f81b7a4",
"title": "About us",
"path": "/o-nas",
"children": [
{
"id": "3d9e5b70-1c2a-48f6-b0e7-5a4c9d13e862",
"title": "The team",
"path": "/o-nas/tym",
"children": []
}
]
}
]
}Post
post is a public collection; Post is the shape of one item.
List post items
GET /api/content/post. Returns only published items.
| Parameter | In | Type | What it does |
|---|---|---|---|
page | query | integer | Min 1, default 1. |
limit | query | integer | Min 1, max 100, default 20. |
sort | query | string | 8 values: createdAt, updatedAt, title, slug, status, … Default "createdAt". |
dir | query | "asc" | "desc" | Default "desc". |
q | query | string | Substring match against title. |
locale | query | "cs" | "en" | Language to serve. Untranslated fields fall back to the default language. Default "cs". |
Filters, each one a query parameter named after the field. Exact match: title, slug, status, author, metaTitle, metaDescription. Date ranges: publishedAt.from, publishedAt.to.
| Status | Meaning |
|---|---|
200 | OK |
Example response, /api/content/post?limit=1&locale=en:
{
"items": [
{
"id": "8f2a6c1e-4b7d-4e19-9a53-0c6d2f81b7a4",
"title": "Hello, world",
"slug": "hello-world",
"status": "published",
"publishedAt": "2026-03-14T09:30:00.000Z",
"hero": {
"id": "3d9e5b70-1c2a-48f6-b0e7-5a4c9d13e862",
"url": "https://cms.example.com/media/tulips.jpg",
"width": 1600,
"height": 1066,
"alt": "A bunch of tulips on a table",
"mime": "image/jpeg",
"focal": { "x": 50, "y": 40 }
},
"author": {
"id": "c41b8e92-7f05-4d3a-a6c8-12e9b05f7d3c",
"name": "Ada Lovelace",
"position": 1,
"bio": {
"type": "doc",
"content": [
{
"type": "paragraph",
"content": [{ "type": "text", "text": "The text, one paragraph." }]
}
]
}
},
"tags": [
{
"id": "5e0a7d34-9b18-4c6f-8d21-f3a6b94c0e57",
"name": "Tutorials",
"slug": "tutorials"
}
],
"body": {
"type": "doc",
"content": [
{
"type": "paragraph",
"content": [{ "type": "text", "text": "The text, one paragraph." }]
}
]
},
"location": { "place": "Example place", "note": "Example note" },
"gallery": [
{
"id": "a7c3f185-2e64-4b90-93d7-6b1e08a4c2f9",
"url": "https://cms.example.com/media/tulips.jpg",
"width": 1600,
"height": 1066,
"alt": "A bunch of tulips on a table",
"mime": "image/jpeg",
"focal": { "x": 50, "y": 40 },
"caption": "Spring at the market"
}
],
"metaTitle": "Hello, world — Example",
"metaDescription": "A short description for search engines.",
"ogImage": {
"id": "8f2a6c1e-4b7d-4e19-9a53-0c6d2f81b7a4",
"url": "https://cms.example.com/media/tulips.jpg",
"width": 1600,
"height": 1066,
"alt": "A bunch of tulips on a table",
"mime": "image/jpeg",
"focal": { "x": 50, "y": 40 }
},
"createdAt": "2026-03-14T09:30:00.000Z",
"updatedAt": "2026-03-14T09:30:00.000Z",
"locale": "cs",
"locales": ["cs", "en"],
"paths": { "cs": "/blog/ahoj-svete", "en": "/en/blog/hello-world" }
}
],
"total": 1,
"page": 1,
"limit": 1
}Get one post
GET /api/content/post/{slug}. Get one post by slug (falling back to id).
| Parameter | In | Type | What it does |
|---|---|---|---|
slug | path | string | Required. |
locale | query | "cs" | "en" | Language to serve. Untranslated fields fall back to the default language. Default "cs". |
| Status | Meaning |
|---|---|
200 | OK |
404 | Not found or not published |
The answer is { "item": { … } }, the item shaped exactly as in the list above.
The post fields
| Field | Type | Notes |
|---|---|---|
id | uuid string | — |
title | string | — |
slug | string | pattern ^[a-z0-9]+(?:-[a-z0-9]+)*$ |
status | "draft" | "published" | — |
publishedAt | date-time string | may be null |
hero | CmsMedia | may be null |
author | Author (nested) | — |
tags | Tag (nested)[] | — |
body | RichTextDoc | — |
location | { place: string, note: string } | may be null |
gallery | CmsGalleryItem[] | — |
metaTitle | string | may be null |
metaDescription | string | may be null |
ogImage | CmsMedia | may be null |
createdAt | date-time string | — |
updatedAt | date-time string | — |
locale | "cs" | "en" | The language this item is served in. |
locales | ("cs" | "en")[] | Languages this item exists in. |
paths | object | The item's address in each language it exists in. |
Tag
tag is a public collection; Tag is the shape of one item.
List tag items
GET /api/content/tag
| Parameter | In | Type | What it does |
|---|---|---|---|
page | query | integer | Min 1, default 1. |
limit | query | integer | Min 1, max 100, default 20. |
sort | query | "createdAt" | "updatedAt" | "name" | "slug" | Default "createdAt". |
dir | query | "asc" | "desc" | Default "desc". |
q | query | string | Substring match against name. |
locale | query | "cs" | "en" | Language to serve. Untranslated fields fall back to the default language. Default "cs". |
Filters, each one a query parameter named after the field. Exact match: name, slug.
| Status | Meaning |
|---|---|
200 | OK |
Example response, /api/content/tag?limit=1&locale=en:
{
"items": [
{
"id": "8f2a6c1e-4b7d-4e19-9a53-0c6d2f81b7a4",
"name": "Tutorials",
"slug": "tutorials",
"createdAt": "2026-03-14T09:30:00.000Z",
"updatedAt": "2026-03-14T09:30:00.000Z",
"locale": "cs",
"locales": ["cs", "en"]
}
],
"total": 1,
"page": 1,
"limit": 1
}Get one tag
GET /api/content/tag/{slug}. Get one tag by id.
| Parameter | In | Type | What it does |
|---|---|---|---|
slug | path | string | Required. |
locale | query | "cs" | "en" | Language to serve. Untranslated fields fall back to the default language. Default "cs". |
| Status | Meaning |
|---|---|
200 | OK |
404 | Not found or not published |
The answer is { "item": { … } }, the item shaped exactly as in the list above.
The tag fields
| Field | Type | Notes |
|---|---|---|
id | uuid string | — |
name | string | — |
slug | string | pattern ^[a-z0-9]+(?:-[a-z0-9]+)*$ |
createdAt | date-time string | — |
updatedAt | date-time string | — |
locale | "cs" | "en" | The language this item is served in. |
locales | ("cs" | "en")[] | Languages this item exists in. |
Globals
A global is one object a site has once (its settings, its navigation). item is null until someone first saves it.
The navigation global
GET /api/content/_global/navigation
| Parameter | In | Type | What it does |
|---|---|---|---|
locale | query | "cs" | "en" | Language to serve. Untranslated fields fall back to the default language. Default "cs". |
| Field | Type | Notes |
|---|---|---|
id | uuid string | — |
main | object[] | — |
footer | object[] | — |
createdAt | date-time string | — |
updatedAt | date-time string | — |
locale | "cs" | "en" | The language this item is served in. |
locales | ("cs" | "en")[] | Languages this item exists in. |
Example response:
{
"item": {
"id": "8f2a6c1e-4b7d-4e19-9a53-0c6d2f81b7a4",
"main": [
{
"id": "b7e4a1",
"type": "link",
"label": "Contact",
"url": "https://example.com",
"newTab": true,
"sub": true
}
],
"footer": [
{
"id": "b7e4a1",
"type": "link",
"label": "Contact",
"url": "https://example.com",
"newTab": true,
"sub": true
}
],
"createdAt": "2026-03-14T09:30:00.000Z",
"updatedAt": "2026-03-14T09:30:00.000Z",
"locale": "cs",
"locales": ["cs", "en"]
}
}The siteSettings global
GET /api/content/_global/siteSettings
| Field | Type | Notes |
|---|---|---|
id | uuid string | — |
siteName | string | — |
tagline | string | may be null |
logo | CmsMedia | may be null |
brandColor | string | may be null |
openingHours | object[] | — |
rules | CmsMedia | may be null |
contact | object | may be null |
metaTitle | string | may be null |
metaDescription | string | may be null |
ogImage | CmsMedia | may be null |
createdAt | date-time string | — |
updatedAt | date-time string | — |
Example response:
{
"item": {
"id": "8f2a6c1e-4b7d-4e19-9a53-0c6d2f81b7a4",
"siteName": "Example site name",
"tagline": "Example tagline",
"logo": {
"id": "3d9e5b70-1c2a-48f6-b0e7-5a4c9d13e862",
"url": "https://cms.example.com/media/tulips.jpg",
"width": 1600,
"height": 1066,
"alt": "A bunch of tulips on a table",
"mime": "image/jpeg",
"focal": { "x": 50, "y": 40 }
},
"brandColor": "Example brand color",
"openingHours": [
{
"id": "b7e4a1",
"type": "item",
"days": "Example days",
"hours": "Example hours"
}
],
"rules": {
"id": "c41b8e92-7f05-4d3a-a6c8-12e9b05f7d3c",
"url": "https://cms.example.com/media/tulips.jpg",
"width": 1600,
"height": 1066,
"alt": "A bunch of tulips on a table",
"mime": "image/jpeg",
"focal": { "x": 50, "y": 40 }
},
"contact": {
"phone": "Example phone",
"email": "ada@example.com",
"address": { "street": "Joštova 10", "city": "Brno", "zip": "Example zip" },
"photo": {
"id": "5e0a7d34-9b18-4c6f-8d21-f3a6b94c0e57",
"url": "https://cms.example.com/media/tulips.jpg",
"width": 1600,
"height": 1066,
"alt": "A bunch of tulips on a table",
"mime": "image/jpeg",
"focal": { "x": 50, "y": 40 }
}
},
"metaTitle": "Hello, world — Example",
"metaDescription": "A short description for search engines.",
"ogImage": {
"id": "a7c3f185-2e64-4b90-93d7-6b1e08a4c2f9",
"url": "https://cms.example.com/media/tulips.jpg",
"width": 1600,
"height": 1066,
"alt": "A bunch of tulips on a table",
"mime": "image/jpeg",
"focal": { "x": 50, "y": 40 }
},
"createdAt": "2026-03-14T09:30:00.000Z",
"updatedAt": "2026-03-14T09:30:00.000Z"
}
}Search
GET /api/content/_search. Published entries of page, post, best matches first. Every word must appear (in any order, accents and case ignored); fewer than two letters return nothing.
| Parameter | In | Type | What it does |
|---|---|---|---|
q | query | string | Required. max 100 characters. |
limit | query | integer | Min 1, max 50, default 10. |
entity | query | string | Only these collections (comma-separated) |
locale | query | "cs" | "en" | Language to search in: only entries translated into it. |
| Status | Meaning |
|---|---|
200 | OK |
429 | Too many searches from this visitor |
| Field | Type | Notes |
|---|---|---|
entity | "page" | "post" | — |
id | uuid string | — |
title | string | — |
titleHighlights | integer[][] | [start, end) character ranges of the words found |
excerpt | string | Text around the first word found; empty when only the title matched |
highlights | integer[][] | [start, end) character ranges of the words found |
path | string | may be null. The entry's address on the website, in the searched language |
locale | string | may be null |
updatedAt | date-time string | — |
Example response, /api/content/_search?q=hello:
{
"query": "hello",
"items": [
{
"entity": "post",
"id": "8f2a6c1e-4b7d-4e19-9a53-0c6d2f81b7a4",
"title": "Hello, world",
"titleHighlights": [[0, 5]],
"excerpt": "The first post.",
"highlights": [[0, 5]],
"path": "/blog/hello-world",
"locale": "en",
"updatedAt": "2026-03-14T09:30:00.000Z"
}
],
"total": 1
}Where this comes from
The document is test/contracts/openapi.playground.json, which the tests keep equal to what buildOpenApiDocument writes for the playground's cms.config.ts. The website's build turns it into this page.
Didn’t find what you need?
Write to us. We’re happy to help, and we’ll add it to the guide.