Pages & content API
Create, read, update and delete content articles in bulk or one at a time.
Endpoints
| Method | Path | Description |
|---|---|---|
GET | /api/content/stats | Content statistics: totals, categories, last update |
GET | /api/content/categories | Published content grouped by category |
GET | /api/content/item/:id | Retrieve one article by ID or slug |
POST | /api/content | Bulk insert articles |
PUT | /api/content/item/:id | Update one article |
PUT | /api/content/bulk | Bulk update articles |
DELETE | /api/content/item/:id | Delete one article |
DELETE | /api/content/bulk | Bulk delete articles by ID or slug |
Insert articles
POST /api/content accepts an articles array and upserts each row (batches of 100). If slug is omitted it is generated from the title; tags default to the primary keyword.
curl -X POST "https://your-domain.com/api/content" \
-H "X-API-Key: $CONTENT_HUB_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"articles": [
{
"id": "article-123",
"title": "Understanding Car Insurance",
"body": "<p>Content body...</p>",
"slug": "understanding-car-insurance",
"type": "article",
"status": "published",
"category": "insurance",
"primary_keyword": "car insurance",
"search_volume": 25000,
"word_count": 1250,
"tags": ["car insurance", "auto insurance"]
}
]
}'Response
{
"success": true,
"message": "Inserted 1 articles",
"stats": {
"total_inserted": 1
}
}Article fields
| Field | Type | Notes |
|---|---|---|
id | string | Required. Unique identifier. |
title | string | Required. Shown in lists and the browser tab. |
body | string | Required. HTML content of the article. |
slug | string | Optional, unique. Forms the public URL; generated from the title if omitted. |
type | string | Defaults to `article`. |
status | enum | draft · published. Public retrieval filters on published. |
category | string | Used to group content on the site. |
primary_keyword | string | Main SEO keyword for the article. |
search_volume | number | Monthly search volume for the primary keyword. |
word_count | number | Article length. |
tags | string[] | string | JSON array or comma-separated string. |
published_at | string | ISO 8601 timestamp. |
Retrieve an article
GET /api/content/item/:id accepts an ID or a slug and returns the article with its parsed metadata.
curl "https://your-domain.com/api/content/item/understanding-car-insurance" \
-H "X-API-Key: $CONTENT_HUB_API_KEY"Mutations invalidate the content cache immediately, so published changes are live on the site without a redeploy. See the full reference in docs/api/content.md and the copy-paste snippets under Code examples.