Your content,
ready for your code.

Deliver structured content to your applications through REST, GraphQL or a TypeScript SDK. Query the content you need, work with typed responses, and keep your content in your own PostgreSQL database.

s-maxage=60

Cache directives

100% Typed

CLI generated

Direct Postgres

Customer owned

TypeScript Delivery SDK
@schmadev/client
// Initialize client on edge or Node
import { createClient } from "@schmadev/client";
import type { Article } from "@/types/schma";
const schma = createClient({
  tenantSlug: "editorial",
  apiKey: process.env.SCHMA_DELIVERY_KEY!,
});
// Query published entries with populated author
const { data: articles } = await schma.delivery.listEntries<Article>({
  type: "article",
  limit: 10,
  populate: ["author"],
});
Cache States-maxage=60
model: articlepublished

A slower kind of Sunday

Author:Elena Vance
Locale:en-US
Cache-Control:s-maxage=60
REST Endpoint/v1/delivery/entries
GET /v1/delivery/entries?type=article&populate=author&limit=10
Authorization: Bearer schma_live_...
{
  "data": [{ "id": "ent_94a2", "fields": { "title": "A slower Sunday", ... } }],
  "meta": { "total": 38, "limit": 10, "offset": 0, "hasMore": true }
}
CLI & GraphQLDynamic Schema
$ npx schma generate -t editorial
✔ Generated TypeScript types
query {
  articleCollection(limit: 5) {
    title
    author { ... on Author { name } }
  }
}

Query content. Get the shape you need.

Retrieve entries by content type, paginate through results, sort records, request localized content and populate referenced entries. Start with a straightforward HTTP request, then add the parameters your application needs.

HTTP Request
GET/v1/delivery/entries
Headers:
Authorization: Bearer schma_live_...
x-tenant-slug: editorial
Query Parameters:
type: "article"
populate: "author"
limit: 20
sortBy: "publishedAt"
order: "desc"

1-Hop Batch Reference Expansion

REST reference population expands references one level deep. For more complex nested relationships, explore GraphQL below.
JSON Response•200 OK
application/json
{
  "data": [
    {
      "id": "e8f3b2a1-7c9d-4e5f-b6a8-1d2c3e4f5a6b",
      "type": "article",
      "publishedAt": "2026-10-24T14:30:00.000Z",
      "createdAt": "2026-10-20T09:12:00.000Z",
      "updatedAt": "2026-10-24T14:30:00.000Z",
      "fields": {
        "title": "A slower kind of Sunday",
        "slug": "a-slower-kind-of-sunday",
        "excerpt": "Architectural principles for structured editorial systems.",
        "author": {
          "id": "c4d3e2f1-0a9b-8c7d-6e5f-4a3b2c1d0e9f",
          "type": "author",
          "fields": {
            "name": "Elena Vance",
            "role": "Principal Systems Architect"
          }
        }
      }
    }
  ],
  "meta": {
    "total": 38,
    "limit": 20,
    "offset": 0,
    "hasMore": true
  }
}
Cache-Control: public, s-maxage=60Zero N+1 database roundtrips
type

Content Model Filtering

Query entries belonging to a specific content model slug (e.g. ?type=article).

populate

1-Hop Reference Expansion

Expand reference IDs into complete objects in a single batch query (e.g. ?populate=author,tags).

limit & offset

Zero-Based Pagination

Control page sizes up to 100 entries per request. Responses include total count and hasMore indicator.

sortBy & order

Deterministic Sorting

Order records by publishedAt, createdAt, updatedAt, or id in ascending or descending sequence.

locale

Field-Level Localization

Request localized fields with automatic fallback to base language content.

PostgreSQL Direct

Customer Database Execution

Queries run directly against your own pooled PostgreSQL instance via connectionManager, avoiding opaque multi-tenant queues.

Ask for the content your interface needs.

Work with a GraphQL schema generated from your content models. Select the fields your application needs and follow relationships between content types, without relying on a fixed, hand-written schema for every model.

/v1/delivery/graphqlPOST / GET
query GetStoryWithAuthor {
  articleCollection(
    limit: 5,
    orderBy: "publishedAt",
    order: "desc"
  ) {
    id
    title
    slug
    publishedAt
    author {
      # Polymorphic relationship via EntryUnion
      ... on Author {
        name
        role
        avatarUrl
      }
    }
  }
}

EntryUnion Polymorphic Resolution

Reference fields automatically resolve against heterogeneous content types through GraphQL unions and inline fragments.
Dynamically Compiled Schema60s TTL Cache
type Articlemodel: article
id: ID!
title: String!
slug: String!
author: EntryUnion
resolves reference
type Authormodel: author
name: String!
role: String
avatarUrl: String
bio: RichText
Generated on-the-fly from tenant modelsZero manual schema writing

Production Complexity Safeguards

Active Query Guardrails
Max Depth: 6

AST depth traversal verification automatically rejects recursive queries deeper than 6 levels with a 400 Bad Request.

Max Root Fields: 5

Prevents query-alias inflation attacks by enforcing a maximum of 5 root fields per request payload.

Batching Cap: 5

Payload array batches are limited to 5 operations to prevent worker thread saturation and denial-of-service.

From content models to typed application code.

Use @schmadev/client to retrieve content with a native-fetch, zero-runtime-dependency TypeScript client. Generate TypeScript interfaces from your SCHMA content models with the CLI, then use those types throughout your application code.

Stage 01/Content Model
Studio

Define structured schemas and relationships in your PostgreSQL workspace.

model: "article"PostgreSQL
titlestring (required)
slugstring (unique)
bodyrichText
authorref → Author
Stored in public.schma_content_types
Stage 02/Generate Types
CLI

Introspect workspace models and output clean declaration interfaces.

$ npx schma generate -t editorial
✔ Connected to "editorial"
✔ Introspected 4 models
✔ Generated TypeScript interfaces
export interface Article {
  title: string;
  slug: string;
  author?: Author;
}
Zero manual TypeScript interface authoring
Stage 03/Typed Delivery
Runtime

Pass generated types directly into the isomorphic SDK client.

const { data } = await schma.delivery.listEntries<Article>({
  type: "article",
  limit: 10,
  populate: ["author"],
});
// Editor autocompletion:
data[0].fields.title // string
data[0].fields.author?.fields.name
Full IDE autocomplete & type safety
Zero Runtime Dependencies

@schmadev/client runs on native fetch. Dual-published ESM & CommonJS for Node 18+, Bun, Next.js, Remix, Astro, and Cloudflare Workers.

Verified Delivery Namespace

Dedicated client.delivery methods: getEntry, listEntries, and searchSimilar. Completely separated from management mutations.

Compile-Time Typing

CLI-generated interfaces provide complete compile-time developer confidence without bundling heavy runtime validation schemas into your production edge bundle.

Fast published content. Fresh editorial previews.

Published entries can be served with cache-friendly HTTP headers. When you need to inspect draft content, a valid preview token switches delivery to the working draft and disables caching, so an old cached response does not stand between you and your latest edits.

Public Visitors · Published PathCache-Friendly Directives

Requests from production users are served from frozen published snapshots with cache-friendly HTTP headers.

Step 1: Production Request
GET /v1/delivery/entries?type=article
Step 2: Database Snapshot Selection
status = 'published' AND published_at <= NOW()
→ Reads published_data_json
Step 3: Published Cache Directives
Cache-Control: public, max-age=10, s-maxage=60, stale-while-revalidate=300
Vary: x-tenant-slug, x-environment, Accept-Encoding
Published responseSnapshot integrity
Editorial Preview · Draft PathCache Bypass (no-store)

Preview tokens allow content editors and staging frontends (e.g. Next.js Draft Mode) to view working drafts instantly.

Step 1: Scoped Preview Request
GET /v1/delivery/entries?preview=prv_7a8b...
Step 2: Token Verification & Working Draft
Validated against schma_preview_tokens
→ Reads live working data_json
Step 3: Strict No-Cache Headers
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache, Expires: 0
Working draft accessToken-scoped security
Built-in Semantic Vector Search (pgvector)Pro & Max

Retrieve related articles and power semantic search with native PostgreSQL cosine similarity (<=>). Backed by 768-dimensional embeddings via your configured AI provider key (BYOK).

// Query by semantic similarity:
GET /v1/delivery/entries/similar?text=architecture&limit=5
Returns entries ranked by cosine distance (_similarityDistance). Requires BYOK AI config.

Put your content to work.

Connect your application to structured content with the delivery method that fits your stack.