API Authentication
The jekcms REST API needs a token in a header. There is no OAuth handshake, no session cookie and no refresh flow. n8n, Make and Zapier support this method without extra setup, which is why the API uses it.

Sending the token
Three header names work, and the API treats them the same way. X-API-Key: YOUR_TOKEN is the plainest. Authorization: Bearer YOUR_TOKEN is what most automation tools default to. Api-Key: YOUR_TOKEN is supported because a few clients send only this header.
A request looks like this:
curl -H "X-API-Key: YOUR_TOKEN" https://yoursite.com/api/v1/posts
Every successful response has the same structure, a success flag and a data payload:
{
"success": true,
"data": {
"items": [],
"total": 0,
"pages": 0,
"current_page": 1,
"per_page": 20
}
}
Errors use the same structure with the flag set to false and the status code repeated inside the object, so a client that reads only the body still knows what happened:
{
"success": false,
"error": { "code": 401, "message": "Unauthorized" }
}
The token is never read from the query string, because a token in the URL would be written to access logs.
Where tokens come from
Admin → API Keys, a screen that requires an administrator login. Give the key a name you will still recognise months later, such as n8n, zapier or mobile-staging, and optionally an expiry date. Without an expiry date, the key stays valid until you revoke it.
The full secret is shown only once, on the screen where you create it. jekcms keeps only its SHA-256 hash, plus a masked fragment (first eight characters, last four) so you can tell rows apart in the list. A lost secret cannot be recovered; create a new key and deactivate the old one.
Revoking a key makes it inactive, and the next request with it fails immediately, because there is no cache. The list also shows when each key was last used, which helps you find keys that are no longer needed.
Permissions come from the role
There are no scopes. A jekcms key has no posts:write flag and no per-key permission list. A key acts as a user account: it belongs to the user who created it and can do exactly what that user's role allows.
Because the API Keys screen is administrator-only, every key created through the admin panel belongs to an administrator and has administrator permissions. Treat an API key as an admin credential: store it as carefully as a database password, and give each integration its own key so that revoking one does not break the others.
Write operations are checked against ROLE_CAPABILITIES in config/constants.php:
| Role | What the key can do through the API | |---|---| | admin | Everything, including /users and /settings | | editor | Posts, pages, media, comment moderation, categories and tags | | author | Posts and uploads, only for its own posts | | subscriber | Read only |
A call without the required capability comes back as 403 with Insufficient role for this operation. An author key that tries to change another user's post gets 403 with You can only modify your own content. Categories, tags and comment moderation need editor or above; /users and /settings answer every role below administrator with Forbidden.
You can ignore the abilities column of the api_tokens table, which remains from an earlier design. For API keys it is written but never read. It carries meaning only for outbound webhook rows, where it holds the subscribed event list.
Rate limit
The limiter counts per client IP, not per key: API_RATE_LIMIT requests in a rolling 60-minute window, default 100. The constant is defined in config/environment.php and reads an API_RATE_LIMIT environment variable when one is set.
Above the limit, every request returns 429 with Rate limit exceeded until the oldest request leaves the window. There is no Retry-After header, no X-RateLimit-* headers and no separate limit per key, so two integrations behind the same IP share one counter. If you run a busy pipeline, raise the constant instead of retrying.
Authentication runs after the limiter, so even /api/v1/health counts against the limit, and every endpoint requires a key.
What the token opens
Thirteen endpoints answer to a valid key: posts, media, categories, tags, comments, users, settings, webhook, trends, stats, sitemap, search and health. The webhook endpoint is the action-based automation surface described under Automation; the others are standard REST resources.
Posts created through the API go straight into the posts table. The API does not write to the content queue - see Content Queue for the paths that do.
Recommended practices
Create one key per integration and name it after the integration, so you know which key to revoke. Set an expiry date on keys for contractors and short-lived pipelines. Keep the secret in a secret store (n8n credentials, an environment variable or a password manager), never in a repository. Revoke a person's keys on the day they leave.