API Reference
API reference
ThinCMS exposes a full REST API for every content operation. All endpoints are authenticated via API key and scoped to a site ID for multi-tenant isolation. Connect any frontend, build custom workflows, or let AI agents manage your content.
Authentication
All API requests require your API key in the x-api-key header. For multi-tenant installations, include the x-site-id header to specify which site you're operating on.
-H "x-api-key: your_api_key_here" \
-H "x-site-id: your_site_id"
| Header | Required | Description |
|---|---|---|
| x-api-key | Yes | Your ThinCMS API key, set in .env |
| x-site-id | Multi-tenant | The site identifier for multi-tenant installations |
| Content-Type | POST/PUT | application/json for request bodies |
API overview
ThinCMS provides RESTful endpoints for every content type. All responses are JSON. Here's the complete endpoint map.
Posts
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/posts | List posts with filtering, pagination, and sorting |
| GET | /api/posts/:id | Get a single post by ID |
| POST | /api/posts | Create a new post |
| PUT | /api/posts/:id | Update an existing post |
| DEL | /api/posts/:id | Delete a post |
Pages
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/pages | List all pages |
| GET | /api/pages/:id | Get a single page |
| POST | /api/pages | Create a new page |
| PUT | /api/pages/:id | Update a page |
| DEL | /api/pages/:id | Delete a page |
Categories, authors & tags
| Resource | Base path | Operations |
|---|---|---|
| Categories | /api/categories | List, Create, Update, Delete (supports nesting) |
| Authors | /api/authors | List, Create, Update, Delete |
| Tags | /api/tags | List, Create (also auto-created via posts) |
Media
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/media | List media with pagination |
| POST | /api/media | Upload a file (file path, URL, or base64) |
| PUT | /api/media/:id | Update media metadata (alt text, caption) |
| DEL | /api/media/:id | Delete media and file |
Forms & submissions
| Resource | Base path | Operations |
|---|---|---|
| Forms | /api/forms | List, Create, Update, Delete (with field definitions) |
| Submissions | /api/forms/:id/submissions | List, Export CSV |
Template, navigation & settings
| Resource | Base path | Operations |
|---|---|---|
| Template | /api/template | Get, Update (stylesheet, pageFrame, customHeadHtml) |
| Navigation | /api/navigation | Get, Update (header and footer nav arrays) |
| Settings | /api/settings | Get (site name, tagline, domain, logos) |
| Scripts | /api/scripts | List, Create, Update (analytics, tracking) |
| Search | /api/search | Full-text search across posts and pages |
| Preview | /api/preview | Create preview sessions for draft content |
Common API patterns
Create a post
-H "x-api-key: your_key" \
-H "Content-Type: application/json" \
-d '{
"title": "Getting started with ThinCMS",
"content": "<h2>Welcome</h2><p>Your first post.</p>",
"status": "published",
"tags": ["tutorial", "getting-started"],
"metaTitle": "Getting started with ThinCMS",
"metaDescription": "Learn the basics of ThinCMS"
}'
List posts with filters
$ curl "https://your-site.com/api/posts?status=published&limit=10&page=1" \
-H "x-api-key: your_key"
Upload media
-H "x-api-key: your_key" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/image.jpg",
"altText": "A descriptive alt text",
"caption": "Photo credit: Example"
}'
MCP server
ThinCMS includes a built-in Model Context Protocol (MCP) server with 45 typed tools. This allows AI agents like Claude, Copilot, and other MCP-compatible assistants to manage your content using natural language.
The MCP server exposes every API capability as a structured tool with typed inputs and outputs. AI agents can create posts, manage media, update templates, and more — all through the same authenticated API.
Available MCP tools (45 total)
Post & page management
Create, read, update, delete, and bulk-create posts. Full page management including wrapped and standalone render modes.
Categories, authors & tags
Manage taxonomies, author profiles, and tagging. Supports nested categories and automatic tag creation.
File management
Upload from URLs, local paths, or base64. Update alt text and captions. Manage visibility settings.
Template & navigation
Update stylesheets, page frames, navigation menus, and custom head HTML. Preview changes before publishing.
Connecting an AI agent
{
"mcpServers": {
"thincms": {
"url": "https://your-site.com/api/mcp",
"headers": {
"x-api-key": "your_api_key"
}
}
}
}
Ready to integrate?
Start building with the ThinCMS API today. Full source code access means you can extend any endpoint.
