Call the public content API
Read published content with API v1, pagination, locale fallback and headless deployment support.
Call the public content API
Use the public API for an external frontend or content consumer. Published entries require no API key. Draft and archived entries are hidden; edits to a published entry remain private until publication.
Choose identifiers and endpoints
Set QOKIT_API_URL to the API or installation origin, QOKIT_PROJECT_SLUG to the project slug and QOKIT_COLLECTION_KEY to the collection key. These routes use slugs and keys; management routes use resource IDs.
GET /v1/projects/slug/{slug}/cms/collections/{collectionKey}/entries?locale=en&page=1&pageSize=24
GET /v1/projects/slug/{slug}/cms/collections/{collectionKey}/entries/{entrySlug}?locale=en
GET /v1/projects/slug/{slug}/runtime?locale=enRead every page and one entry
Download the client using the setup in Use the Site / CMS API.
import { createSiteApiClient } from './sdk/client.mjs';
const api = createSiteApiClient({ baseUrl: process.env.QOKIT_API_URL });
const projectSlug = process.env.QOKIT_PROJECT_SLUG;
const collectionKey = process.env.QOKIT_COLLECTION_KEY;
const entries = [];
let page = 1;
let result;
do {
result = await api.publicEntries(projectSlug, collectionKey, {
locale: 'en', page, pageSize: 24
});
entries.push(...result.entries);
page++;
} while (page <= result.totalPages);
if (entries.length) {
const detail = await api.publicEntry(projectSlug, collectionKey, entries[0].slug, {
locale: result.locale
});
console.log(detail.entry.title);
}
console.log(entries.length, result.locale, result.localeFallback);Interpret the response
Lists return entries, page, pageSize, total and totalPages; detail responses return entry. Default page size is 24 and maximum is 100. A first-page-only fetch does not return the full collection.
Use the returned locale when linking to entries. localeFallback contains requestedLocale, resolvedLocale and usedFallback. The chain is regional locale, base language, project default, then English. A top-level requestedLocale is deployment-dependent.
Check the host contract for search, category, brand, minPrice, maxPrice, featured and sort; applicability depends on the collection. Validated fieldQuery is a platform extension; independent installations reject it with 400.
Deployment, origins and compatibility
Platform public runtime reads use the published site version. CMS-managed and CMS-only support live public CMS reads; site-only contains static HTML and assets, with no content API. CMS-only has no website renderer. Never put a management key in frontend code.
Existing platform /projects/slug/{slug} routes remain available. Independent /api/content/collections/{collectionKey}/entries routes remain available with nested pagination metadata. New integrations use v1 and its OpenAPI contract.
For missing published content, handle 404; invalid filters return 400. For 429, respect Retry-After. Configure allowed frontend origins using the settings described in the management guide.
For authentication, CORS, writes and deployment differences, follow Use the Site / CMS API.
Last updated on