Headless CMS (Integrate)
Pull your content into any frontend with the content API and SDKs.
Admins
- Use SleekSite as a headless CMS: pull your content into any frontend
Site token & the content API#
- Site token (
pub-…): reveal and copy at the top of Integrate - Send it as the
Authorizationheader
curl -H "Authorization: SITE_TOKEN" "https://<content-api-host>/<site>/latest"
- Copy the exact URL from the Playground.
Playground#
- Search (JMESPath): query the content, e.g.
pages[?featured==`true`] - Meta data: each record carries extra info (schema name, record id,
updated_at…); filter to fetch only what you need - Environment picker (
latestby default), Reload - Live JSON response:
entries,pages,images,options
- Site token: reveal and copy
- Playground · Node · React · Next
- Query with JMESPath
- Meta data: fetch only what you need
- Environment (latest by default)
- The request, ready to copy
- Live JSON: entries, pages, images, options
Node: @sleekcms/client#
- Works with any Node.js framework (Express, Fastify, Hono, serverless)
npm install @sleekcms/client
createSyncClient(opts): fetches all content up front; methods are synchronous (best for static site generation)createAsyncClient(opts): fetches on demand; methods are async (best for server rendering)- Methods:
getPage,getPages,getEntry,getSlugs,getImage,getOptions,getContent(jmespath?)
| Option | Description |
|---|---|
siteToken |
Your site token (required) |
env |
Environment name (default latest) |
lang |
Language code for translated content |
cache |
Custom cache adapter (default in-memory) |
cacheMinutes |
Cache expiry |
resolveEnv |
Resolve the environment alias to a version tag |
- Any Node.js framework
- Install
- Sync (static sites) or async (server rendering) client, same methods
React: @sleekcms/react#
- Hooks for client-side rendering (React 18+)
import { SleekCMSProvider } from '@sleekcms/react';
<SleekCMSProvider siteToken="your-site-token"><App /></SleekCMSProvider>
- Install
- Provider at the root, with your site token
Next.js#
- Use the sync client in App Router server components
import { createSyncClient } from '@sleekcms/client';
const client = await createSyncClient({ siteToken: process.env.SLEEKCMS_SITE_TOKEN! });
const posts = client.getPages('/blog'); // no await needed
- Fetch everything once, then read synchronously
Environments#
- An environment is a named pointer to a saved version of your content (e.g.
staging,production) - Anything reading through it gets exactly that version, even while you keep editing
- Deploy content to environment to move it to a newer version
- Add a webhook so your app or build is told each time
- The built-in
latestenvironment always serves the newest content - Add environment: enter a name, then Create
- Add environment
- e.g. staging, production