Skip to main content
KilnCMS

Headless delivery

Developer APIs

This site publishes its content over two headless API surfaces — GraphQL and JSON:API — plus a rendered-artifact endpoint for full page bodies. Anonymous requests read published content; a bearer token unlocks drafts.

JSON:API

Filterable lists, metadata, relationships, and search over every content type, following the JSON:API specification. Block bodies are not included on this surface — fetch rendered bodies from the artifact endpoint below.

curl -s "https://<this-site>/api/json/posts?sort=-published_at&page[limit]=5"

GraphQL

Typed queries over published content — by-slug lookups, taxonomy, and keyword/semantic search. POST queries to the endpoint below (GET with a ?query= parameter also works). The interactive GraphiQL playground is available in development environments only.

curl -s -X POST "https://<this-site>/gql" \
  -H "Content-Type: application/json" \
  -d '{"query": "{ health }"}'

Authentication

Both surfaces work anonymously and return published content only. To read drafts, exchange editor credentials for a JWT and send it as a bearer token — admin-issued API keys go in the same header.

curl -s -X POST "https://<this-site>/api/auth/sign_in" \
  -H "Content-Type: application/json" \
  -d '{"email": "[email protected]", "password": "…"}'

curl -s "https://<this-site>/api/json/posts" -H "Authorization: Bearer <token>"

A bearer token widens reads and search to include drafts. Delivery sites attaching a service key should use the published-only routes (the /published twins) so drafts can never leak.

More surfaces

  • GET /api/content/:type/:slug — the rendered artifact: full block body, pre-compiled and CDN-cacheable.
  • GET /api/search?query=… — hybrid keyword + semantic search across all content types.
  • GET /api/locales — locale discovery for building language switchers.

Not sure which surface to use? Start with the consumer guide: Headless consumer guide