Skip to content

Reading Content

github-actions[bot] edited this page Dec 4, 2026 · 3 revisions

Reading content

OwnCMS keeps the content; your website shows it. The website, its build step or an AI program reads a site's content from /content/<site>/, where <site> is the site's short name in addresses (see Sites).

Only what is published can be read there. Drafts can only be read with a preview key. Archived entries and entries in the bin can never be read there. Nothing about the people who wrote the content is shown.

Addresses

Address What
/content/<site> the site: its languages and content types with their fields (JSON)
/content/<site>/<type> the entries of a content type (JSON), page by page
/content/<site>/<type>/<slug> one entry (JSON)
/content/<site>/<type>/<slug>.md one entry as Markdown, for AI programs and static site generators. The address without .md with Accept: text/markdown gives the same
/content/<site>/media/<id>/<name> an image or file; images also smaller and in web formats with w and format (see [[Media
/content/<site>/llms.txt an overview of everything published, with a link to each entry's Markdown (llms.txt)

Lists

/content/blog/post?lang=en&sort=-published_at&limit=10&filter.category=news&resolve=author

Parameter Meaning
lang values in one language: translatable fields hold the value in that language, or in the default language when it has none. Left out: every language, as {"en": …, "de": …}
sort published_at, created_at, updated_at or slug, with - in front for the highest first. Default: -published_at (the newest first)
limit, offset the page: up to 100 entries (default 20), skipping offset
filter.<field> only entries whose field has this value, or contains it when the field holds a list (choices, references, list). Text, number, yes/no, date, choice, reference and list fields can be filtered by, translatable ones in the language of lang. Filters work on content types with up to 10,000 entries
resolve reference fields, separated by commas, whose entries are put in place of their ids (one level deep). A reference to an entry that cannot be read becomes null, or is left out of a list

The answer is {"entries": […], "total": 42, "limit": 10, "offset": 0}. Every entry has id, type, slug, title, values, created_at and published_at.

A single entry takes lang and resolve. A Markdown entry takes lang, and its references are always resolved to links. Unknown parameters are refused, so a typo doesn't go unnoticed.

Public sites and keys

A site is public unless it is turned off in its settings ("Anyone may read what is published"). Content of a public site can be read without a key.

Keys are made by administrators in the site's settings under Keys for websites. A key is shown only once, when it is made. Send it with each request:

curl -H "Authorization: Bearer ocmr_…" https://cms.example.com/content/blog/post
Key Starts with Reads
Read key ocmr_ what is published; a site that is not public needs one
Preview key ocmp_ the drafts too, for a preview of your website before something is published. Entries then also show their status (draft, changed, published) and updated_at

Keys belong to the site, not to a person: they keep working when the person who made them leaves. Revoke a key that is no longer used or may have leaked; it stops working at once. Keep keys on the server side of your website: anyone who has a key can read with it.

Caching

Answers carry an ETag; a request with If-None-Match gets 304 Not Modified while nothing changed. Public content may be kept by browsers and shared caches (CDNs) for 60 seconds. Content read with a read key is only kept by the client. Previews are never kept.

Any web page may read the content from the browser (CORS). For a site that is not public, a key in browser code is readable by every visitor, so read it from your server instead.

Links in llms.txt and Markdown

Links point at the address OwnCMS is reached at. Set it with -url (OWNCMS_URL, for example https://cms.example.com), see Reference. Without it, the links are made from each request's host name.

Clone this wiki locally