Skip to main content

Delivery API

Krios exposes content over both GraphQL and REST. They are projections of the same underlying delivery layer (src/lib/delivery/index.ts); the only differences are the wire format and the field-projection ergonomics.

Choosing GraphQL vs REST

GraphQLREST
Tighter projection — only fetch what you listWhole field map per entry
Per-field DataLoader batchingOne-query-per-route
Auto-generated schema per content typeSame routes for every type
Best for app frontends with custom selectionsBest for static-site builds, sitemap crawlers, simple integrations

Both share the same auth model, cache headers, and surrogate-key contract.

Auth

Authorization: Bearer <api-key>

Three key types:

TypeWhat it gets
deliveryPublic published content. Same as no auth.
previewPublished + drafts. Pass to a frontend in preview mode.
managementFull read + write. Required for the REST /api/v1/* mutation routes.

No auth = delivery mode for read endpoints. The auth helper is shared between GraphQL and REST: src/lib/delivery/auth.ts.

Sub-pages

  • GraphQL — schema generation, queries, DataLoader, depth/complexity limits
  • REST — endpoints, pagination, expand model
  • Preview — preview keys, signed tokens, click-to-edit overlay
  • CachingCache-Control, surrogate keys, edge invalidation
  • Routing — hostname → site → path resolution