docs · api
EN
Fundamentals

Base URL

Every request combines a base URL with a path under /public. There are two environments available: development and production.

Servers

EnvironmentBase URL
Production https://api.draftin.io
Development http://localhost:3000

Anatomy of a URL

There's no version segment in the path. The public endpoints all live under the /public prefix:

url
https://api.draftin.io/public/posts/slug/my-first-post
└────────┬───────────┘└──┬──┘└───────────┬───────────┘
     base URL         prefix       resource + params

Map of public resources

All the paths below are relative to the production base URL:

ResourceBase path
Posts/public/posts
Categories/public/categories
Tags/public/tags
Search/public/search
Ads (Delivery)/public/ads

Protocol

  • Always HTTPS in production. Requests must use https://.
  • JSON end to end: the response body is application/json. On requests with a body (some ads endpoints), send Content-Type: application/json — any other value results in 415 Unsupported Media Type.
TypeScript
const BASE = process.env.DRAFTIN_BASE_URL ?? "https://api.draftin.io";

const url = new URL("/public/posts", BASE);
url.searchParams.set("limit", "10");

await fetch(url, { headers: { "X-API-Key": process.env.DRAFTIN_API_KEY! } });