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:

ParamTypeDefaultNotes
limitint20max 100
offsetint0
orderBystringdatedate | title | menu_order
orderstringdescasc | desc
statusstringpublishdraft | publish | any
tagstringslug
categorystringslug
searchstringfull-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.