Dyrected
API Reference

API Reference

Overview of the Dyrected REST API and SDK.

Dyrected exposes a RESTful JSON API for every collection and global defined in your config. There are two ways to consume it:

  • REST API — standard HTTP endpoints, usable from any language or tool
  • SDK (@dyrected/sdk) — a typed TypeScript client that wraps the REST API

REST API

Endpoints follow a consistent structure based on your collection and global slugs:

ResourceEndpoints
CollectionsGET /api/collections/:slug · POST · GET /:id · PATCH /:id · DELETE /:id
GlobalsGET /api/globals/:slug · PATCH /api/globals/:slug
AuthPOST /api/collections/:slug/login · /logout · /me · /invite · /accept-invite · /forgot-password · /reset-password
UploadsPOST /api/collections/:slug (multipart)
SchemaGET /api/schemas
PreviewPOST /api/preview-token · GET /api/preview-data

See REST API Reference for the full endpoint documentation, query parameters (where, sort, limit, depth), and error codes.


SDK

@dyrected/sdk is a framework-agnostic TypeScript client:

import { createClient } from '@dyrected/sdk'

const client = createClient({
  baseUrl: 'https://your-site.com/dyrected',
  apiKey: process.env.DYRECTED_API_KEY,
})

const { docs } = await client.collection('posts').find({
  where: { status: { equals: 'published' } },
  sort: '-createdAt',
  depth: 1,
})

See SDK Reference for all methods, and SDK Integration Guide for framework-specific setup (SvelteKit, Astro, vanilla JS, etc.).


Authentication

Every request is authenticated with one of:

MethodHeaderWhen to use
Site API Keyx-api-key: <key>Server-to-server, trusted backend code
JWTAuthorization: Bearer <token>Logged-in users, Admin UI, client-side apps
Site IDx-site-id: <id>Cloud mode — send alongside the API key

Endpoints with access: () => true on the collection do not require any auth header for GET requests.


OpenAPI

Dyrected generates an OpenAPI 3.0 spec from your config at runtime:

GET /api/openapi.json

Use this to generate typed clients, test with Postman or Insomnia, or point an AI agent at your API for instant integration.

On this page