API Reference

Documentation

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.

Getting started

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.

$ curl https://your-site.com/api/posts \
  -H "x-api-key: your_api_key_here" \
  -H "x-site-id: your_site_id"
Header Required Description
x-api-keyYesYour ThinCMS API key, set in .env
x-site-idMulti-tenantThe site identifier for multi-tenant installations
Content-TypePOST/PUTapplication/json for request bodies
Endpoints

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/postsList posts with filtering, pagination, and sorting
GET/api/posts/:idGet a single post by ID
POST/api/postsCreate a new post
PUT/api/posts/:idUpdate an existing post
DEL/api/posts/:idDelete a post

Pages

Method Endpoint Description
GET/api/pagesList all pages
GET/api/pages/:idGet a single page
POST/api/pagesCreate a new page
PUT/api/pages/:idUpdate a page
DEL/api/pages/:idDelete a page

Categories, authors & tags

Resource Base path Operations
Categories/api/categoriesList, Create, Update, Delete (supports nesting)
Authors/api/authorsList, Create, Update, Delete
Tags/api/tagsList, Create (also auto-created via posts)

Media

Method Endpoint Description
GET/api/mediaList media with pagination
POST/api/mediaUpload a file (file path, URL, or base64)
PUT/api/media/:idUpdate media metadata (alt text, caption)
DEL/api/media/:idDelete media and file

Forms & submissions

Resource Base path Operations
Forms/api/formsList, Create, Update, Delete (with field definitions)
Submissions/api/forms/:id/submissionsList, Export CSV

Template, navigation & settings

Resource Base path Operations
Template/api/templateGet, Update (stylesheet, pageFrame, customHeadHtml)
Navigation/api/navigationGet, Update (header and footer nav arrays)
Settings/api/settingsGet (site name, tagline, domain, logos)
Scripts/api/scriptsList, Create, Update (analytics, tracking)
Search/api/searchFull-text search across posts and pages
Preview/api/previewCreate preview sessions for draft content
Examples

Common API patterns

Create a post

$ curl -X POST https://your-site.com/api/posts \
  -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

# Get published posts, page 1, 10 per page
$ curl "https://your-site.com/api/posts?status=published&limit=10&page=1" \
  -H "x-api-key: your_key"

Upload media

$ curl -X POST https://your-site.com/api/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"
  }'
AI integration

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)

Content

Post & page management

Create, read, update, delete, and bulk-create posts. Full page management including wrapped and standalone render modes.

Organization

Categories, authors & tags

Manage taxonomies, author profiles, and tagging. Supports nested categories and automatic tag creation.

Media

File management

Upload from URLs, local paths, or base64. Update alt text and captions. Manage visibility settings.

Design

Template & navigation

Update stylesheets, page frames, navigation menus, and custom head HTML. Preview changes before publishing.

Connecting an AI agent

# Add to your MCP client configuration
{
  "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.