JSON REST API
Accent CMS can serve your content as JSON through a lightweight REST API at
/api/v1/.... This turns any Accent CMS site into a headless CMS that decoupled
frontends (React, Vue, mobile apps) can query directly.
The API is disabled by default. Enable it in config.yaml:
api: enabled: true
Endpoints
All endpoints return JSON with a consistent envelope format.
List Pages
GET /api/v1/pages
Query parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
tag | string | – | Filter by tag |
author | string | – | Filter by author |
sort | string | url | Sort field: url, title, or date |
order | string | asc | Sort direction: asc or desc |
limit | integer | 20 | Results per page (max 100) |
offset | integer | 0 | Pagination offset |
Example response:
{ "data": [ { "url": "/blog/welcome", "title": "Welcome", "date": "2026-01-15", "tags": ["blog"], "status": "visible", "word_count": 350 } ], "meta": { "total": 42, "limit": 20, "offset": 0 } }
Get Single Page
GET /api/v1/pages/{path}
Returns full page detail including rendered HTML content (when include_content
is enabled).
{ "data": { "url": "/blog/welcome", "title": "Welcome", "template": "blog.html.jinja", "date": "2026-01-15", "author": "Admin", "lead": "A short summary...", "tags": ["blog"], "status": "visible", "word_count": 350, "reading_time": 2, "language": "default", "content": "<p>Rendered HTML...</p>" } }
Search
GET /api/v1/search?q=term
| Parameter | Type | Default | Description |
|---|---|---|---|
q | string | required | Search query |
limit | integer | 20 | Max results |
Results are scored by relevance across title, URL, tags, lead, and content.
List Tags
GET /api/v1/tags
Returns all tags with page counts.
Get Tag
GET /api/v1/tags/{tag}
Returns a single tag with its associated pages.
Content Tree
GET /api/v1/tree
Returns the hierarchical content structure as a nested tree.
Schema
GET /api/v1/schema
Returns metadata about the content: available templates, tags, languages, and page count.
Configuration
All API settings with their defaults:
api: enabled: false # Enable the REST API prefix: "/api/v1" # Route prefix cors: true # Add CORS headers allowed_origins: ["*"] # CORS allowed origins include_content: true # Include rendered HTML in page detail
Setting include_content: false omits the content field from page detail
responses, reducing payload size for listing-oriented consumers.
CORS
When cors: true, the API responds with permissive CORS headers so browsers
can call the API from any origin. Restrict origins with allowed_origins when
deploying to production.
Build Mode
When the API is enabled, accent build generates static JSON files alongside
the HTML output:
_api/v1/pages.json
_api/v1/pages/blog/welcome/index.json
_api/v1/tags.json
_api/v1/tags/blog.json
_api/v1/tree.json
_api/v1/schema.json
These files can be served by any static file host (Netlify, Vercel, S3) to provide a fully headless API without a running server.