IronCMS Content API

On this page

The IronCMS Content API lets anything send finished articles to your site from anywhere: your own app or script, a desktop editor, another website, an automation tool (n8n, Make…) or an AI assistant. It uploads images, creates drafts with categories, tags, slug and SEO fields, and — when you allow it — publishes them. A writer can draft an article on their own computer and post it with a single request. Nothing is tool-specific: anything that can send an HTTPS request, or connect to a remote MCP server, can use it.

The site calling an AI provider itself is a separate module: see AI Services.

All examples use https://docs.ironcms.com. Replace it with your site's address exactly as configured (scheme, www or not, and port must match).

What do you want to do?

If a term is unclear, start with Key concepts; if something fails, see Common problems.

Key concepts

TermMeaning
Integration and tokenThe connection you open in the panel for each app or person. It gives you a secret token starting with ica_, which the app sends with every request.
Permission (scope)What the token may do: read, write drafts, upload images, publish. Grant only what is needed.
DraftEvery article sent through the API starts as a private draft; it stays off the site until you, or an app allowed to publish, publishes it.
SlugThe short name in the article's address, for example /our-new-product. Generated from the title when not given.
Idempotency-KeyA unique label added to every write request. If the connection drops and you resend with the same label, the article is not created twice.
Version, ETag, If-MatchEvery draft has a version number. When updating you send the version you have in If-Match; if someone changed it meanwhile, nothing is overwritten.
MCPModel Context Protocol. A common language that lets AI assistants use external tools, so an assistant can send articles without code.
OAuthA way for an app to connect after you approve it in the panel, without typing the token by hand. Some MCP clients use it.

Quick start

  1. In the admin panel open Modules and make sure Blog and Content API are enabled.
  2. Open Content API → New integration, give it a name (for example "Desktop article editor"), tick the permissions you need, choose how long the token stays valid, confirm with your password and create it.
  3. Copy the token that starts with ica_. It is shown once. Store it in your app's secret settings (for example the environment variable CONTENT_API_TOKEN). Never paste it anywhere others can read it, such as a chat, an email or a shared document.
  4. Test it:
bash
export CONTENT_API_TOKEN='ica_...'
BASE='https://docs.ironcms.com/api/content/v1'
curl -s "$BASE/me" -H "Authorization: Bearer $CONTENT_API_TOKEN"
# {"data":{"id":"…","name":"Desktop article editor","scopes":["posts:read","posts:write","media:write","posts:autopublish"]}}
  1. Typical flow for one article:
text
GET  /taxonomies             → default language, category ids, limits
POST /media                  → upload or import each image, keep id + url
POST /posts                  → create a private draft
POST /posts/{id}/publish {}  → publish (requires posts:autopublish)

Without posts:autopublish the draft waits in Admin → Content API → Approval queue, where you approve and publish it with one click.

Step by step: connecting an MCP client

  1. In the panel create an integration under Content API ▸ New integration. Tick only the permissions you need, choose the lifetime and copy the token.
  2. In your assistant's or MCP client's settings, open the section for adding a remote MCP server (connector).
  3. Enter https://docs.ironcms.com/api/content/v1/mcp as the server address (with your own site address).
  4. Authentication:
    • If the client lets you add headers, set Authorization to Bearer ica_….
    • If the client connects with OAuth, it sends you to your site's approval screen, where you pick the integration and approve the permissions.
  5. Try it: ask the assistant to "list the categories on the site". If it answers, the connection works.
Screenshot: creating an integration in the panel (to be added).

Details: MCP server, OAuth 2.1 for MCP connectors.

Step by step: creating a draft with n8n

  1. Open Credentials ▸ Add credential ▸ Header Auth. Set Name to Authorization and Value to Bearer ica_….
  2. Add an HTTP Request node to the workflow:
    • Method POST, URL https://docs.ironcms.com/api/content/v1/posts
    • Authentication: Generic Credential Type ▸ Header Auth with the credential above
    • Send Headers: Idempotency-Key = a unique value per article (for example the source record's ID)
    • Send Body: JSON; for the fields see Article fields
  3. Run the node. Keep data.id and the version from the response for later steps.
  4. If the integration has posts:autopublish, add a second HTTP Request node that sends {} to POST …/posts/{{id}}/publish; otherwise the draft waits for your approval in the panel.

In Make and similar tools use the HTTP module with the same settings.

Screenshot: n8n HTTP Request node settings (to be added).

Authentication

Integration tokens

Every request needs this header:

http
Authorization: Bearer ica_<64 hexadecimal characters>
  • Tokens are created in Admin → Content API. Creating, rotating and revoking requires the administrator's password.
  • You choose the lifetime when you create the integration: 30, 90 (default), 180 or 365 days, a custom last day (up to one year ahead; the token works until the end of that day) or Never (valid until rotated or revoked). The panel shows the expiry date next to each integration.
  • Manage → Replace credential issues a new token, lets you choose a new lifetime and immediately invalidates the old token together with any pending approvals. Revoke access is permanent.
  • OAuth access tokens issued to MCP connectors always last one hour; their refresh grants never outlive the integration (and last at most one year for a non-expiring one, renewed on use).
  • Tokens are stored only as SHA-256 hashes and are bound to the site address. If the site address changes, every request returns 503 site_changed; re-activate the module and create new integrations.
  • Articles created by an integration are authored by the administrator who created it. That account must stay active.
  • If you think a token leaked, revoke it in the panel immediately.

Permissions (scopes)

ScopeAllows
posts:readRead categories/tags/languages (/taxonomies), the OpenAPI contract and the integration's own drafts
posts:writeCreate and update private drafts. Never publishes
media:writeUpload images or let the site download them from a URL. Images stay private until their article is published
posts:autopublishDirect publishing: POST /posts/{id}/publish with {} publishes the current version immediately. Give it only to tools you trust; the approval you give inside the AI tool counts as final
posts:publishTwo-step flow: the tool may publish only a version an administrator approved in the panel (approval_id)

A recommended set for an AI writer is posts:read, posts:write, media:write and, if you want hands-free publishing, posts:autopublish.

OAuth 2.1 for MCP connectors

Some MCP clients (chat apps with "connectors") cannot store a static token and use OAuth instead. The site supports it out of the box:

PurposeAddress
Protected resource metadata/.well-known/oauth-protected-resource/api/content/v1/mcp
Authorization server metadata/.well-known/oauth-authorization-server/api/content/v1/oauth
Dynamic client registrationPOST /api/content/v1/oauth/register
Token endpointPOST /api/content/v1/oauth/token
Consent screen (administrator){admin}/content-api/oauth/authorize

Rules: public clients only (authorization code + S256 PKCE), 1–3 exact https:// redirect addresses (no localhost), access tokens live for 1 hour and can be refreshed. The administrator picks an existing integration on the consent screen; the connector receives at most that integration's permissions. posts:publish and posts:autopublish are never granted implicitly — they must be ticked explicitly.

Request rules

RuleDetail
Base URLhttps://docs.ironcms.com/api/content/v1
HTTPSRequired in production (403 https_required)
Host / OriginMust equal the configured site address; a browser Origin header from another site is rejected (403 invalid_origin)
BodyOne UTF-8 JSON object, Content-Type: application/json, max 1,000,000 bytes (MCP: 7,500,000), max nesting depth 32
IdempotencyEvery write (POST, PATCH) needs an Idempotency-Key: 8–128 characters from A–Z a–z 0–9 . _ : -. Re-sending the same key with the same body returns the stored result (kept 7 days) and never duplicates anything. The same key with a different body returns 409 idempotency_conflict
VersionsGET/POST/PATCH on a draft return ETag: "<version>". PATCH requires If-Match: "<version>"
CachingAll responses are Cache-Control: no-store

Response envelope:

json
{"data": { … }}
{"error": {"code": "invalid_slug", "message": "Slugs use lowercase letters…", "details": { … }}}

Branch on error.code, never on the message text.

Endpoints

MethodPathScopeDescription
GET/meany valid tokenIntegration id, name and scopes
GET/taxonomiesposts:readDefault and active languages, categories, tags, limits, capabilities
GET/schemaposts:readOpenAPI 3.1 contract
POST/mediamedia:writeUpload an image (multipart) or import one from a URL (JSON)
POST/postsposts:writeCreate a private draft (201)
GET/posts/{id}posts:readRead a draft: version, content, blog_post_id, approval_id, approval_url
PATCH/posts/{id}posts:writePartially update a draft (If-Match required)
POST/posts/{id}/publishposts:autopublishBody {} → publish now, or at publish_at
POST/posts/{id}/publishposts:publishBody {"approval_id":"…"} → publish the version approved in the panel
POST/posts/{id}/schedulesame as /publishDoes the same as /publish. If the draft has a future publish_at, the new post goes live at that time
POST/mcpper toolMCP endpoint (JSON-RPC 2.0)

All {id} values are 32-character lowercase hexadecimal strings.

GET /taxonomies

json
{"data": {
  "default_locale": "en",
  "active_locales": ["en", "tr"],
  "capabilities": {"schedule_new_posts": true, "schedule_live_updates": false},
  "limits": {"article_bytes": 60000, "translation_bytes": 55000, "image_bytes": 5242880},
  "categories": [{"id": 3, "name": "Guides", "slug": "guides"}],
  "tags": [{"id": 7, "name": "tyres", "slug": "tyres"}]
}}

Always call it first: locale must equal default_locale, and category_ids must come from this list.

Article fields

POST /posts creates a draft; PATCH /posts/{id} accepts the same fields, all optional, and merges them into the draft. Unknown fields are rejected (422 unknown_field).

FieldTypeRequiredRules
titlestring✓1–255 characters
content_htmlstring✓Article HTML, at most 60,000 bytes after sanitising. See Allowed HTML
localestring✓ (create)Must be the site's default_locale (422 invalid_locale otherwise)
slugstringURL slug, ≤100 characters, lowercase letters, digits and single hyphens (winter-tyre-guide). Omitted → generated from the title (Turkish characters are transliterated, -2, -3 added if taken). An explicit slug that is taken returns 409 slug_taken. Locked once the article is live (409 slug_locked)
excerptstringSummary, ≤5,000 characters
is_newsbooleantrue marks the post as news. Default false
category_idsinteger[]≤20 existing category ids from /taxonomies
tagsstring[]≤20 tag names, each ≤100 characters. New names are created automatically
featured_media_idstring | nullCover image: the id returned by /media
media_idsstring[]≤20 ids of every image used in the article (cover included is fine)
seo.titlestringMeta title, ≤255 (recommended ≤60)
seo.descriptionstringMeta description, ≤255 (recommended 120–155)
seo.keywordsstringFocus keywords, comma separated, ≤255
external_idstringYour stable source id (file name, CMS id…), ≤150. Immutable. A second create with the same value returns 409 duplicate_external_id with the existing draft in details.id
translationsobject{"tr": {"title", "slug", "content_html", "excerpt", "seo"}} — only real translations into active site languages other than the default, ≤10 languages, ≤55,000 bytes in total. Each needs its own title and content_html
publish_atstring | nullISO 8601 with timezone, e.g. 2026-12-01T09:00:00+03:00 or …Z. A future time schedules a new article. A live article cannot be re-scheduled (409 live_update_schedule_unsupported)

Draft response (POST, GET, PATCH):

json
{"data": {
  "id": "9f1c…32 hex…",
  "version": 1,
  "content": { "title": "…", "slug": "…", "locale": "en", "seo": {"title": "…", "description": "…", "keywords": "…"}, "…": "…" },
  "blog_post_id": null,
  "approval_id": null,
  "approval_url": "https://docs.ironcms.com/admin/content-api/drafts/9f1c…"
}}

blog_post_id is filled once the article exists in the blog. approval_url is the administrator's preview page.

Allowed HTML

  • The HTML passes through the site's sanitiser (HTML Purifier). Allowed tags: p, br, h1–h6, strong, b, em, i, u, s, mark, span, div, ul, ol, li, blockquote, aside, figure, figcaption, table, thead, tbody, tr, th, td, pre, code, hr, a[href|title|target], img[src|alt|width|height]. A class attribute is kept on most block tags. Everything else — style, event handlers, scripts, <form>, unknown attributes — is silently removed.
  • target="_blank" links automatically get rel="noopener".
  • <iframe>, <object>, <embed>, <video>, <audio>, <source>, <svg> and <math> are rejected (422 unsupported_embed).
  • Every <img src> must be exactly the url of an image this integration uploaded, and that image must be listed in media_ids; srcset is not allowed (422 unowned_image). To use an image from another website, import it through /media first.
  • Do not add an <h1>; the title is rendered by the theme.

Images

POST /media (scope media:write) accepts either a file upload or an image address.

RuleValue
FormatsGenuine JPEG, PNG or WebP (content is checked, not just the extension)
Size≤ 5 MB before and after re-encoding
Dimensions≤ 24 megapixels, longest side ≤ 12,000 px
ProcessingEvery image is decoded and re-encoded; EXIF/metadata and hidden payloads are removed
StorageMedia library folder content-api, file name built from filename (else title, else alt) plus an 8-character suffix, e.g. winter-tyre-pressure-3f9a1c2b.jpg
VisibilityPrivate until an article that uses it is published
Rate limits20 per minute, 300 per day per integration
Quota512 MB per integration, 1 GB for all integrations (403 storage_quota)

Metadata fields:

FieldRequiredRules
alt✓What the image shows, ≤500 characters (422 alt_required)
titleImage title, ≤140
captionCaption, ≤500
creditSource / photographer, ≤255
filenameSEO file name without extension, ≤120 (slugified to ≤80)

Upload a file (multipart)

bash
curl -s -X POST "$BASE/media" \
  -H "Authorization: Bearer $CONTENT_API_TOKEN" \
  -H "Idempotency-Key: img-2026-11-23-cover" \
  -F "[email protected]" \
  -F "alt=Mechanic checking winter tyre pressure" \
  -F "title=Winter tyre pressure" \
  -F "filename=winter-tyre-pressure" \
  -F "credit=Studio Example"

Import from a URL (JSON)

bash
curl -s -X POST "$BASE/media" \
  -H "Authorization: Bearer $CONTENT_API_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: img-2026-11-23-002" \
  -d '{"url":"https://images.example.org/tyre.jpg","alt":"Tyre tread close-up","caption":"Minimum tread depth is 4 mm","filename":"winter-tyre-tread"}'

Response (201):

json
{"data": {"id": "<MEDIA_ID>", "url": "https://docs.ironcms.com/media/content-api/winter-tyre-pressure-3f9a1c2b.jpg", "width": 1600, "height": 900}}

URL imports also return source_url. Download rules: http/https only, ports 80/443, no user:password in the URL, public internet addresses only (local, private and reserved networks are refused with 422 blocked_url), at most 3 redirects, 5 s to connect, 20 s in total, the server must return a real JPEG/PNG/WebP. If a site blocks downloads (422 fetch_failed), download the file yourself and upload it.

Cover image, alt text and captions

  • Cover: put the image id in featured_media_id. The cover does not have to appear in content_html.
  • In-article images: use the returned url in <img src="…" alt="…">, and add the id to media_ids.
  • Captions: wrap the image: <figure><img src="…" alt="…"><figcaption>Caption</figcaption></figure>. The caption/credit fields are stored in the media library.
  • Alt text describes the image for screen readers and image search; do not stuff keywords.

Drafts, updates and publishing

Create a draft

bash
curl -s -X POST "$BASE/posts" \
  -H "Authorization: Bearer $CONTENT_API_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: post-winter-tyres-create" \
  -d '{
    "external_id": "word/winter-tyres.docx",
    "locale": "en",
    "title": "Winter Tyres: The Complete Guide",
    "slug": "winter-tyres-guide",
    "excerpt": "When to switch, how to check tread depth and what pressure to use.",
    "content_html": "<p>Intro…</p><h2>When to switch</h2><p>…</p><figure><img src=\"https://docs.ironcms.com/media/content-api/winter-tyre-pressure-3f9a1c2b.jpg\" alt=\"Mechanic checking winter tyre pressure\"><figcaption>Check pressure when tyres are cold.</figcaption></figure>",
    "featured_media_id": "<MEDIA_ID>",
    "media_ids": ["<MEDIA_ID>"],
    "category_ids": [3],
    "tags": ["winter tyres", "car care"],
    "is_news": false,
    "seo": {"title": "Winter Tyres Guide: When to Switch", "description": "When to fit winter tyres, how to check tread depth and the right pressure for cold weather.", "keywords": "winter tyres, tyre pressure"}
  }'

Update a draft

bash
curl -s -X PATCH "$BASE/posts/<DRAFT_ID>" \
  -H "Authorization: Bearer $CONTENT_API_TOKEN" \
  -H "Content-Type: application/json" \
  -H 'If-Match: "1"' \
  -H "Idempotency-Key: post-winter-tyres-edit-1" \
  -d '{"title": "Winter Tyres: The 2026 Guide"}'

If someone else changed the draft you get 412 version_conflict: GET it again and retry with the new version.

Publish

With posts:autopublish — publish the current version:

bash
curl -s -X POST "$BASE/posts/<DRAFT_ID>/publish" \
  -H "Authorization: Bearer $CONTENT_API_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: post-winter-tyres-publish" \
  -d '{}'
# {"data":{"id":"<DRAFT_ID>","blog_post_id":42,"status":"published"}}

status is scheduled when publish_at is in the future. Repeating the call is safe. Direct publishing is limited to 20 per hour.

Without it — the draft appears in Admin → Content API → Approval queue. Tick drafts and choose Approve and publish selected, or open one draft's preview and press Approve and publish. With posts:publish the tool can instead publish a panel approval itself: the approval id is returned by GET /posts/{id} (approval_id), is single-use and expires after 15 minutes.

bash
curl -s -X POST "$BASE/posts/<DRAFT_ID>/publish" \
  -H "Authorization: Bearer $CONTENT_API_TOKEN" -H "Content-Type: application/json" \
  -H "Idempotency-Key: post-winter-tyres-publish-approved" \
  -d '{"approval_id":"<APPROVAL_ID>"}'

Good to know:

  • Images become public when their article is published.
  • PATCH on an already published article only stages the change. The live article changes when you publish again.
  • If someone edited the article in the admin panel, the API will not overwrite it (409 live_content_changed).
  • If the optional Blog Workflow module is active, the publication is recorded as approved in the editorial workflow; an editorial policy can still refuse it (409 publication_denied).

MCP server (for MCP-capable clients)

Any client that speaks the Model Context Protocol — AI assistants included — can use the same operations as tools without writing code.

SettingValue
URLhttps://docs.ironcms.com/api/content/v1/mcp
TransportStreamable HTTP, stateless JSON responses (no SSE stream; GET returns 405)
Protocol versions2025-06-18, 2025-11-25 (send MCP-Protocol-Version after initialize)
HeadersAuthorization: Bearer ica_…, Accept: application/json, text/event-stream, Content-Type: application/json

Tools (only those allowed by the token's scopes are listed):

ToolScopePurpose
list_taxonomiesposts:readLanguages, categories, tags, limits
read_postposts:readRead a draft and its version
create_postposts:write{content, idempotency_key} — create a private draft
update_postposts:write{id, version, content, idempotency_key}
import_image_from_urlmedia:write{url, alt, title?, caption?, credit?, filename?, idempotency_key}
upload_imagemedia:write{base64, mime, alt, …, idempotency_key} (≤5 MB decoded)
publish_nowposts:autopublish{id, idempotency_key} — publish the current version
request_publicationposts:publishApproval state and preview link
publish_postposts:publish{id, approval_id, idempotency_key}

content uses exactly the article fields above. Tool failures return isError: true with structuredContent.error.code (same codes as REST).

Example remote-MCP tool definition (field names differ per provider; check your provider's current documentation):

json
{
  "type": "mcp",
  "server_label": "blog",
  "server_url": "https://docs.ironcms.com/api/content/v1/mcp",
  "authorization": "<CONTENT_API_TOKEN>"
}

Some providers expect "headers": {"Authorization": "Bearer <token>"} instead of authorization. Consumer chat subscriptions often cannot call private APIs with your own key; use the provider's developer API, an automation tool, or the script below.

OpenAPI contract

  • GET /schema returns the OpenAPI 3.1 document for your site.
  • Admin → Content API → OpenAPI file downloads it as content-api-openapi.json.
  • Give it to tools that import OpenAPI (custom GPT actions, Postman, n8n, code generators).

Rate limits

LimitValue
Per IP address120 requests / minute
Per integration60 requests / minute, of which 20 writes
Drafts30 / hour, 200 / day
Images20 / minute, 300 / day
Direct publishing20 / hour
Failed authenticationafter 20 invalid tokens from one IP, further invalid attempts get 429 for 10 minutes (valid tokens keep working)

A 429 rate_limit response carries Retry-After: 60. Wait and retry with the same Idempotency-Key.

Common problems

For each problem, find the cause first, then the fix. For every code see Error codes.

401 invalid_token

Why it happens: The token was copied wrongly, has expired, was replaced or revoked. What to do: Check the integration's state and expiry date in the panel; if needed, use Replace credential and enter the new token in the app. Make sure the header reads Authorization: Bearer ica_….

403 invalid_origin

Why it happens: The request goes to an address that differs from the site's configured one: with or without www, http instead of https, or a different port. What to do: Make the base address in your app exactly match the REST base URL shown in the panel.

422 unowned_image

Why it happens: An <img> address in the article HTML was not uploaded through /media, or is missing from media_ids. What to do: Upload the image with POST /media first and use the address it returns.

409 slug_taken

Why it happens: The slug you sent is used by another post. What to do: Send a different slug, or leave it empty so it is generated from the title.

412 version_conflict

Why it happens: The draft changed after you read it; your version is out of date. What to do: Read the draft again with GET and retry with the new version in If-Match.

429 rate_limit

Why it happens: Too many requests in a short time. What to do: Wait for the time in the Retry-After header and retry with the same Idempotency-Key. For the limits see Rate limits.

Error codes

Codes are grouped by topic. Use the filter box below to find a code quickly.

Authentication and permissions

HTTPCodeMeaning / fix
401invalid_tokenToken wrong, expired, rotated or revoked
401invalid_clientIntegration revoked or expired
403insufficient_scopeThe integration lacks this permission
403invalid_originHost/Origin differs from the site address (check www, port)
403https_requiredUse https://
404api_disabledContent API or Blog module is disabled

Request format and content

HTTPCodeMeaning / fix
400invalid_jsonBody is not a single valid UTF-8 JSON object
400idempotency_requiredIdempotency-Key missing or invalid (8–128 chars)
404not_foundDraft/image does not exist or belongs to another integration
409idempotency_conflictKey reused with a different body; use a new key
409conflictThe resource changed meanwhile; read it again and retry
412version_conflictDraft changed; GET and retry with the new version
413body_too_largeJSON body over the limit
415json_required / multipart_requiredWrong Content-Type
422unknown_fieldField not in the contract
422invalid_contentTitle or text content missing, bad is_news
422locale_required / invalid_localeSend the site's default language
422invalid_slugLowercase letters, digits, single hyphens only
422invalid_textNot UTF-8, control characters, or over the field limit
422host_content_limitArticle > 60 KB, translations > 55 KB or SEO description > 255
422invalid_list / invalid_category / invalid_tagList too long, unknown category, empty tag
422invalid_seoOnly title, description, keywords
422invalid_translationInactive language, missing title/content, or default language
422invalid_datepublish_at without timezone or invalid
422invalid_idThe draft or image ID is malformed
422immutable_external_idexternal_id cannot be changed after the draft was created
428version_requiredPATCH without If-Match: "<version>"
429rate_limitSee Rate limits

Images

HTTPCodeMeaning / fix
403storage_quotaMedia quota reached
409media_unavailableAn attached image was removed
413image_too_large / image_dimensionsOver 5 MB or over 24 MP / 12,000 px
415invalid_imageNot a genuine JPEG/PNG/WebP
422unowned_image<img> not uploaded through /media or missing from media_ids
422unsupported_embediframe/video/audio/svg/embed not accepted
422alt_required / invalid_metadataAlt text missing / unknown image field
422invalid_url / blocked_url / unresolvable_url / too_many_redirects / fetch_failedImage URL unusable; upload the file instead
422invalid_fileNo valid image file in the multipart file field
503fetch_unavailableThis server cannot download remote images; upload the file instead

Drafts and publishing

HTTPCodeMeaning / fix
409duplicate_external_idSource already has a draft; PATCH the id in details.id
409slug_takenExplicit slug already used
409slug_lockedA live article's slug can only be changed in the panel
409live_content_changedArticle edited in the panel; API will not overwrite
409live_update_schedule_unsupportedA live article cannot be moved to a future date
409approval_required / approval_stalePanel approval missing, used, expired or outdated
409publication_deniedEditorial policy refused publication
409author_unavailableThe integration's author account is inactive
409post_unavailableThe linked Blog post was deleted or can no longer be edited
422invalid_approval{} sent without posts:autopublish, or malformed approval_id

OAuth and MCP

HTTPCodeMeaning / fix
400unsupported_protocolMCP: unsupported or missing MCP-Protocol-Version
400invalid_request / invalid_grant / invalid_scopeOAuth: malformed request, expired or reused code/refresh grant, or scopes that were not granted
400invalid_client_metadata / invalid_redirect_uriOAuth client registration: only public authorization-code clients with S256 PKCE and one to three exact HTTPS redirect addresses
405no_streamMCP GET; use POST
406invalid_acceptMCP: Accept must include application/json and text/event-stream
413request_too_largeOAuth request over its size limit
415invalid_content_typeOAuth endpoints: send JSON or form-urlencoded data
422unknown_toolMCP: the tool name does not exist
429registration_limitOAuth client registration capacity reached; ask the site owner

Server

HTTPCodeMeaning / fix
503site_changed / not_activatedRe-activate the module; create new integrations
503invalid_site / unsupported_databaseSite address or database setup is unsuitable; the site owner must fix the configuration
503unavailable / write_failed / storage_unavailableTemporary server problem; retry later with the same key

Example script (Python)

python
import os, requests

BASE = "https://docs.ironcms.com/api/content/v1"
H = {"Authorization": f"Bearer {os.environ['CONTENT_API_TOKEN']}"}

tax = requests.get(f"{BASE}/taxonomies", headers=H).json()["data"]

with open("cover.jpg", "rb") as f:
    img = requests.post(f"{BASE}/media", headers={**H, "Idempotency-Key": "winter-tyres-cover"},
                        files={"file": f}, data={"alt": "Mechanic checking tyre pressure",
                                                 "filename": "winter-tyre-pressure"}).json()["data"]

post = requests.post(f"{BASE}/posts", headers={**H, "Idempotency-Key": "winter-tyres-create"}, json={
    "external_id": "winter-tyres.docx", "locale": tax["default_locale"],
    "title": "Winter Tyres: The Complete Guide", "slug": "winter-tyres-guide",
    "content_html": f'<p>Intro…</p><img src="{img["url"]}" alt="Mechanic checking tyre pressure">',
    "featured_media_id": img["id"], "media_ids": [img["id"]],
    "category_ids": [tax["categories"][0]["id"]], "tags": ["winter tyres"],
    "seo": {"title": "Winter Tyres Guide", "description": "When to fit winter tyres and how to check them."},
}).json()["data"]

done = requests.post(f"{BASE}/posts/{post['id']}/publish",
                     headers={**H, "Idempotency-Key": "winter-tyres-publish"}, json={}).json()
print(done)

Ready-to-use AI prompts

These are optional examples for AI assistants; the API works the same without them. Give the assistant the token through its secret/tool settings, never in the prompt itself.

1. Word document → published article

text
You are my blog publishing assistant. Use the "blog" tools (Content API).
1. Call list_taxonomies. Use default_locale as locale and pick the best matching category id.
2. Convert the attached document to clean HTML without changing its meaning: <h2>/<h3> for headings,
   <p>, <ul>/<ol>, <blockquote>, <table>. No <h1>, no inline styles, no scripts, iframes or videos.
3. Write a 2-sentence excerpt, an SEO title (max 60 characters), an SEO description (120–155
   characters), 2–4 focus keywords and a short lowercase ASCII slug with hyphens.
4. For every image: if it is a file, call upload_image; if it is a web address, call
   import_image_from_url. Give each one an accurate alt text, a title and a filename related to the
   article. Use the returned url in <img src>, put every id in media_ids, and the best one in
   featured_media_id.
5. Call create_post with external_id = the document file name and
   idempotency_key = file name + today's date.
6. Show me the title, slug, SEO fields and the first paragraphs. When I answer "publish", call
   publish_now and give me the article link. If a tool returns an error, read error.code, fix the
   cause and retry with the same idempotency_key.

2. Draft only (human review on the site)

text
Prepare the attached article exactly as described in my publishing rules, then call create_post only.
Never call publish tools. Reply with the draft id and approval_url so I can review it in the panel.

3. Research and write a new article

text
Write an original 1,200-word article in {language} about "{topic}" for my blog. Use facts you can cite,
add a short "Sources" list at the end with links. Find 1–3 freely licensed images and import them with
import_image_from_url (credit the author in credit). Follow my HTML and SEO rules, create a draft and
stop for my approval before publishing.

4. Update an existing draft

text
Read draft {id} with read_post. Fix spelling, improve the SEO description (120–155 characters) and add
an FAQ section with 3 questions as <h2>/<h3>/<p>. Call update_post with the version you read. If you
get version_conflict, read it again and reapply the change.

5. Add a translation

text
Read draft {id}. If list_taxonomies shows "tr" in active_locales, translate the title, excerpt, content
and SEO fields into natural Turkish and send them with update_post as translations.tr, with its own
Turkish slug. Keep all <img> tags and URLs unchanged.

Security checklist

  • Create one integration per app, script or person, with the fewest permissions it needs.
  • Keep tokens in secret storage. Prefer a dated lifetime; give a non-expiring token only to apps you trust and replace it from time to time. Revoke immediately if leaked.
  • Give posts:autopublish only to apps whose output you approve before they publish.
  • Use HTTPS and the exact site address.
  • Review Admin → Content API regularly: it lists integrations, drafts and the approval queue.
↑ Back to top