Appearance
Libraries API
A Library is a named, filterable collection of entries of one schema - think press releases, comments, product cards, or posts. It's the counterpart to the page-tree Documents: a Document is a single composed page built from many different components; a Library is many entries of the same component, with whichever of that schema's fields you declare filterable indexed for querying.
Entries themselves are ordinary Content - the uuid a Library gives you back works unchanged with every existing /content/{uuid} endpoint (submit, approve, promote, schedule, withdraw, versions, etc.). Libraries only add two things on top of that: a place to create an entry without having to know about documents/slots, and a way to list/filter/sort entries that doesn't require scanning every piece of content in the project.
A component can also query a Library directly, so a field renders as a live list of entries rather than being filled in by hand - see Library References. It uses the same filter/sort grammar as List/Filter Entries below.
Create a Library
Endpoint: POST /api/v1/library
Request Body:
| Field | Type | Notes |
|---|---|---|
title | string | Required. |
componentId | uuid | Required. Must be an existing component whose published schema is "type": "object" - a collection of named fields only makes sense for object-shaped entries. |
filterableFields | string[] | Optional. Top-level, scalar (string/integer/number/boolean) property names from that schema. Opt-in, not automatic - only declared fields are indexed and can be used in filter[...]/sort below. |
labelField | string | Optional. A top-level string property that names an entry on one line - used by the admin's entry picker and cached on every field that points at one entry. Omit it and the first string property the schema declares is used. Declare it filterable as well to make that picker searchable. |
Each filterableFields entry is validated and its JSON Schema type snapshotted at this moment - a later change to the component's schema doesn't retroactively redefine it (see "Changing filterable fields" below).
Six names are reserved and are rejected with 422 if you declare them filterable: id, entry_lineage_id, content_id, entry_uuid, created_at, updated_at. A schema property with one of those names is still stored and returned like any other - it just can't be filtered or sorted on.
Example Request:
bash
curl -X POST "https://admin.flatnode.net/api/v1/library" \
-H "Authorization: Bearer your-token-here" \
-H "Content-Type: application/json" \
-d '{
"title": "Press Releases",
"componentId": "660e8400-e29b-41d4-a716-446655440001",
"filterableFields": ["title", "category", "publishedAt"],
"labelField": "title"
}'Response: 201 Created
json
{
"message": "Library created.",
"data": {
"_uuid": "dd0e8400-e29b-41d4-a716-446655440008",
"title": "Press Releases",
"slug": "press-releases",
"component": "660e8400-e29b-41d4-a716-446655440001",
"filterableFields": { "title": "string", "category": "string", "publishedAt": "string" },
"labelField": "title",
"createdAt": "2026-11-01T12:00:00+00:00",
"updatedAt": "2026-11-01T12:00:00+00:00"
}
}Each declared filterable field is indexed as the Library is created, which is what makes filter[...] and sort below real queries rather than a walk over every entry. None of that is addressed directly: the endpoints below are the whole surface.
Get a Library
Endpoint: GET /api/v1/library/{uuid}
bash
curl -X GET "https://admin.flatnode.net/api/v1/library/dd0e8400-e29b-41d4-a716-446655440008" \
-H "Authorization: Bearer your-token-here"Response: 200 OK, same shape as the create response's data.
List Libraries
Endpoint: GET /api/v1/library
Same offset/limit pagination as Documents/Files.
bash
curl -X GET "https://admin.flatnode.net/api/v1/library?offset=1&limit=20" \
-H "Authorization: Bearer your-token-here"Response: 200 OK
json
{
"message": "OK",
"pager": { "results": 3, "paginate": false, "first": 1, "last": 3 },
"data": [ { "_uuid": "dd0e8400-e29b-41d4-a716-446655440008", "title": "Press Releases", "...": "..." } ]
}Update a Library
Endpoint: PATCH /api/v1/library/{uuid} or PUT /api/v1/library/{uuid}
Request Body: title, filterableFields and/or labelField, all optional. labelField accepts null to go back to "the first string property".
json
{
"title": "Press Releases (2026)",
"filterableFields": ["title", "category", "publishedAt", "author"],
"labelField": "title"
}componentId can not be changed after creation - every existing entry is validated against that specific schema, and changing it would orphan that assumption. Create a new Library instead if you need a different shape.
Changing filterable fields
Adding a name to filterableFields makes it filterable from then on - and, for a string, shared across languages from then on (see Filtering): its translations stop being editable and are realigned with the default language on each entry's next sync. Entries that already exist are not re-indexed retroactively: each picks the new field up the next time it is promoted, withdrawn or edited, so until then it is missing from filter[...]/sort results for that field. Removing a name only stops it being usable in filter[...]/sort below - nothing is discarded, so re-adding it later picks up right where it left off.
Response: 200 OK, same shape as Get.
Delete a Library
Endpoint: DELETE /api/v1/library/{uuid}
A library is "in use" if it has entries, or if a field anywhere else still points into it - a libraryQuery querying it, or a libraryEntry holding one of its entries. Either way the delete is refused with 409 unless you pass "confirm": true:
json
{
"message": "This library is still in use - pass \"confirm\": true to delete it anyway. ...",
"data": {
"entryCount": 12,
"referenceCount": 1,
"references": [
{
"field": "releases",
"kind": "libraryQuery",
"componentUuid": "660e8400-e29b-41d4-a716-446655440001",
"componentTitle": "Press Release Teaser",
"documentUuid": "550e8400-e29b-41d4-a716-446655440000",
"documentTitle": "Home"
}
]
}
}references names the field, the component that declares it and the document it sits on, so you can go and change those before deleting - rather than being told only that a number of unnamed things are in the way.
bash
curl -X DELETE "https://admin.flatnode.net/api/v1/library/dd0e8400-e29b-41d4-a716-446655440008?confirm=true" \
-H "Authorization: Bearer your-token-here"Response: 200 OK
json
{
"message": "Library deleted.",
"data": { "entriesWithdrawn": 12, "referencesUnbound": 1, "containerRemoved": false }
}What a confirmed delete does:
- Entries are never hard-deleted - any currently-promoted ones are withdrawn, consistent with how every other content version is handled (nothing is ever destroyed, see Content Versions).
- Referencing fields are unbound, not deleted (
referencesUnbound). Such a field belongs to someone else's page, not to this library, so the page still loads: alibraryQuerykeeps its authored query and renders as an empty list, and alibraryEntryloses its pick and renders asnull(the entries themselves survive, withdrawn, so a pointer left behind would keep resolving content out of a library that no longer exists).kindin the409above says which of the two each one is. Either way the component's schema$refis now dangling, which the next write to that component reports as a422rather than silently dropping the value. - The Library itself goes away, along with everything that made its entries filterable and sortable.
- The container is removed only if the library was empty (
containerRemoved). Creating a library provisions a hiddenLibrary: <title>document plus a one-off container component (see "Create a Library"); for an empty library there is nothing to preserve and both are removed. If the library had entries, they live inside that document, so removing it would hard-delete them - it is kept instead, andcontainerRemovedisfalse.
Create an Entry
Endpoint: POST /api/v1/library/{uuid}/entries
Request Body: { "data": <value> }, matching the library's component schema - same shape as data in Create Content. No DocumentId/ComponentId/position - all implied by the library.
bash
curl -X POST "https://admin.flatnode.net/api/v1/library/dd0e8400-e29b-41d4-a716-446655440008/entries" \
-H "Authorization: Bearer your-token-here" \
-H "Content-Type: application/json" \
-d '{
"data": {
"title": "New Product Line Announced",
"category": "press",
"publishedAt": "2026-11-01T09:00:00Z"
}
}'Response: 201 Created, same shape as Create Content:
json
{
"message": "OK",
"data": {
"_uuid": "770e8400-e29b-41d4-a716-446655440002",
"_entry": "770e8400-e29b-41d4-a716-446655440001",
"_type": "component",
"_component": "660e8400-e29b-41d4-a716-446655440001",
"_value": { "title": "New Product Line Announced", "category": "press", "publishedAt": "2026-11-01T09:00:00Z" }
}
}_entry is the entry's stable identity and _uuid its current version's: every version of one entry shares the first, while the second changes each time a new version is promoted. Hold onto _entry - it is what a field pointing at one entry stores, and what tells you two renders are the same entry.
A new entry starts as a draft, same as any other content - it won't appear in List/Filter Entries below, or anywhere else outside the CMS's own editor, until you POST /content/{uuid}/promote it (see Content Versions). Everything else about its lifecycle - submit/approve/reject/schedule/withdraw/versions - works exactly as documented there; Libraries don't duplicate any of it.
List Entries That Aren't Live
Endpoint: GET /api/v1/library/{uuid}/pending-entries
Entries that exist but have nothing promoted: a draft that was never promoted, or one that was withdrawn again. The listing below cannot return these — it lists what is live, and a draft has never been live while a withdrawn entry no longer is — so without this they existed but could not be found, and therefore could not be promoted either.
Unfiltered and unsorted, because filtering and sorting work off the same live index, and these are precisely the entries missing from it. Takes offset/limit/locale/richtext and uses the same envelope. Each entry is rendered as the editor sees it and carries an extra _status (draft, pending_approval, rejected or withdrawn).
This is an editor's view. To an API token the page is always empty - every entry here is by definition unpublished, and an API token reads only published versions (see Get Content). The response is 200 with an empty data, not 404: the library is yours to read, and "nothing pending" is the honest public answer.
What to do with one depends on _status:
draftorapproved→POST /content/{uuid}/promote.withdrawn→ not promotable. Promotion accepts onlydraftandapproved, so the way back isPOST /content/{uuid}/versions(a clone, which starts as a draft) and then promoting that. The withdrawal stays in the lineage as history rather than being rewritten.pending_approval/rejected→ ordinary workflow states; use the content lifecycle endpoints.
List/Filter Entries
Endpoint: GET /api/v1/library/{uuid}/entries
Only ever returns entries with something currently promoted and within its reveal/conceal window - same visibility rule as fetching a single piece of content. Anything else is invisible here by design; see List Entries That Aren't Live above for reaching those. Same {message, pager, data} envelope and offset/limit pagination as everywhere else, and locale and richtext as on a document read; data entries are the full live content, same shape as Get Content.
Filtering
filter[field][operator]=value - only fields the library actually declared filterable are legal here; anything else is 422. There's no bare ?field=value shorthand (a filterable field happening to be named limit or offset would collide with the pagination params).
| Operator | Meaning | Notes |
|---|---|---|
eq | equals | |
ne | not equals | |
gt | greater than | |
gte | greater than or equal | |
lt | less than | |
lte | less than or equal | |
in | one of a comma-separated list | filter[category][in]=press,blog |
nin | none of a comma-separated list | |
contains | substring match | string fields only - 422 otherwise. Case-sensitive. |
null | filter[field][null]=1 for IS NULL, =0 for IS NOT NULL |
Multiple filter[...] params combine with AND - there's no OR yet.
Filters compare against the default language. Selection runs against one row per entry holding the default language's values, so a query returns the same entries whatever locale it renders in. To keep that honest, a filterable string field holds one value in every language: a translation cannot change it (PATCH /content/{uuid} answers 422 naming the field), and a change on the default-language version is written through to every translation when the entry is next promoted, withdrawn or edited. Choose filterable fields accordingly - categories, keys, slugs, dates and numbers - and leave a title that needs translating out of the list. Full-text search in a language is Solr's job, not contains.
If a filtered listing comes back empty and the value does exist in a translation (an entry translated before this rule, say), the envelope carries a warnings list saying so:
json
{ "message": "OK", "pager": { "results": 0, ... }, "data": [],
"warnings": ["filter[category][eq]=Bavaria matches nothing in the default language (de) but does match 1 in en - filters compare against the default-language value, and a filter field holds one value in every language."] }warnings is absent otherwise.
contains matches anywhere in the value and is backed by a trigram index, which needs at least three non-wildcard characters to be used. One- and two-character needles still match correctly, just without the index behind them.
Sorting
?sort=field (ascending), ?sort=-field (descending, leading -), comma-separated for multiple: ?sort=-publishedAt,title. Same filterable-fields-only restriction as filtering.
Filtering by relation
related[relationUuid]=anchorEntryUuid - narrows the listing to entries linked, through one declared relation, to one anchor entry of the other library in that relation. Works in whichever direction you're listing from: if {uuid} in the URL is the relation's target library, this answers "entries related to this source entry"; if it's the source library, it answers "entries that this target entry is related from" - the same edge, read from either end. 422 if the relation doesn't exist, doesn't involve this library, or the anchor uuid isn't an entry of the other side. Composes with filter[...]/sort on the same request - a relation narrows which entries are eligible, it doesn't replace the rest of the query grammar. Multiple related[...] params combine with AND, same as filter[...].
Example
bash
curl -X GET "https://admin.flatnode.net/api/v1/library/dd0e8400-e29b-41d4-a716-446655440008/entries?filter[category][eq]=press&filter[publishedAt][gte]=2026-01-01&sort=-publishedAt&offset=1&limit=20" \
-H "Authorization: Bearer your-token-here"json
{
"message": "OK",
"pager": { "results": 143, "paginate": true, "first": 1, "last": 20 },
"data": [
{ "_uuid": "770e8400-e29b-41d4-a716-446655440002", "_component": "660e8400-...", "_value": { "title": "...", "category": "press", "publishedAt": "..." } }
]
}Relations between Libraries
A relation is an n-m edge between two libraries - "every Product tagged with this Tag" and "this Product's Tags" are the same relation, read in opposite directions. This is different from a single-entry reference field (libraryEntry, n-1, which a field already does on its own) in that it's indexed and queryable from either side, not just the side holding the picks.
You don't declare a relation - you author the field. Every top-level property on a library's component shaped as an array of libraryEntry picks:
json
{ "type": "array", "items": { "$ref": "https://admin.flatnode.net/api/v1/library-entry/tags#" } }is a relation, and becomes queryable from both sides. There is no create or delete endpoint, and nothing to keep in step by hand: the set of relations a library has is derived from its component's published schema and reconciled whenever that schema is published, or when a library is created over a schema that already has such fields.
That is also why a schema change can't leave the index describing something that no longer exists:
| You change the field | What happens to the relation |
|---|---|
| Add one | A relation appears, and the entries that already hold picks in it are indexed - no need to re-save them. |
| Leave it alone | Nothing. Its uuid is stable, so a stored related[...] handle keeps working across republishes. |
| Rename it | The old relation retires and a new one takes its place, with a new uuid - the uuid is keyed to the field name. See the caveat below. |
| Point it at a different library | The same relation (same uuid) repoints, and its edges are rebuilt against the new target. The old edges go rather than being left pointing into the wrong library. |
| Remove it | The relation retires, and its edges go with it. Content is untouched. |
| Make it a single pick instead of a list | The relation retires: one pick is the n-1 libraryEntry field, which needs no index to be read. |
The rename caveat. Renaming a field does not rewrite entries that already exist. Content is validated and stored against the component version it was created under, and publishing a schema change deliberately never reshapes data already stored under the old shape - so an entry written before the rename still holds the old field, and the renamed relation does not cover it. Entries written afterwards are indexed normally. The relation always describes exactly one schema shape; it never silently mixes two.
A field whose $ref names a library that doesn't exist is skipped, not an error - a schema is allowed to carry a dangling library ref, and the content write path refuses it at the point it matters.
List Relations
Endpoint: GET /api/v1/library/{uuid}/relations
Every relation {uuid} is either side of - a target library sees its incoming relations here too, not only libraries that hold the picks.
Each row carries _uuid (the handle for related[...]), sourceLibrary, targetLibrary and sourceField.
json
{
"message": "OK",
"data": [
{
"_uuid": "ee0e8400-e29b-41d4-a716-446655440009",
"sourceLibrary": "<productsUuid>",
"targetLibrary": "<tagsUuid>",
"sourceField": "tags",
"createdAt": "2026-11-18T12:00:00+00:00",
"updatedAt": "2026-11-18T12:00:00+00:00"
}
]
}Reconciliation runs as a queued job, so a relation appears a moment after the publish that implies it, not during the same request.
Libraries in Search
A Library is indexed in its own right (type: "library"), matched on its title, slug, and declared filterable field names - so press-releases finds it, not just "Press Releases".
Its entries are ordinary Content and are indexed as type: "content" like any other block, searchable by their own text. Such a hit carries library/libraryTitle alongside the usual document/documentTitle; prefer the library ones, because an entry's document is the library's internal container, not somewhere anyone edits it. See Search.