The DraftIn public API
DraftIn is a headless CMS for people who write. You model the content, write in the editor and publish — and the public API delivers that already-published content to any front-end: an Astro or Next.js site, a native app, a newsletter or a revalidation webhook.
This is the official reference for the platform's public layer: the content-read interface that customer sites consume using an API key. All of the documentation that follows covers only the endpoints meant for consumption by third-party applications — nothing about the panel's internal administration.
In 30 seconds
Every request points to the production base URL and carries your key in the X-API-Key header. Here's how to
list a blog's three most recent posts:
curl https://api.draftin.io/public/posts?limit=3 \
-H "X-API-Key: $DRAFTIN_API_KEY" const res = await fetch("https://api.draftin.io/public/posts?limit=3", {
headers: { "X-API-Key": process.env.DRAFTIN_API_KEY },
});
const { data: posts } = await res.json();
console.log(posts);
The response is a JSON envelope { success, data }, with
the array of
Post objects in data. From there, render it however you like
— DraftIn imposes no theme or presentation layer.
Where to start
If this is your first integration, follow this path:
Getting started
Make your first authenticated call in a few minutes.
Start →Authentication
How to get and use your blog's API key securely.
Understand →Posts reference
List, and fetch by ID and by slug, your published posts.
See endpoints →Error handling
Understand the error format and the HTTP status codes returned.
Learn →API principles
- REST over HTTPS. Predictable paths, standard HTTP verbs and JSON responses.
- Scoped per blog. Each API key belongs to one blog and only sees that blog's content.
- Published content only. Public endpoints return
only items with status
PUBLISHED— drafts and scheduled items never leak. - No session state. There's no login or cookies: authentication is by key on every request.
- Enveloped responses. Successes come as
{ success, data, meta? }and errors as{ success: false, error }with a stable code — see Response format.