API reference · reference
Content API reference
Read and write pages, posts, and custom post types over REST or the typed SDK.
Content API
Base URL: https://<your-domain>/api/v1. Auth via Authorization: Bearer <token> (create tokens under Settings → API keys).
GET /content/:type
List items of a post type.
Query params:
| Param | Type | Default | Notes |
|---|---|---|---|
limit | int | 20 | max 100 |
offset | int | 0 | |
orderBy | string | date | date | title | menu_order |
order | string | desc | asc | desc |
status | string | publish | draft | publish | any |
tag | string | slug | |
category | string | slug | |
search | string | full-text |
Response:
{
"items": [{ "id": "…", "slug": "…", "title": "…", "excerpt": "…", "fields": { … } }],
"total": 42
}
GET /content/:type/:slug
Get one item by slug.
POST /content/:type
Create. Body:
{ "title": "Hello", "content": "…", "status": "publish", "fields": { "price": 9.99 } }
PATCH /content/:type/:id
Update. Partial body.
DELETE /content/:type/:id
Move to trash. Add ?force=true to permanently delete.
Typed SDK
import { createClient } from "@wordsafe/sdk";
const client = createClient({ url: "https://…", token: process.env.WS_TOKEN });
const posts = await client.content("post").list({ limit: 10 });
Types are generated from your custom fields — full autocomplete on fields.
