Developer Documentation

jekcms API Reference

Connect jekcms to your own applications. The REST API covers content management, media uploads, webhook triggers and statistics.

REST API v1 API Key Required JSON
Base URL https://yourdomain.com/api/v1

Authentication

All API requests require an API key that must be sent with every request. Generate your key in the jekcms admin panel under Admin → API Keys.

Header Authentication (Recommended)

# X-API-Key header GET /api/v1/posts X-API-Key: your_api_key_here # Bearer token (alternative) GET /api/v1/posts Authorization: Bearer your_api_key_here

cURL Example

Terminal
$ curl -X GET "https://yourdomain.com/api/v1/posts" \ -H "X-API-Key: your_api_key_here" \ -H "Content-Type: application/json" {"success":true,"data":{"items":[...],"total":42,"pages":3,"current_page":1,"per_page":20}}

Security note: Never embed your API key in client-side code (JavaScript, HTML). Use it only in server-side integrations or automation tools like n8n.

Posts

GET /api/v1/posts List all posts
GET /api/v1/posts/{id} Get single post
POST /api/v1/posts Create new post
PUT /api/v1/posts/{id} Update post
DELETE /api/v1/posts/{id} Delete post

Parameters - GET /posts

# Query parameters page integer - Page number (default: 1) per_page integer - Results per page (default: 20, max: 100) status string - published | draft | scheduled | pending | trash (omit for all) type string - post | page category string - Category slug (also matches direct child categories) tag string - Tag slug author_id integer - Author user id search string - Search in title and content order_by string - id | created_at | updated_at | published_at | title | view_count | status | author_name order_dir string - DESC | ASC (default: created_at DESC) with_relations 1 - Include categories and tags

Create Post - POST /posts

{ "title": "My Post Title", "content": "<p>HTML or Markdown content</p>", "excerpt": "Short description", "status": "draft", // draft (default) | published | scheduled "categories": [3], // category ids "tags": ["php", "cms"], "featured_image": "images/2026/01/cover.avif", "seo": { "meta_title": "My Post Title", "meta_description": "Up to 160 characters" } }

n8n integration: Use HTTP Request node in n8n to post to jekcms. Method: POST, URL: /api/v1/posts, Headers: X-API-Key. Prepare JSON body with Set node.

Media

POST /api/v1/media Upload image
GET /api/v1/media Media library
DELETE /api/v1/media/{id} Delete media

jekcms converts uploaded images to AVIF (primary) and WebP (fallback) during the upload and generates thumbnails. Once both formats exist, the original JPEG, PNG or GIF is deleted; path and url in the response point to the AVIF file. Without GD on the server, the file is kept in its original format.

Upload Image - POST /media

# multipart/form-data POST /api/v1/media X-API-Key: your_api_key_here Content-Type: multipart/form-data # Form fields file file - jpg, jpeg, png, gif, webp, avif, pdf, doc, docx, xls, xlsx, zip, txt (max 50MB) alt string - Alt text (optional) title string - Library title (optional) # Or a JSON body instead of a file: {"url": "https://...", "alt": "..."} (max 25MB)

Response Example

{ "success": true, "data": { "success": true, "id": 142, "filename": "photo-8f3a12c4.avif", "original_name": "photo.jpg", "path": "images/2026/05/photo-8f3a12c4.avif", "url": "https://yourdomain.com/uploads/images/2026/05/photo-8f3a12c4.avif", "size": 184320, "mime_type": "image/avif", "is_image": true, "formats": { avif, webp }, "thumbnails": { thumbnail, medium, large, ... } } }

Categories

GET /api/v1/categories List all categories
GET /api/v1/categories/{id} Category detail

Category List Response

{ "success": true, "data": [ { "id": 1, "name": "Technology", "slug": "technology", "description": "Tech news and reviews", "parent_id": null, "post_count": 47 } ] }

Webhooks

Webhooks work in both directions. Inbound endpoints: n8n or any other system POSTs to the addresses below to publish a post, leave a draft, upload media or work through tasks planned in bulk. Authentication uses your API key; calls without one get 401. Outgoing webhooks: jekcms sends a signed JSON notification to a URL you define whenever a content event happens (below).

POST /api/v1/webhook/publish Publish a post
POST /api/v1/webhook/draft Create as draft (recommended)
POST /api/v1/webhook/schedule Schedule for later
POST /api/v1/webhook/media Upload an image from a URL
POST /api/v1/webhook/bulk-publish Bulk publish
POST /api/v1/webhook/queue-pending Fetch due planned tasks
POST /api/v1/webhook/test Connection test

The Request You Send

# POST /api/v1/webhook/draft { "title": "My New Article", "content": "<p>Article body as HTML</p>", "excerpt": "One-sentence summary", "categories": ["Technology"], // names or ids; unknown names are created "tags": ["cms"] }

The Response You Get

{ "success": true, "data": { "success": true, "id": 256, "status": "draft" } }

Using with n8n: Add an HTTP Request node at the end of your flow, point it at /api/v1/webhook/draft and send your API key in the X-API-Key header. The generated content appears in your panel as a draft, and you decide when to publish it.

Outgoing Webhooks

Create an entry in the Outgoing Webhooks section of Admin → API Keys: enter a name and an https:// target URL, and optionally restrict the entry to specific events. jekcms generates the signing secret and shows it once. There are five events: post_published, post_updated, post_deleted, comment_created (a new comment: id, post_id, author_name, status) and member_registered (a new member who verified their e-mail: id, name, email). Every delivery is logged on the same screen; a failed delivery can be re-sent with one click.

The Request You Receive

# POST - sizin URL'inize / to your URL # X-Jek-Event: post_published # X-Jek-Signature: sha256=<HMAC-SHA256(body, secret)> { "event": "post_published", "site": "https://yourdomain.com", "timestamp": "2026-08-28T12:00:00+00:00", "data": { "id": 256, "title": "My New Article", "slug": "my-new-article", "status": "published", "url": "https://yourdomain.com/my-new-article" } }

Verifying the signature: compute the HMAC-SHA256 of the raw body with your secret and compare it to the sha256=… value in X-Jek-Signature. Reject requests that don't match.

Statistics

GET /api/v1/stats Site metrics

GET /stats Response

{ "success": true, "data": { "posts": { "published": 318, "draft": 24, "scheduled": 6 }, "comments": { "total": 1204, "pending": 12, "approved": 1192 }, "media": { "total_files": 512, "images": 498, "total_size_formatted": "284.6 MB" }, "categories": 8, "tags": 46, "users": 3 } }

Error Codes

All error responses use the same structure: {"success":false,"error":{"code":401,"message":"..."}}. The one exception is the publish quality gate's 422, which returns a blocks array. The table below lists possible error codes and recommended solutions.

Code Meaning Resolution
400 Bad Request Check JSON format and required fields.
401 Unauthorized Send your API key in the X-API-Key or Authorization: Bearer header, and check that the key is active and not expired.
403 Forbidden The key's role is not allowed to do this (for example, an author key cannot change another user's post).
404 Not Found Check the id; post and media endpoints take a numeric id.
422 Quality gate The publish quality gate refused the request. The blocks array in the response lists the reasons (for example short_content, duplicate_title).
429 Too Many Requests Rate limit exceeded (100 requests per hour per client IP). The response carries no headers, so slow your calls down and retry.
500 Internal Server Error An unexpected server-side error occurred. The reference id in the message matches the server log line; if the problem persists, contact support with that id.

Retry on 429: Use exponential backoff - wait 1s, then 2s, then 4s between retries. In n8n, use the Wait node for this.

Start Using the API

Purchase jekcms, generate your API key and start building your integration.

View Pricing
  • Full REST API access
  • n8n integration (drafts → editorial approval)
  • AVIF/WebP auto-conversion
  • Webhook support
  • API key management

Be the first to know

New features, release notes and CMS guides. We send a couple of emails a month.