Skip to the page
StackIDEDocs

Docs Content and forms

Content API

Read a site’s CMS from its own code: a read-only JSON API, a key in an environment variable, and TypeScript types generated for your collections.

Markdown Updated December 2, 2026
On this page

The Content API serves one site’s collections and items as JSON, read-only, to a server or a build step. Open the site’s Content API for the address, the keys and Copy .env lines.

Keys

KeyStarts withServes
Productioncml_live_Published items, as last published. Cached for 30 seconds.
Developmentcml_test_Every item as it is being edited, drafts marked draft: true. Never cached.

A development key serves drafts and unapproved edits. Never ship one in a public deployment: the live site reads with a production key.

  1. Create a key

    On the site’s Content API, press Create a key (owners and admins). Name it, pick Production or Development, and choose when it expires.

  2. Copy it once

    The key is shown once. Use Copy .env lines and keep it in the server’s environment, never in code a browser downloads.

  3. Add it to the site

    On Deploys → Environment, Add the content key keeps it as STACKLUMEN_CONTENT_KEY for every build.

STACKLUMEN_CONTENT_URL=https://www.stackide.com/terminal/api/content/v1
STACKLUMEN_CONTENT_KEY=cml_live_…

Reading content

const res = await fetch(`${process.env.STACKLUMEN_CONTENT_URL}/collections/posts?limit=20`, {
  headers: {Authorization: `Bearer ${process.env.STACKLUMEN_CONTENT_KEY}`},
});
if (!res.ok) throw new Error(`Content API ${res.status}`);
const {items, pagination} = await res.json();

Routes

RouteReturns
GET /The site, its languages and time zone, the key’s environment and every collection
GET /collectionsCollections with their fields and item counts
GET /collections/:collectionItems, a page at a time
GET /collections/:collection/items/:itemOne item, by slug or id
GET /typesTypeScript for this site’s collections, with a small client, as plain text
GET /sitesThe sites the key reads
GET /sites/:site/…Any route above, for one named site: how a key for every site reads each one

List parameters

ParameterValues
limit1–100 (default 20)
offset0–20,000
sortposition (the CMS order, the default), slug, or a field key
orderasc or desc
filter.<key>An exact match on a field, ignoring case; up to 10 filters
localeOne of the site’s languages

Types for your collections

GET /types answers TypeScript for this site: a type for every collection and a small client with no dependencies. Fetch it in a build step to keep your types in step with the CMS.

Generate types
curl https://www.stackide.com/terminal/api/content/v1/types \
  -H "Authorization: Bearer $STACKLUMEN_CONTENT_KEY" > src/cms.ts

Plans

Content API keys are free on every site while it is on its staging address. On its own domain, a site needs the Premium site plan for its keys: a key on a site on Basic answers 402, with a sentence that names the plan.

Something here wrong or missing? Tell us · Get help