A
AgentCMS

API Documentation

AgentCMS provides a RESTful API for managing content programmatically. All endpoints accept and return JSON.

Base URL: https://agentcms-api.rckflr.workers.dev

Quick Example

# Create a blog post
curl -X POST https://agentcms-api.rckflr.workers.dev/v1/content/posts \
  -H "X-API-Key: acms_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "My First Post",
    "slug": "my-first-post",
    "fields": {
      "excerpt": "A quick intro...",
      "body": "Full content here..."
    }
  }'

Authentication

All API requests (except public endpoints) require authentication via API key. Include your key in the X-API-Key header.

curl https://agentcms-api.rckflr.workers.dev/v1/types \
  -H "X-API-Key: acms_live_your_api_key_here"

Alternatively, use the Authorization header with Bearer token:

curl https://agentcms-api.rckflr.workers.dev/v1/types \
  -H "Authorization: Bearer acms_live_your_api_key_here"

Error Handling

The API uses standard HTTP status codes. Errors return a JSON object with an error field.

Status Meaning
200Success
201Created
400Bad Request - Invalid parameters
401Unauthorized - Invalid or missing API key
404Not Found - Resource doesn't exist
409Conflict - Resource already exists
500Server Error
// Error response example
{
  "error": "Content type not found"
}
GET

/v1/types

List all content types.

Response

{
  "types": [
    {
      "id": "ct_abc123",
      "name": "Blog Posts",
      "slug": "posts",
      "description": "Blog articles",
      "fields": [
        { "name": "excerpt", "type": "text", "required": false },
        { "name": "body", "type": "text", "required": true }
      ],
      "created_at": "2024-12-28T10:00:00Z"
    }
  ]
}
POST

/v1/types

Create a new content type.

Request Body

{
  "name": "Products",
  "slug": "products",
  "description": "E-commerce products",
  "fields": [
    { "name": "price", "type": "number", "required": true },
    { "name": "sku", "type": "string", "required": true },
    { "name": "description", "type": "text", "required": false },
    { "name": "in_stock", "type": "boolean", "required": false }
  ]
}

Field Types

  • string - Short text (max 500 chars)
  • text - Long text (unlimited)
  • number - Integer or decimal
  • boolean - true/false
  • date - ISO 8601 date string
  • url - Valid URL
  • email - Valid email address
  • json - Arbitrary JSON object
GET

/v1/types/:slug

Get a single content type by slug.

PUT

/v1/types/:slug

Update a content type. Only provided fields will be updated.

DELETE

/v1/types/:slug

Delete a content type and all its content. This action is irreversible.

GET

/v1/content/:type_slug

List content items of a specific type.

Query Parameters

  • status - Filter by status: draft, published, private, trash
  • limit - Max items to return (default: 20, max: 100)
  • offset - Items to skip for pagination
# Get published posts, page 2
curl "https://agentcms-api.rckflr.workers.dev/v1/content/posts?status=published&limit=10&offset=10" \
  -H "X-API-Key: acms_live_xxx"
POST

/v1/content/:type_slug

Create a new content item.

curl -X POST https://agentcms-api.rckflr.workers.dev/v1/content/posts \
  -H "X-API-Key: acms_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Getting Started with AgentCMS",
    "slug": "getting-started",
    "fields": {
      "excerpt": "Learn how to use AgentCMS...",
      "body": "Full article content...",
      "author": "John Doe"
    }
  }'
GET

/v1/content/:type_slug/:slug

Get a single content item by slug.

{
  "id": "cnt_xyz789",
  "type_slug": "posts",
  "title": "Getting Started",
  "slug": "getting-started",
  "status": "published",
  "fields": {
    "excerpt": "Learn how to...",
    "body": "Full content..."
  },
  "taxonomy_terms": ["term_cat1", "term_tag2"],
  "created_at": "2024-12-28T10:00:00Z",
  "updated_at": "2024-12-28T12:00:00Z",
  "published_at": "2024-12-28T12:00:00Z"
}
PUT

/v1/content/:type_slug/:slug

Update a content item. Only provided fields are updated.

curl -X PUT https://agentcms-api.rckflr.workers.dev/v1/content/posts/getting-started \
  -H "X-API-Key: acms_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Updated Title",
    "fields": {
      "excerpt": "New excerpt..."
    }
  }'
DELETE

/v1/content/:type_slug/:slug

Delete a content item permanently.

POST

/v1/content/:type_slug/:slug/publish

Publish a content item. Published content is visible via the public API.

# Publish
curl -X POST https://agentcms-api.rckflr.workers.dev/v1/content/posts/my-post/publish \
  -H "X-API-Key: acms_live_xxx"
POST

/v1/content/:type_slug/:slug/unpublish

Unpublish a content item (sets status to draft).

GET

/v1/taxonomies

List all taxonomies with their terms.

{
  "taxonomies": [
    {
      "id": "tax_abc",
      "name": "Categories",
      "slug": "categories",
      "hierarchical": true,
      "terms": [
        { "id": "term_1", "name": "Tech", "slug": "tech" },
        { "id": "term_2", "name": "News", "slug": "news" }
      ]
    }
  ]
}
POST

/v1/taxonomies

Create a new taxonomy.

{
  "name": "Tags",
  "slug": "tags",
  "hierarchical": false
}
POST

/v1/taxonomies/:taxonomy_slug/terms

Create a new term within a taxonomy.

{
  "name": "JavaScript",
  "slug": "javascript",
  "parent_id": "term_tech"  // Optional, for hierarchical taxonomies
}
POST

/v1/content/:type_slug/:slug/terms

Assign taxonomy terms to a content item.

{
  "term_ids": ["term_1", "term_2", "term_3"]
}
DELETE

/v1/content/:type_slug/:slug/terms

Remove taxonomy terms from a content item.

GET

/v1/stats

Get statistics about your CMS.

{
  "content_types": 3,
  "total_content": 42,
  "by_type": {
    "posts": 25,
    "products": 15,
    "pages": 2
  },
  "by_status": {
    "published": 30,
    "draft": 10,
    "private": 2
  },
  "taxonomies": 2,
  "total_terms": 15
}
GET

/public/:type_slug

List published content. No authentication required. Use this for your frontend/website.

# No API key needed!
curl https://agentcms-api.rckflr.workers.dev/public/posts
GET

/public/:type_slug/:slug

Get a single published content item. No authentication required.

MCP Server Setup

Connect AI assistants like Claude or ChatGPT to AgentCMS using the Model Context Protocol.

MCP Server URL:
https://agentcms-mcp.rckflr.workers.dev

Claude Desktop Configuration

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "agentcms": {
      "url": "https://agentcms-mcp.rckflr.workers.dev"
    }
  }
}

Authentication Flow

The MCP server uses OAuth 2.1 with PKCE. When you first connect:

  1. The AI client will open a browser for authentication
  2. Enter your email to receive a verification code
  3. Enter the 6-digit code to complete authentication
  4. The session is saved - no need to re-authenticate

MCP Tools

Once connected, your AI assistant can use these 15 tools:

Content Types

  • agentcms_list_types - List all content types
  • agentcms_create_type - Create a new content type
  • agentcms_delete_type - Delete a content type

Content CRUD

  • agentcms_list_content - List content items
  • agentcms_get_content - Get single content item
  • agentcms_create_content - Create content
  • agentcms_update_content - Update content
  • agentcms_delete_content - Delete content
  • agentcms_publish_content - Publish/unpublish

Taxonomies

  • agentcms_list_taxonomies - List taxonomies
  • agentcms_create_taxonomy - Create taxonomy
  • agentcms_create_term - Create term
  • agentcms_assign_terms - Assign terms to content

Utilities

  • agentcms_search - Search content
  • agentcms_stats - Get CMS statistics

Example Prompts

"Create a blog posts content type with title, excerpt, body, and author fields"

"List all my content types"

"Create a new blog post about AI agents and publish it"

"Search for posts mentioning 'typescript'"

"Show me my CMS statistics"