{"openapi":"3.1.0","info":{"title":"Interactor CMS API","version":"1.0.0","description":"The public read API, the authenticated content-management API, the automation intake API, identity, and the MCP server for the Interactor CMS. See CLAUDE.md in the content-manager repo for the full auth model."},"servers":[{"url":"https://cms.interactor.com"}],"paths":{"/api/public/posts":{"get":{"summary":"List published posts","description":"Every published, non-future-dated post across the organization, newest first. This is what the website's blog index calls. The response is an explicit allowlist of public-safe fields, not the raw row: `seo_title`, `canonical_url`, `og_image`(_alt), `noindex`, `content_updated_at`, `answer_summary` and `redirect_to` are new (G#31); the last three are omitted entirely, never sent as `null`, when unset. `author` is an entity (`{name, slug, job_title, bio, avatar_url, same_as}`) rather than just the `author_name` string — `null` until the credited person has set a public author_slug. Pass `?platform=<site slug>` to also get a resolved `seo` block (G#33) — `{title, description, canonical, robots, og, twitter, json_ld}` — computed once for this site rather than left for each consumer to build; every field is per-site (canonical URL, publisher identity, sameAs) so it is only sent when the platform names a registered Site. `json_ld` is an array of independent nodes (each carries its own `@context`): BlogPosting (Person author when the post has a byline, Organization publisher from the site/org), a two-level BreadcrumbList (site, post — no guessed category rung), and an FAQPage node only when the body has a visible FAQ section.","tags":["Public read"],"parameters":[{"name":"type","in":"query","required":false,"description":"Filter to one content type (e.g. `blog`).","schema":{"type":"string"}},{"name":"category_id","in":"query","required":false,"description":"Filter to one category id.","schema":{"type":"string"}},{"name":"platform","in":"query","required":false,"description":"Filter to posts targeting this site slug (`Post.platforms`). Omit to get every published post regardless of distribution target.","schema":{"type":"string"},"example":"product-manager"},{"name":"author_slug","in":"query","required":false,"description":"Filter to posts by one author's public `author_slug` (see `author.slug` in the response). An unrecognized slug returns an empty page, not an error — same contract as every other filter here.","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"1-indexed page number. Default 1.","schema":{"type":"integer"}},{"name":"per_page","in":"query","required":false,"description":"Page size, capped at 100. Default 50.","schema":{"type":"integer"}}],"responses":{"200":{"description":"A page of published posts, each including its category."}},"security":[]}},"/api/public/posts/slug/{slug}":{"get":{"summary":"Get one published post by slug","description":"A slug that matches no live post but WAS a post's slug before it was renamed (G#31) answers `{data: {redirect_slug}}` instead of 404 — look up `PostSlugHistory` says this content moved, not that it's gone. `redirect_slug` is the new current slug on this same site; only names a redirect target when the successor post is still published and (if `?platform=` was passed) still targets that site. Distinct from a post's own free-text `redirect_to` field, which is an author's manual override, not a derived rename record. A `.md` suffix on the slug (G#34) — e.g. `.../slug/my-post.md` — returns clean Markdown + YAML frontmatter (`text/markdown`) built from this SAME public allowlist instead of JSON; an HTML-format post's body is converted from its sanitized render, not served as raw pasted HTML.","tags":["Public read"],"parameters":[{"name":"slug","in":"path","required":true,"description":"The post's slug, or a slug it used to have.","schema":{"type":"string"}},{"name":"platform","in":"query","required":false,"description":"404 the post if it does not target this site slug.","schema":{"type":"string"}}],"responses":{"200":{"description":"The post, including its category and author; or `{redirect_slug}` for a retired slug."},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}}},"security":[]}},"/api/public/posts/{slug}/comments":{"get":{"summary":"List a post's published comments","description":"Published comments only, oldest first — pending/spam/rejected comments never appear here.","tags":["Public read"],"parameters":[{"name":"slug","in":"path","required":true,"description":"The post's slug.","schema":{"type":"string"}}],"responses":{"200":{"description":"The post's published comments."},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}}},"security":[]},"post":{"summary":"Submit a comment on a post","description":"Every new comment lands as `pending` — nothing is auto-published. The consuming website's own spam guard runs before this is ever called; this endpoint only does basic field validation.","tags":["Public read"],"parameters":[{"name":"slug","in":"path","required":true,"description":"Must be a published post's slug.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"author_name":{"type":"string"},"author_email":{"type":"string","format":"email"},"content":{"type":"string","maxLength":2000}},"required":["author_name","author_email","content"]}}}},"responses":{"201":{"description":"Comment accepted, pending moderation."},"400":{"description":"Missing field, invalid email, or content over 2000 characters."},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}}},"security":[]}},"/api/public/faq":{"get":{"summary":"List published, public FAQ entries","description":"Filters through `PUBLIC_FAQ_WHERE` (src/lib/faq.ts) — the one place that defines \"public\" for this API. A `sales-only` or unpublished entry never appears here. `{{facts.<key>}}` tokens in `answer` are substituted at read time.","tags":["Public read"],"parameters":[{"name":"category","in":"query","required":false,"description":"One of: pricing, self-hosting, security, hosted-fleet, ci, billing.","schema":{"type":"string"}}],"responses":{"200":{"description":"Matching FAQ entries."},"400":{"description":"Unknown `category` value."}},"security":[]}},"/api/public/faq/{id}":{"get":{"summary":"Get one FAQ entry by slug","description":"`{id}` is the FAQ's human-readable `slug` (e.g. `self-hosting-cloud-cost`), not its database id. A sales-only or unpublished entry 404s here exactly as if it didn't exist — there is no authenticated path through this route that would leak it.","tags":["Public read"],"parameters":[{"name":"id","in":"path","required":true,"description":"The FAQ's slug.","schema":{"type":"string"}}],"responses":{"200":{"description":"The FAQ entry."},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}}},"security":[]}},"/api/public/rss.xml":{"get":{"summary":"RSS feed of a site's published posts","description":"Unlike `/api/public/posts`, `platform` is required here — a feed needs exactly one site's `url` (registered from Settings → Sites) to build each `<link>` from, and there is no \"all sites\" feed to fall back to. 404s if no `Site` row is registered for that slug.","tags":["Public read"],"parameters":[{"name":"platform","in":"query","required":true,"description":"The registered site slug to build the feed for.","schema":{"type":"string"},"example":"product-manager"}],"responses":{"200":{"description":"`application/rss+xml` body."},"400":{"description":"`?platform=` was omitted."},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}}},"security":[]}},"/api/public/sitemap.xml":{"get":{"summary":"Sitemap of a site's published posts","description":"Same `?platform=` contract as `/api/public/rss.xml` (required, 404s for an unregistered slug) — a plain XML sitemap of the site's published post URLs. No item cap (G#34): every published post is included. `<lastmod>` is `content_updated_at` (falling back to `updated_at`), never `published_at` — a pure tag/status edit does not bump it. Excludes `noindex` posts and posts whose `canonical_url` points at a different site (a syndicated copy, not this site's canonical source).","tags":["Public read"],"parameters":[{"name":"platform","in":"query","required":true,"description":"The registered site slug to build the sitemap for.","schema":{"type":"string"},"example":"product-manager"}],"responses":{"200":{"description":"`application/xml` body."},"400":{"description":"`?platform=` was omitted."},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}}},"security":[]}},"/api/public/llms.txt":{"get":{"summary":"llms.txt index of a site's published posts","description":"Same `?platform=` contract as `/api/public/rss.xml` (required, 404s for an unregistered slug) — a plain-text `llms.txt` (llmstxt.org convention) listing every published post as a Markdown link with a one-line description. A by-product, per SEO-AEO-GEO-PLAN.md's own framing: near-zero cost, no claim that any crawler treats it specially.","tags":["Public read"],"parameters":[{"name":"platform","in":"query","required":true,"description":"The registered site slug to build the index for.","schema":{"type":"string"},"example":"product-manager"}],"responses":{"200":{"description":"`text/plain` body."},"400":{"description":"`?platform=` was omitted."},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}}},"security":[]}},"/api/public/indexnow-key":{"get":{"summary":"A site's IndexNow verification key","description":"IndexNow (bing.com/indexnow) requires the CONSUMING site to host this exact string at `${site.url}/<key>.txt` before a ping naming that key is trusted — the CMS cannot host that file itself (it lives on the site's own domain), so this is the one door the key comes out of. Generates and persists a key on first read for a site that has never had one (a self-hosted deployment upgrading onto this column needs no manual step).","tags":["Public read"],"parameters":[{"name":"platform","in":"query","required":true,"description":"The registered site slug to fetch the key for.","schema":{"type":"string"},"example":"product-manager"}],"responses":{"200":{"description":"`{data: {key}}`."},"400":{"description":"`?platform=` was omitted."},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}}},"security":[]}},"/api/public/categories":{"get":{"summary":"List categories with published-post counts","tags":["Public read"],"responses":{"200":{"description":"Every category in the organization, with `post_count`."}},"security":[]}},"/api/public/health":{"get":{"summary":"Health check","description":"Pings the database. Used by Caddy's active upstream monitoring.","tags":["Public read"],"responses":{"200":{"description":"Database reachable."},"503":{"description":"Database unreachable."}},"security":[]}},"/api/public/openapi.json":{"get":{"summary":"This OpenAPI 3.1 document","description":"Generated from this spec file at request time. Unauthenticated, CORS-enabled.","tags":["Public read"],"responses":{"200":{"description":"The OpenAPI 3.1 document."}},"security":[]}},"/api/contacts":{"post":{"summary":"Submit an FAQ question","description":"Public for POST only (`PUBLIC_FORM_POSTS` in src/proxy.ts). Accepts only `type: \"question\"`, which feeds the FAQ intake; contact, demo, support and partner inquiries, newsletter sign-ups and the waitlist moved to Interactor CRM (crm.interactor.com) and get 410 here. Every submission is pinned to the Interactor organization regardless of which site it came from.","tags":["Forms"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string","format":"email"},"company":{"type":"string"},"jobTitle":{"type":"string"},"phone":{"type":"string"},"productInterest":{"type":"string"},"country":{"type":"string"},"subject":{"type":"string"},"message":{"type":"string"},"type":{"type":"string","enum":["question"]},"source":{"type":"string"}},"required":["firstName","lastName","email","message","type"]}}}},"responses":{"201":{"description":"Submission stored."},"400":{"description":"Missing required field(s) or an invalid email."},"410":{"description":"Any type other than \"question\": those inquiries go to Interactor CRM."},"500":{"description":"Internal error."}},"security":[]}},"/api/cms/posts":{"get":{"summary":"List posts","description":"`?status=published` is readable by any signed-in caller; any other filter (or no filter) requires `content:view`. A site-scoped token's results are additionally filtered to posts targeting its sites.","tags":["Posts"],"parameters":[{"name":"status","in":"query","required":false,"description":"e.g. `draft`, `published`.","schema":{"type":"string"}},{"name":"type","in":"query","required":false,"description":"Filter by content type.","schema":{"type":"string"}},{"name":"category_id","in":"query","required":false,"description":"Filter by category.","schema":{"type":"string"}},{"name":"site","in":"query","required":false,"description":"A site slug: only posts targeting that site (`Post.platforms` contains it).","schema":{"type":"string"}},{"name":"search","in":"query","required":false,"description":"Case-insensitive text matched against title, slug, excerpt and body (first 200 characters used).","schema":{"type":"string"}},{"name":"workflow_status","in":"query","required":false,"description":"`draft` | `pending_review` | `approved` | `rejected`.","schema":{"type":"string"}},{"name":"published","in":"query","required":false,"description":"`true` is shorthand for `status=published`.","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Default 1.","schema":{"type":"integer"}},{"name":"per_page","in":"query","required":false,"description":"Default 50, capped at 100.","schema":{"type":"integer"}}],"responses":{"200":{"description":"A page of posts."},"401":{"description":"No session cookie and no recognized `Authorization: Bearer cms_pat_...` header.","content":{"application/json":{"example":{"error":"Unauthorized"}}}}},"security":[{"bearerAuth":[]}]},"post":{"summary":"Create a post","tags":["Posts"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string"},"slug":{"type":"string","description":"Defaults to a slugified title."},"content":{"type":"string"},"content_format":{"type":"string","enum":["markdown","html"],"default":"markdown"},"excerpt":{"type":"string"},"status":{"type":"string","enum":["draft","published"],"description":"Publishing requires `content:publish`; otherwise the post is saved as a draft even if `published` is requested."},"type":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"string","minLength":1,"maxLength":64,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"featured_image":{"type":"string"},"featured_image_alt":{"type":"string"},"meta_description":{"type":"string"},"meta_keywords":{"type":"string"},"seo_title":{"type":"string","description":"Overrides `title` in <title>/og:title/twitter:title. Blank clears it."},"canonical_url":{"type":"string","description":"Set only for a syndicated copy of a post published elsewhere first."},"og_image":{"type":"string","description":"Overrides `featured_image` for Open Graph/Twitter cards."},"og_image_alt":{"type":"string"},"noindex":{"type":"boolean","default":false},"answer_summary":{"type":"string","description":"A 40-60 word self-contained answer to the post's question — the TL;DR/AI-answer-engine source."},"redirect_to":{"type":"string","description":"This slug has been superseded: a path or absolute URL a consuming site should permanently redirect readers to."},"mark_updated":{"type":"boolean","description":"Force `content_updated_at` to now even though title/content/content_format/excerpt didn't change."},"category_id":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"platforms":{"type":"array","items":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"string","minLength":1,"maxLength":64,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"description":"Distribution targets. Defaults to `[\"website\"]` when omitted; an empty/all-invalid list is rejected rather than creating an undistributed post."},"author_id":{"type":"string","description":"Reassigning authorship away from the caller requires `content:edit_any`."}}}}}},"responses":{"201":{"description":"Post created. Carries a `warning` field instead of erroring if `status: \"published\"` was requested without `content:publish` — the post is saved as a draft."},"400":{"description":"`platforms` resolved to no valid site."},"403":{"description":"Site-scope refusal (create must target only in-scope sites), or `content:edit_any` needed to set `author_id`."},"409":{"description":"A post with this slug already exists."}},"security":[{"bearerAuth":[]}]}},"/api/cms/posts/{id}":{"get":{"summary":"Get one post","tags":["Posts"],"parameters":[{"name":"id","in":"path","required":true,"description":"The post's database id.","schema":{"type":"string"}}],"responses":{"200":{"description":"The post."},"403":{"description":"The caller's token is site-scoped (see `token.site_scopes` on `GET /api/me`) and this post falls outside it for a \"read\" request. Never a 404 — the post is not a secret from the token's organization.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"token_site_scopes":{"type":"array","items":{"type":"string"}},"post_sites":{"type":"array","items":{"type":"string"}}},"required":["error","token_site_scopes","post_sites"]}}}},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}}},"security":[{"bearerAuth":[]}]},"put":{"summary":"Replace a post's editable fields","description":"Every field is optional — omitted fields are left unchanged. Pass `expected_content_hash` (or an `If-Match` header carrying the post's `content_hash`) for optimistic-concurrency protection; a stale value 409s instead of silently overwriting a newer edit. A site-scoped token must have both the post's current sites AND any new `platforms` within its scope.","tags":["Posts"],"parameters":[{"name":"id","in":"path","required":true,"description":"The post's database id.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string"},"slug":{"type":"string","description":"Defaults to a slugified title."},"content":{"type":"string"},"content_format":{"type":"string","enum":["markdown","html"],"default":"markdown"},"excerpt":{"type":"string"},"status":{"type":"string","enum":["draft","published"],"description":"Publishing requires `content:publish`; otherwise the post is saved as a draft even if `published` is requested."},"type":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"string","minLength":1,"maxLength":64,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"featured_image":{"type":"string"},"featured_image_alt":{"type":"string"},"meta_description":{"type":"string"},"meta_keywords":{"type":"string"},"seo_title":{"type":"string","description":"Overrides `title` in <title>/og:title/twitter:title. Blank clears it."},"canonical_url":{"type":"string","description":"Set only for a syndicated copy of a post published elsewhere first."},"og_image":{"type":"string","description":"Overrides `featured_image` for Open Graph/Twitter cards."},"og_image_alt":{"type":"string"},"noindex":{"type":"boolean","default":false},"answer_summary":{"type":"string","description":"A 40-60 word self-contained answer to the post's question — the TL;DR/AI-answer-engine source."},"redirect_to":{"type":"string","description":"This slug has been superseded: a path or absolute URL a consuming site should permanently redirect readers to."},"mark_updated":{"type":"boolean","description":"Force `content_updated_at` to now even though title/content/content_format/excerpt didn't change."},"category_id":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"platforms":{"type":"array","items":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"string","minLength":1,"maxLength":64,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"description":"Distribution targets. Defaults to `[\"website\"]` when omitted; an empty/all-invalid list is rejected rather than creating an undistributed post."},"author_id":{"type":"string","description":"Reassigning authorship away from the caller requires `content:edit_any`."},"expected_content_hash":{"type":["string","null"],"description":"Optimistic-concurrency guard; alternative to the `If-Match` header."}}}}}},"responses":{"200":{"description":"The updated post."},"403":{"description":"Not the post's author (needs `content:edit_any`), or a site-scope refusal."},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}},"409":{"description":"Optimistic-concurrency conflict: `expected_content_hash` (or an `If-Match` header) was sent and no longer matches — someone else wrote this post since the caller loaded it. — OR — The new slug collides with another post.","content":{"application/json":{"example":{"error":"This post was edited since you loaded it — re-fetch, re-apply your change, and retry","current_hash":"a1b2c3...","updated_at":"2026-09-12T22:26:22.147Z","last_editor":{"id":"cmtyxp8h50002yof6qpeapon9","name":"API Docs Admin"}}}}}},"security":[{"bearerAuth":[]}]},"delete":{"summary":"Delete a post","description":"Moves the post to the trash: it disappears from every listing and the public API at once and its slug is free again, but `GET /api/cms/posts/trash` lists it and `POST /api/cms/posts/trash/{id}/restore` brings it back (as a draft) for 30 days. Comments and revision history are not kept.","tags":["Posts"],"parameters":[{"name":"id","in":"path","required":true,"description":"The post's database id.","schema":{"type":"string"}}],"responses":{"204":{"description":"Moved to the trash."},"403":{"description":"The caller's token is site-scoped (see `token.site_scopes` on `GET /api/me`) and this post falls outside it for a \"change\" request. Never a 404 — the post is not a secret from the token's organization.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"token_site_scopes":{"type":"array","items":{"type":"string"}},"post_sites":{"type":"array","items":{"type":"string"}}},"required":["error","token_site_scopes","post_sites"]}}}},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}}},"security":[{"bearerAuth":[]}]}},"/api/cms/posts/trash":{"get":{"summary":"List deleted posts (the trash)","description":"Posts deleted in the last 30 days, newest first. `id` is the trash entry (pass it to restore), `post_id` the deleted post's own id. Entries older than 30 days are removed for good. A site-scoped token sees only entries for its sites.","tags":["Posts"],"parameters":[{"name":"search","in":"query","required":false,"description":"Case-insensitive text matched against title and slug.","schema":{"type":"string"}}],"responses":{"200":{"description":"Trash entries and `retention_days`."},"401":{"description":"No session cookie and no recognized `Authorization: Bearer cms_pat_...` header.","content":{"application/json":{"example":{"error":"Unauthorized"}}}}},"security":[{"bearerAuth":[]}]}},"/api/cms/posts/trash/{id}/restore":{"post":{"summary":"Restore a deleted post","description":"Recreates the post from the trash, with its old id when that is still free. It always comes back as a DRAFT, so a restore never republishes anything by itself. Its slug gets a `-restored` suffix if another post took it meanwhile, and its social drafts are linked to it again.","tags":["Posts"],"parameters":[{"name":"id","in":"path","required":true,"description":"The trash entry's id (from the trash list), not the post's.","schema":{"type":"string"}}],"responses":{"201":{"description":"The restored post's id, slug, title and status (`draft`)."},"403":{"description":"The caller's token is site-scoped (see `token.site_scopes` on `GET /api/me`) and this post falls outside it for a \"change\" request. Never a 404 — the post is not a secret from the token's organization.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"token_site_scopes":{"type":"array","items":{"type":"string"}},"post_sites":{"type":"array","items":{"type":"string"}}},"required":["error","token_site_scopes","post_sites"]}}}},"404":{"description":"Not in the trash: already restored, or removed after 30 days."}},"security":[{"bearerAuth":[]}]}},"/api/cms/posts/{id}/social":{"get":{"summary":"A post's social copy","description":"The current draft per network (`linkedin`, `twitter`, `facebook`, `instagram`, `reddit`, `slack`) written for this post: the newest non-archived social post whose source is the post. Networks with none are left out. `editable` is false once the copy has been published. Backs the `list_social_drafts` MCP tool.","tags":["Posts"],"parameters":[{"name":"id","in":"path","required":true,"description":"The post's database id.","schema":{"type":"string"}}],"responses":{"200":{"description":"The drafts."},"403":{"description":"The caller's token is site-scoped (see `token.site_scopes` on `GET /api/me`) and this post falls outside it for a \"read\" request. Never a 404 — the post is not a secret from the token's organization.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"token_site_scopes":{"type":"array","items":{"type":"string"}},"post_sites":{"type":"array","items":{"type":"string"}}},"required":["error","token_site_scopes","post_sites"]}}}},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}}},"security":[{"bearerAuth":[]}]},"put":{"summary":"Write a post's social copy for one network","description":"Saves `body` as the network's draft for this post: edits the current draft, or starts one. Copy that has already been published is never rewritten; saving then starts a new draft. An empty body removes an unscheduled draft (`data: null`, `removed: true`). For an X thread, separate tweets with a line containing only `---`: the copy is stored as its first tweet plus thread parts, and each tweet is published as a reply to the one before. On X, LinkedIn and Facebook a `--- first comment` line starts a comment posted under the post once it is live. Reading answers the same text back, with `parts` beside it. Scheduling and publishing stay in the Social queue. Backs the `save_social_draft` MCP tool.","tags":["Posts"],"parameters":[{"name":"id","in":"path","required":true,"description":"The post's database id.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["network","body"],"properties":{"network":{"type":"string","enum":["linkedin","twitter","facebook","instagram","reddit","slack"]},"body":{"type":"string","maxLength":10000}}}}}},"responses":{"200":{"description":"The saved draft (or null when removed)."},"400":{"description":"Unknown network, or a body that isn't a string."},"403":{"description":"Not the post's own author (needs `content:edit_any`), or a site-scope refusal."},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}}},"security":[{"bearerAuth":[]}]}},"/api/cms/posts/{id}/social/destinations":{"get":{"summary":"Where a post's social copy goes","description":"Every place this post's social copy can be posted to (a Facebook Page, a Slack channel, a subreddit, a manual channel), with `selected` saying whether this post uses it. `state` is `ready`, or `trouble` when the connection needs reconnecting. `overridden` is true when the post made its own choice instead of the channels' defaults. `backlink` is the link each social post carries back to the post, or null when the post has no public address yet.","tags":["Posts"],"parameters":[{"name":"id","in":"path","required":true,"description":"The post's database id.","schema":{"type":"string"}}],"responses":{"200":{"description":"The destinations."},"403":{"description":"The caller's token is site-scoped (see `token.site_scopes` on `GET /api/me`) and this post falls outside it for a \"read\" request. Never a 404 — the post is not a secret from the token's organization.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"token_site_scopes":{"type":"array","items":{"type":"string"}},"post_sites":{"type":"array","items":{"type":"string"}}},"required":["error","token_site_scopes","post_sites"]}}}},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}}},"security":[{"bearerAuth":[]}]},"put":{"summary":"Choose where a post's social copy goes","description":"Stores this post's own choice of destinations and brings its unsent social drafts in line: one target per chosen place of each draft's network. Send `channel_ids: null` to go back to the channels' defaults. Ids that aren't this organization's channels are dropped. Copy that was already submitted, scheduled or published is left as it is.","tags":["Posts"],"parameters":[{"name":"id","in":"path","required":true,"description":"The post's database id.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["channel_ids"],"properties":{"channel_ids":{"type":["array","null"],"items":{"type":"string"},"description":"The channel ids this post's copy goes to, or null for the channels' defaults."}}}}}},"responses":{"200":{"description":"The destinations after the change."},"400":{"description":"`channel_ids` is neither a list of ids nor null."},"403":{"description":"Not the post's own author (needs `content:edit_any`), or a site-scope refusal."},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}}},"security":[{"bearerAuth":[]}]}},"/api/cms/posts/slug/{slug}":{"get":{"summary":"Get one post by slug (authenticated)","description":"Like the public slug lookup, but sees drafts too (with `content:view`) and honors an explicit `?status=` filter.","tags":["Posts"],"parameters":[{"name":"slug","in":"path","required":true,"description":"The post's slug.","schema":{"type":"string"}},{"name":"status","in":"query","required":false,"description":"Restrict the lookup to this status.","schema":{"type":"string"}}],"responses":{"200":{"description":"The post."},"403":{"description":"The caller's token is site-scoped (see `token.site_scopes` on `GET /api/me`) and this post falls outside it for a \"read\" request. Never a 404 — the post is not a secret from the token's organization.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"token_site_scopes":{"type":"array","items":{"type":"string"}},"post_sites":{"type":"array","items":{"type":"string"}}},"required":["error","token_site_scopes","post_sites"]}}}},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}}},"security":[{"bearerAuth":[]}]}},"/api/cms/posts/export":{"get":{"summary":"Bulk-export posts as a Markdown vault (.zip)","description":"An Obsidian-ready vault folder (`content/posts/<slug>.md` per post, frontmatter + body). A site-scoped token exports only posts targeting its sites.","tags":["Posts"],"parameters":[{"name":"status","in":"query","required":false,"description":"Filter by status before exporting.","schema":{"type":"string"}}],"responses":{"200":{"description":"`application/zip` binary body."}},"security":[{"bearerAuth":[]}]}},"/api/cms/posts/{id}/export":{"get":{"summary":"Export one post as a Markdown file","tags":["Posts"],"parameters":[{"name":"id","in":"path","required":true,"description":"The post's database id.","schema":{"type":"string"}}],"responses":{"200":{"description":"`text/markdown` body: frontmatter + content."},"403":{"description":"The caller's token is site-scoped (see `token.site_scopes` on `GET /api/me`) and this post falls outside it for a \"read\" request. Never a 404 — the post is not a secret from the token's organization.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"token_site_scopes":{"type":"array","items":{"type":"string"}},"post_sites":{"type":"array","items":{"type":"string"}}},"required":["error","token_site_scopes","post_sites"]}}}},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}}},"security":[{"bearerAuth":[]}]}},"/api/cms/posts/bulk-delete":{"delete":{"summary":"Delete multiple posts at once","description":"The matched posts go to the trash, like a single delete (restorable for 30 days). A site-scoped token's batch is refused WHOLE if any matched post falls outside its scope — never a silent partial delete.","tags":["Posts"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string"}},"slugs":{"type":"array","items":{"type":"string"}}},"description":"Provide `ids` or `slugs` (ids take precedence if both are present)."}}}},"responses":{"204":{"description":"Matched posts deleted (or nothing matched)."},"403":{"description":"Site-scope batch refusal, naming the out-of-scope posts."}},"security":[{"bearerAuth":[]}]}},"/api/cms/posts/generate-seo":{"post":{"summary":"Heuristically generate SEO fields from a title/content","description":"Pure text heuristics (word frequency + truncation) — no AI call. Powers the editor's \"Generate SEO\" button.","tags":["Posts"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string"},"content":{"type":"string"}},"description":"At least one of `title`/`content` is required."}}}},"responses":{"200":{"description":"Suggested meta_description, meta_keywords, excerpt, featured_image_alt."},"400":{"description":"Both `title` and `content` were empty."}},"security":[{"bearerAuth":[]}]}},"/api/cms/posts/import":{"post":{"summary":"Import a Markdown file (frontmatter + body)","description":"The write side of the file-based sync feature. Upserts by the frontmatter's `slug`/`id`; `?force=true` bypasses the optimistic-concurrency conflict check. A site-scoped token may only import into its own sites.","tags":["Posts"],"parameters":[{"name":"force","in":"query","required":false,"description":"Bypass the conflict check.","schema":{"type":"boolean"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"raw":{"type":"string","description":"The full file content, frontmatter + body."},"filename":{"type":"string"}},"required":["raw"]}}}},"responses":{"200":{"description":"Existing post updated."},"201":{"description":"New post created."},"400":{"description":"Malformed frontmatter or missing `raw`."},"409":{"description":"Conflict: the base hash in the frontmatter no longer matches (someone edited in the CMS since)."}},"security":[{"bearerAuth":[]}]}},"/api/cms/posts/{id}/workflow":{"post":{"summary":"Advance a post through the review workflow","description":"draft → pending_review (`submit`) → `approve`/`reject`, or `publish`/`unpublish` directly for `content:publish` holders. Each action has its own permission and valid preceding state — see the 403/409 responses.","tags":["Posts"],"parameters":[{"name":"id","in":"path","required":true,"description":"The post's database id.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"action":{"type":"string","enum":["submit","approve","reject","publish","unpublish"]},"comments":{"type":"string"},"reason":{"type":"string","description":"Used by `reject`; falls back to `comments`."}},"required":["action"]}}}},"responses":{"200":{"description":"The post in its new state. For a token caller, `submit` and `publish` also return `humanizer`: `{ version, reviewed, warnings }`, the passages that read as AI-written (advisory, never a refusal)."},"400":{"description":"Unknown or missing `action`."},"403":{"description":"Missing the action's permission (`content:approve`/`content:reject`/`content:publish`), or not the post's own author for `submit`. — OR — The caller's token is site-scoped (see `token.site_scopes` on `GET /api/me`) and this post falls outside it for a \"change\" request. Never a 404 — the post is not a secret from the token's organization.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"token_site_scopes":{"type":"array","items":{"type":"string"}},"post_sites":{"type":"array","items":{"type":"string"}}},"required":["error","token_site_scopes","post_sites"]}}}},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}},"409":{"description":"The post isn't in the state the action requires (e.g. approving a non-pending post)."}},"security":[{"bearerAuth":[]}]},"get":{"summary":"Get a post's approval history","tags":["Posts"],"parameters":[{"name":"id","in":"path","required":true,"description":"The post's database id.","schema":{"type":"string"}}],"responses":{"200":{"description":"Every `ContentApproval` row for this post, newest first."}},"security":[{"bearerAuth":[]}]}},"/api/cms/posts/{id}/resolve-conflict":{"post":{"summary":"Resolve a file-sync conflict by keeping the CMS version","description":"Clears `sync_conflict` and `last_synced_hash` so the next outbound sync sweep re-pushes the CMS's current content, overwriting the git side.","tags":["Posts"],"parameters":[{"name":"id","in":"path","required":true,"description":"The post's database id.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"expected_content_hash":{"type":["string","null"]}}}}}},"responses":{"200":{"description":"The post with `sync_conflict: false`."},"403":{"description":"The caller's token is site-scoped (see `token.site_scopes` on `GET /api/me`) and this post falls outside it for a \"change\" request. Never a 404 — the post is not a secret from the token's organization.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"token_site_scopes":{"type":"array","items":{"type":"string"}},"post_sites":{"type":"array","items":{"type":"string"}}},"required":["error","token_site_scopes","post_sites"]}}}},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}},"409":{"description":"Optimistic-concurrency conflict: `expected_content_hash` (or an `If-Match` header) was sent and no longer matches — someone else wrote this post since the caller loaded it.","content":{"application/json":{"example":{"error":"This post was edited since you loaded it — re-fetch, re-apply your change, and retry","current_hash":"a1b2c3...","updated_at":"2026-09-12T22:26:22.147Z","last_editor":{"id":"cmtyxp8h50002yof6qpeapon9","name":"API Docs Admin"}}}}}},"security":[{"bearerAuth":[]}]}},"/api/cms/posts/{id}/revisions":{"post":{"summary":"Save a labelled checkpoint of a post","description":"Snapshots the post as it is now under a label (\"Before rewriting the intro\"), so a big change is one restore away. Labelled checkpoints are exempt from age-based thinning. If the newest revision already holds exactly this state it is labelled and returned (200) rather than duplicated.","tags":["Posts"],"parameters":[{"name":"id","in":"path","required":true,"description":"The post's database id.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string","maxLength":200}},"required":["label"]}}}},"responses":{"200":{"description":"The newest revision already matched; it now carries the label."},"201":{"description":"The new checkpoint's metadata."},"400":{"description":"Missing label, or longer than 200 characters."},"403":{"description":"Not the post's own author (needs `content:edit_any`), or a site-scope refusal."},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}}},"security":[{"bearerAuth":[]}]},"get":{"summary":"List a post's revision history (metadata only)","description":"Paginated, newest first; no `content`/`content_html` bodies — fetch a single revision for the full snapshot.","tags":["Posts"],"parameters":[{"name":"id","in":"path","required":true,"description":"The post's database id.","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Default 1.","schema":{"type":"integer"}},{"name":"per_page","in":"query","required":false,"description":"Default 50, capped at 100.","schema":{"type":"integer"}}],"responses":{"200":{"description":"A page of revision metadata."},"403":{"description":"The caller's token is site-scoped (see `token.site_scopes` on `GET /api/me`) and this post falls outside it for a \"read\" request. Never a 404 — the post is not a secret from the token's organization.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"token_site_scopes":{"type":"array","items":{"type":"string"}},"post_sites":{"type":"array","items":{"type":"string"}}},"required":["error","token_site_scopes","post_sites"]}}}},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}}},"security":[{"bearerAuth":[]}]}},"/api/cms/posts/{id}/revisions/{revisionId}":{"get":{"summary":"Get one revision's full snapshot","tags":["Posts"],"parameters":[{"name":"id","in":"path","required":true,"description":"The post's database id.","schema":{"type":"string"}},{"name":"revisionId","in":"path","required":true,"description":"The revision's id.","schema":{"type":"string"}}],"responses":{"200":{"description":"The full revision, including content and content_html."},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}}},"security":[{"bearerAuth":[]}]}},"/api/cms/posts/{id}/revisions/{revisionId}/restore":{"post":{"summary":"Restore a post to an earlier revision","description":"The post's CURRENT state is snapshotted first (`source: \"restore\"`), so a restore is itself always undoable.","tags":["Posts"],"parameters":[{"name":"id","in":"path","required":true,"description":"The post's database id.","schema":{"type":"string"}},{"name":"revisionId","in":"path","required":true,"description":"The revision to restore.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"expected_content_hash":{"type":["string","null"]}}}}}},"responses":{"200":{"description":"The restored post."},"403":{"description":"The caller's token is site-scoped (see `token.site_scopes` on `GET /api/me`) and this post falls outside it for a \"change\" request. Never a 404 — the post is not a secret from the token's organization.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"token_site_scopes":{"type":"array","items":{"type":"string"}},"post_sites":{"type":"array","items":{"type":"string"}}},"required":["error","token_site_scopes","post_sites"]}}}},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}},"409":{"description":"Optimistic-concurrency conflict: `expected_content_hash` (or an `If-Match` header) was sent and no longer matches — someone else wrote this post since the caller loaded it.","content":{"application/json":{"example":{"error":"This post was edited since you loaded it — re-fetch, re-apply your change, and retry","current_hash":"a1b2c3...","updated_at":"2026-09-12T22:26:22.147Z","last_editor":{"id":"cmtyxp8h50002yof6qpeapon9","name":"API Docs Admin"}}}}}},"security":[{"bearerAuth":[]}]}},"/api/cms/posts/{id}/preview-link":{"post":{"summary":"Mint (or refresh) a signed preview link","description":"Gated the same as editing the post — minting a link hands out read access to unpublished content. The link expires in 7 days and replacing it invalidates any previously issued token for this post.","tags":["Posts"],"parameters":[{"name":"id","in":"path","required":true,"description":"The post's database id.","schema":{"type":"string"}}],"responses":{"200":{"description":"The signed preview URL and its expiry."},"403":{"description":"Not the post's own author (needs `content:edit_any`), or a site-scope refusal."},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}}},"security":[{"bearerAuth":[]}]},"delete":{"summary":"Revoke a post's active preview link","tags":["Posts"],"parameters":[{"name":"id","in":"path","required":true,"description":"The post's database id.","schema":{"type":"string"}}],"responses":{"204":{"description":"Revoked (or there was none)."},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}}},"security":[{"bearerAuth":[]}]}},"/api/cms/posts/{id}/seo-check":{"get":{"summary":"Search & AI readiness check (G#32)","description":"The same check the publish/approve workflow actions gate on (src/lib/seo-readiness.ts): `errors` (meta description length, effective title length, slug format, no `<h1>` in body, image alt text, answer_summary length, heading-level skips) block that transition; `warnings` (question-phrased H2s, internal/outbound links, a cited statistic, a definitional opening sentence, a duplicate title elsewhere in the org, title/meta near-duplication) are advisory only. Read-only, and an existing published post is never retro-blocked by calling this — only the workflow gate refuses a transition. Warnings whose key starts with `humanizer_` are passages that read as AI-written (src/lib/humanizer): text rules always, plus a model review against the Humanizer rules (`humanizer_review`) when an AI key is configured. `humanizer.reviewed` says whether that review ran; `?humanizer_review=false` skips it.","tags":["Posts"],"parameters":[{"name":"id","in":"path","required":true,"description":"The post's database id.","schema":{"type":"string"}}],"responses":{"200":{"description":"The readiness result."},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}}},"security":[{"bearerAuth":[]}]}},"/api/cms/writer-list":{"post":{"summary":"Open the writer's post list (Interactor CMS plugin)","description":"Backs the `open_post_list` MCP tool. Returns `list_url`: the writer's post list page with a short-lived browse key in its URL fragment, for Claude to open in the app's browser panel, where clicking a post opens it in the editor. The key lists this organization's posts (narrowed to `site` and the token's site scope) and opens them, nothing else; it expires in 8 hours, ends when the minting token is revoked, and replaces the caller's previous list key.","tags":["Posts"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"site":{"type":"string"},"search":{"type":"string","maxLength":200}}}}}},"responses":{"200":{"description":"`list_url`, the site it shows, and the key's expiry."},"400":{"description":"Unknown site."},"403":{"description":"The site is outside the token's site scope."}},"security":[{"bearerAuth":[]}]}},"/api/cms/writer-mirror":{"post":{"summary":"Start the local posts folder mirror (Interactor CMS plugin)","description":"Backs the `open_mirror` MCP tool. Returns a mirror key for the plugin's local posts folder: it lists this workspace's posts (the workspace's site, or `site`, within the token's site scope) and reads and saves their Markdown files through the plugin's private `/api/edit/mirror/*` protocol, under the same checks as editing the post. It never creates or deletes a post or changes its status. It expires in 8 hours, ends when the minting token is revoked, and replaces the caller's previous mirror key for the same site.","tags":["Posts"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"site":{"type":"string"}}}}}},"responses":{"200":{"description":"The workspace, `mirror_key`, `mirror_url`, the site and the key's expiry."},"400":{"description":"Unknown site."},"403":{"description":"The site is outside the token's site scope."}},"security":[{"bearerAuth":[]}]}},"/api/cms/posts/{id}/edit-session":{"post":{"summary":"Open a post for live editing (Interactor CMS plugin)","description":"Backs the `open_for_editing` MCP tool. Returns the post's live preview link (reusing an active one), a one-post edit key for the plugin's local sync tool, and `editor_url`, the writer editor (the post formatted and typed on directly) with the key in its URL fragment. The key authenticates only `/api/edit/*`, only for this post, expires in 8 hours, ends when the minting token is revoked, and replaces any key the caller already held for the post. `editor_url` also carries a post-list key (`&list=`) for the editor's \"All posts\" link; an optional JSON body `{ \"site\": \"<slug>\" }` narrows that list to one site.","tags":["Posts"],"parameters":[{"name":"id","in":"path","required":true,"description":"The post's database id.","schema":{"type":"string"}}],"responses":{"200":{"description":"Preview URL, edit key and its expiry, and the sync file URL."},"403":{"description":"Not the post's own author (needs `content:edit_any`), or a site-scope refusal."},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}}},"security":[{"bearerAuth":[]}]}},"/api/cms/posts/{id}/featured-image":{"post":{"summary":"Generate a title-card featured image","description":"Renders a 1200×630 title card (post title, category, organization, author) on the CMS server — no image model, no third-party service, no cost — stores it in the media library, and sets it as the post's `featured_image`. Replaces an existing featured image; sets `featured_image_alt` only when it is empty. Publishing a post that has no featured image does this automatically, so call this only to preview or refresh the card.","tags":["Posts"],"parameters":[{"name":"id","in":"path","required":true,"description":"The post's database id.","schema":{"type":"string"}}],"responses":{"201":{"description":"The post's new `featured_image`/`featured_image_alt` and the created media id."},"403":{"description":"Not the post's own author (needs `content:edit_any`), or a site-scope refusal."},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}},"502":{"description":"Rendering or storage failed; the post is unchanged."}},"security":[{"bearerAuth":[]}]}},"/api/cms/posts/{id}/content":{"patch":{"summary":"Anchored find/replace edit of a post's content","description":"A token-cheaper alternative to PUT for a small, localized change. Every `find` anchor must match `expected_occurrences` times (default 1, applied in order — a later anchor may target text an earlier replacement just introduced); a zero-match or ambiguous anchor refuses the WHOLE call with a 400 naming which replacement failed and how many matches it found, before anything is written.","tags":["Posts"],"parameters":[{"name":"id","in":"path","required":true,"description":"The post's database id.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"replacements":{"type":"array","minItems":1,"items":{"type":"object","properties":{"find":{"type":"string","minLength":1},"replace":{"type":"string"},"expected_occurrences":{"type":"integer","minimum":1,"default":1}},"required":["find","replace"]}},"expected_content_hash":{"type":["string","null"]}},"required":["replacements"]}}}},"responses":{"200":{"description":"The post with the replacements applied (or unchanged, if the replacements were a no-op)."},"400":{"description":"A replacement's anchor matched the wrong number of times; names which one and how many matches were found."},"403":{"description":"The caller's token is site-scoped (see `token.site_scopes` on `GET /api/me`) and this post falls outside it for a \"change\" request. Never a 404 — the post is not a secret from the token's organization.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"token_site_scopes":{"type":"array","items":{"type":"string"}},"post_sites":{"type":"array","items":{"type":"string"}}},"required":["error","token_site_scopes","post_sites"]}}}},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}},"409":{"description":"Optimistic-concurrency conflict: `expected_content_hash` (or an `If-Match` header) was sent and no longer matches — someone else wrote this post since the caller loaded it.","content":{"application/json":{"example":{"error":"This post was edited since you loaded it — re-fetch, re-apply your change, and retry","current_hash":"a1b2c3...","updated_at":"2026-09-12T22:26:22.147Z","last_editor":{"id":"cmtyxp8h50002yof6qpeapon9","name":"API Docs Admin"}}}}}},"security":[{"bearerAuth":[]}]}},"/api/cms/categories":{"get":{"summary":"List categories","tags":["Categories"],"responses":{"200":{"description":"Every category, sorted by sort_order then name."}},"security":[{"bearerAuth":[]}]},"post":{"summary":"Create a category","tags":["Categories"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"slug":{"type":"string","description":"Defaults to a slugified name."},"description":{"type":"string"},"color":{"type":"string"},"sort_order":{"type":"integer","default":0}},"required":["name"]}}}},"responses":{"201":{"description":"The created category."},"409":{"description":"A category with this name or slug already exists."}},"security":[{"bearerAuth":[]}]}},"/api/cms/categories/{id}":{"get":{"summary":"Get one category","tags":["Categories"],"parameters":[{"name":"id","in":"path","required":true,"description":"The category's id.","schema":{"type":"string"}}],"responses":{"200":{"description":"The category."},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}}},"security":[{"bearerAuth":[]}]},"put":{"summary":"Update a category","tags":["Categories"],"parameters":[{"name":"id","in":"path","required":true,"description":"The category's id.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"slug":{"type":"string","description":"Defaults to a slugified name."},"description":{"type":"string"},"color":{"type":"string"},"sort_order":{"type":"integer","default":0}}}}}},"responses":{"200":{"description":"The updated category."},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}},"409":{"description":"Name/slug collision."}},"security":[{"bearerAuth":[]}]},"delete":{"summary":"Delete a category","tags":["Categories"],"parameters":[{"name":"id","in":"path","required":true,"description":"The category's id.","schema":{"type":"string"}}],"responses":{"204":{"description":"Deleted."}},"security":[{"bearerAuth":[]}]}},"/api/cms/tags":{"get":{"summary":"List tags in use","description":"A tag is nothing but the posts carrying it — this is the distinct set across posts the caller can see (filtered by site scope for a scoped token).","tags":["Tags"],"parameters":[{"name":"q","in":"query","required":false,"description":"Case-insensitive substring filter.","schema":{"type":"string"}}],"responses":{"200":{"description":"Sorted list of matching tag strings."}},"security":[{"bearerAuth":[]}]},"delete":{"summary":"Remove a tag from every post carrying it","description":"Rewrites every matching post's `tags` array, so it needs `content:edit_any`. A site-scoped token's request is refused whole if the tag appears on any out-of-scope post.","tags":["Tags"],"parameters":[{"name":"tag","in":"query","required":true,"description":"The exact tag to remove.","schema":{"type":"string"}}],"responses":{"204":{"description":"Removed from every post that had it."},"400":{"description":"Missing `tag` query param."},"403":{"description":"Site-scope batch refusal, naming the out-of-scope posts."}},"security":[{"bearerAuth":[]}]}},"/api/cms/media":{"get":{"summary":"List media","tags":["Media"],"responses":{"200":{"description":"Every media row, newest first."}},"security":[{"bearerAuth":[]}]},"post":{"summary":"Upload a media file","description":"`multipart/form-data`. Stored on S3 in production; falls back to local `public/uploads` in dev when AWS credentials are absent. Image dimensions are probed best-effort.","tags":["Media"],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","description":"multipart/form-data fields","properties":{"file":{"type":"string","format":"binary","description":"The file to upload."},"alt_text":{"type":"string"},"caption":{"type":"string"}},"required":["file"]}}}},"responses":{"201":{"description":"The created media row."},"400":{"description":"No file provided."}},"security":[{"bearerAuth":[]}]}},"/api/cms/media/{id}":{"get":{"summary":"Get one media row","tags":["Media"],"parameters":[{"name":"id","in":"path","required":true,"description":"The media row's id.","schema":{"type":"string"}}],"responses":{"200":{"description":"The media row."},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}}},"security":[{"bearerAuth":[]}]},"delete":{"summary":"Delete a media row (and its underlying file)","tags":["Media"],"parameters":[{"name":"id","in":"path","required":true,"description":"The media row's id.","schema":{"type":"string"}}],"responses":{"204":{"description":"Deleted."},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}}},"security":[{"bearerAuth":[]}]}},"/api/cms/faqs":{"get":{"summary":"List FAQ entries","description":"Reuses the Post content type's permission set (`content:view`/`create`/...) rather than a parallel `faq:*` set. `?status=published` is readable by any signed-in caller; any other filter (or none) requires `content:view`.","tags":["FAQs"],"parameters":[{"name":"status","in":"query","required":false,"description":"One of: draft, review, published.","schema":{"type":"string"}},{"name":"category","in":"query","required":false,"description":"One of: pricing, self-hosting, security, hosted-fleet, ci, billing.","schema":{"type":"string"}},{"name":"audience","in":"query","required":false,"description":"One of: public, sales-only.","schema":{"type":"string"}}],"responses":{"200":{"description":"Matching FAQ entries."}},"security":[{"bearerAuth":[]}]},"post":{"summary":"Create a FAQ entry","tags":["FAQs"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"question":{"type":"string"},"answer":{"type":"string"},"slug":{"type":"string","description":"Defaults to a slugified question."},"category":{"type":"string","enum":["pricing","self-hosting","security","hosted-fleet","ci","billing"]},"audience":{"type":"string","enum":["public","sales-only"],"default":"sales-only"},"status":{"type":"string","enum":["draft","review","published"],"default":"draft","description":"Publishing requires `content:publish`; otherwise the FAQ is saved as a draft even if `published` is requested."},"last_verified":{"type":["string","null"],"format":"date-time"},"verify_every_days":{"type":"integer","default":365},"sources":{"type":"array","items":{"type":"string"}},"related":{"type":"array","items":{"type":"string"},"description":"Slugs of other FAQ entries."}},"required":["question","answer","category"]}}}},"responses":{"201":{"description":"Created. Carries a `warning` instead of erroring if `published` was requested without `content:publish`."},"400":{"description":"Missing question/answer, or an invalid category/audience/status."},"409":{"description":"A FAQ with this slug already exists."}},"security":[{"bearerAuth":[]}]}},"/api/cms/faqs/{id}":{"get":{"summary":"Get one FAQ entry, with its answer revision history","tags":["FAQs"],"parameters":[{"name":"id","in":"path","required":true,"description":"The FAQ's database id.","schema":{"type":"string"}}],"responses":{"200":{"description":"The FAQ, including `revisions`."},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}}},"security":[{"bearerAuth":[]}]},"put":{"summary":"Update a FAQ entry","description":"A change to `answer` snapshots the OUTGOING answer into `FaqRevision` first. A status transition to/from `published` without `content:publish` is silently dropped (the rest of the update still applies).","tags":["FAQs"],"parameters":[{"name":"id","in":"path","required":true,"description":"The FAQ's database id.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"question":{"type":"string"},"answer":{"type":"string"},"slug":{"type":"string","description":"Defaults to a slugified question."},"category":{"type":"string","enum":["pricing","self-hosting","security","hosted-fleet","ci","billing"]},"audience":{"type":"string","enum":["public","sales-only"],"default":"sales-only"},"status":{"type":"string","enum":["draft","review","published"],"default":"draft","description":"Publishing requires `content:publish`; otherwise the FAQ is saved as a draft even if `published` is requested."},"last_verified":{"type":["string","null"],"format":"date-time"},"verify_every_days":{"type":"integer","default":365},"sources":{"type":"array","items":{"type":"string"}},"related":{"type":"array","items":{"type":"string"},"description":"Slugs of other FAQ entries."}}}}}},"responses":{"200":{"description":"The updated FAQ."},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}},"409":{"description":"Slug collision."}},"security":[{"bearerAuth":[]}]},"delete":{"summary":"Delete a FAQ entry","tags":["FAQs"],"parameters":[{"name":"id","in":"path","required":true,"description":"The FAQ's database id.","schema":{"type":"string"}}],"responses":{"204":{"description":"Deleted."}},"security":[{"bearerAuth":[]}]}},"/api/cms/content-types":{"get":{"summary":"List the organization's content-type registry","description":"Merges registered rows with built-in seeds (blog/news/announcement/article) and any type already in use but never registered — for discoverability, not enforcement (`Post.type` carries no FK to this table).","tags":["Content types"],"responses":{"200":{"description":"The merged list."}},"security":[{"bearerAuth":[]}]},"post":{"summary":"Register a content type","tags":["Content types"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"slug":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"string","minLength":1,"maxLength":64,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"name":{"type":"string","description":"Defaults to a title-cased slug."},"description":{"type":"string"},"sort_order":{"type":"integer","default":100}},"required":["slug"]}}}},"responses":{"201":{"description":"The created content type."},"400":{"description":"Invalid slug (must be lowercase kebab-case)."},"409":{"description":"A content type with this name or slug already exists."}},"security":[{"bearerAuth":[]}]}},"/api/cms/sites":{"get":{"summary":"List the organization's distribution-target registry","description":"Merges registered rows with built-in seeds (`website`) and any slug already in use on a post but never registered.","tags":["Sites"],"responses":{"200":{"description":"The merged list."}},"security":[{"bearerAuth":[]}]},"post":{"summary":"Register a distribution target","tags":["Sites"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"slug":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"string","minLength":1,"maxLength":64,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"name":{"type":"string","description":"Defaults to a title-cased slug."},"description":{"type":"string"},"sort_order":{"type":"integer","default":100}},"required":["slug"]}}}},"responses":{"201":{"description":"The created site."},"400":{"description":"Invalid slug."},"409":{"description":"A site with this name or slug already exists."}},"security":[{"bearerAuth":[]}]}},"/api/cms/sites/{id}":{"put":{"summary":"Rename or update a site","description":"A built-in seed has no row here (its id is `builtin:<slug>`), so it 404s — registering a row with the same slug is how an org overrides a seed.","tags":["Sites"],"parameters":[{"name":"id","in":"path","required":true,"description":"The site's database id (not `builtin:...`).","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"slug":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"string","minLength":1,"maxLength":64,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"name":{"type":"string"},"description":{"type":"string"},"sort_order":{"type":"integer"}}}}}},"responses":{"200":{"description":"The updated site."},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}},"409":{"description":"Name/slug collision."}},"security":[{"bearerAuth":[]}]},"delete":{"summary":"Remove a site from the registry","description":"Refuses while any post still targets the slug — `Post.platforms` carries no FK, so nothing else would stop a post from silently pointing at a site the editor no longer offers.","tags":["Sites"],"parameters":[{"name":"id","in":"path","required":true,"description":"The site's database id.","schema":{"type":"string"}}],"responses":{"204":{"description":"Removed."},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}},"409":{"description":"One or more posts still target this site."}},"security":[{"bearerAuth":[]}]}},"/api/cms/comments":{"get":{"summary":"List comments for moderation","description":"Matches the admin gating used for the other submission-review surfaces (`admin:access`) rather than a `content:*` permission. Note: the response is a bare array, not `{ data: [...] }`.","tags":["Comments"],"parameters":[{"name":"status","in":"query","required":false,"description":"`pending` | `published` | `spam` | `rejected`.","schema":{"type":"string"}}],"responses":{"200":{"description":"A bare array of comments, newest first."}},"security":[{"bearerAuth":[]}]}},"/api/cms/comments/{id}":{"patch":{"summary":"Moderate a comment's status","tags":["Comments"],"parameters":[{"name":"id","in":"path","required":true,"description":"The comment's id.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["pending","published","spam","rejected"]}},"required":["status"]}}}},"responses":{"200":{"description":"`{ id, status }`."},"400":{"description":"Invalid status."},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}}},"security":[{"bearerAuth":[]}]},"delete":{"summary":"Delete a comment","tags":["Comments"],"parameters":[{"name":"id","in":"path","required":true,"description":"The comment's id.","schema":{"type":"string"}}],"responses":{"200":{"description":"`{ success: true }` — 200 even if nothing matched."}},"security":[{"bearerAuth":[]}]}},"/api/cms/tokens":{"get":{"summary":"List the caller's own personal access tokens","description":"Session-only by design — a leaked token must never be usable to enumerate, mint, or revoke other tokens. A `cms_pat_...` bearer here is refused with the same 401 as no credential at all.","tags":["Tokens"],"responses":{"200":{"description":"The caller's tokens (never the secret, only `token_prefix`)."},"401":{"description":"No session cookie and no recognized `Authorization: Bearer cms_pat_...` header.","content":{"application/json":{"example":{"error":"Unauthorized"}}}}},"security":[]},"post":{"summary":"Mint a new personal access token","description":"Session-only, for the same reason as GET. The raw token is returned exactly once, in this response.","tags":["Tokens"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"organization_id":{"type":"string","description":"Defaults to the session's active org; must be one of the caller's own memberships."},"site_scopes":{"type":"array","items":{"type":"string"},"description":"Defaults to unscoped (every site in the org)."},"expires_in_days":{"type":"number"}},"required":["name"]}}}},"responses":{"201":{"description":"`{ data: { ...token metadata, token: \"cms_pat_...\" } }`."},"400":{"description":"Missing name, or an unknown site slug."},"401":{"description":"No session cookie and no recognized `Authorization: Bearer cms_pat_...` header.","content":{"application/json":{"example":{"error":"Unauthorized"}}}},"403":{"description":"`organization_id` names an org the caller doesn't belong to."}},"security":[]}},"/api/cms/tokens/{id}":{"delete":{"summary":"Revoke a personal access token","description":"Session-only. Revokes (keeps the audit row) rather than deleting. Only the token's own owner may revoke it.","tags":["Tokens"],"parameters":[{"name":"id","in":"path","required":true,"description":"The token's id.","schema":{"type":"string"}}],"responses":{"204":{"description":"Revoked."},"401":{"description":"No session cookie and no recognized `Authorization: Bearer cms_pat_...` header.","content":{"application/json":{"example":{"error":"Unauthorized"}}}},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}}},"security":[]}},"/api/cms/tokens/sites":{"get":{"summary":"List the sites a new token for an organization may be scoped to","description":"Session-only. Backs the token-minting dialog's site picker — answers for `?organization_id=`, not the caller's active org, so a multi-org user picking another org in the dialog sees the right list.","tags":["Tokens"],"parameters":[{"name":"organization_id","in":"query","required":false,"description":"Defaults to the session's active org.","schema":{"type":"string"}}],"responses":{"200":{"description":"The named organization's sites."},"401":{"description":"No session cookie and no recognized `Authorization: Bearer cms_pat_...` header.","content":{"application/json":{"example":{"error":"Unauthorized"}}}},"403":{"description":"Not a member of that organization."}},"security":[]}},"/api/automation/faq":{"post":{"summary":"Draft a FAQ entry from the intake pipeline","description":"For the intake/freshness automation, not the CMS UI. Always creates the FAQ as `status: \"draft\"` regardless of any `status` sent — publishing is structurally a human action in the CMS UI, not a permission this token could be granted.","tags":["Automation"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"question":{"type":"string"},"answer":{"type":"string","description":"Defaults to the literal string \"TODO\" when omitted."},"category":{"type":"string","enum":["pricing","self-hosting","security","hosted-fleet","ci","billing"]},"audience":{"type":"string","enum":["public","sales-only"],"default":"sales-only"},"slug":{"type":"string"},"sources":{"type":"array","items":{"type":"string"}},"related":{"type":"array","items":{"type":"string"}},"verify_every_days":{"type":"integer","default":365}},"required":["question","category"]}}}},"responses":{"201":{"description":"The created draft FAQ."},"400":{"description":"Missing question, or an invalid category/audience."},"409":{"description":"Slug collision."}},"security":[{"bearerAuth":[]}]}},"/api/automation/faq/{id}":{"patch":{"summary":"Update a FAQ entry from the freshness pipeline","description":"Structurally refuses `status: \"published\"` with a 403 — unconditionally, not merely \"unless the token lacks content:publish\". `increment_asked_count: true` bumps the freshness counter.","tags":["Automation"],"parameters":[{"name":"id","in":"path","required":true,"description":"The FAQ's database id.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"question":{"type":"string"},"answer":{"type":"string"},"category":{"type":"string","enum":["pricing","self-hosting","security","hosted-fleet","ci","billing"]},"audience":{"type":"string","enum":["public","sales-only"]},"status":{"type":"string","enum":["draft","review"],"description":"`published` is always refused (403) — see below."},"last_verified":{"type":["string","null"],"format":"date-time"},"verify_every_days":{"type":"integer"},"sources":{"type":"array","items":{"type":"string"}},"related":{"type":"array","items":{"type":"string"}},"increment_asked_count":{"type":"boolean"}}}}}},"responses":{"200":{"description":"The updated FAQ."},"400":{"description":"`status` was neither `draft` nor `review`, or an invalid category/audience."},"403":{"description":"`status: \"published\"` was requested — always refused on this endpoint."},"404":{"description":"No resource with that id/slug in this organization.","content":{"application/json":{"example":{"error":"Not found"}}}}},"security":[{"bearerAuth":[]}]}},"/api/cms/workspaces":{"get":{"summary":"List the workspaces a connection can reach","description":"A workspace is `<account email>/<organization slug>/<site slug>` (the site part optional). A connection made with \"All my organizations\" on the connector's consent page is not bound to one organization: it reaches every organization its accounts belong to (the owner's, plus any added with \"Add another account\"), and each request says where it acts with an `X-CMS-Workspace` header (MCP tools: the `workspace` argument). Without one, such a request is refused with the list, unless the connection reaches exactly one organization. The site part narrows the request like a token site scope. A one-organization token accepts a workspace naming its own organization (to narrow to a site) and refuses any other. Backs the `list_workspaces` MCP tool. With a browser session, lists the signed-in account's organizations.","tags":["Identity"],"responses":{"200":{"description":"`all_organizations`, the connection's `accounts`, and `workspaces`."},"401":{"description":"No session cookie and no recognized `Authorization: Bearer cms_pat_...` header.","content":{"application/json":{"example":{"error":"Unauthorized"}}}}},"security":[{"bearerAuth":[]}]}},"/api/me":{"get":{"summary":"Who am I, and what may I do","description":"The one endpoint that answers what the caller is allowed to do — call this first with a new token, and again after any refusal, before assuming a permission is missing. A token carries no scopes of its own: `permissions` is always the owner's live membership role in the org the token is bound to.","tags":["Identity"],"responses":{"200":{"description":"Actor, organization, membership role, flattened permissions, and (for a token) its identity."},"401":{"description":"No session cookie and no recognized `Authorization: Bearer cms_pat_...` header.","content":{"application/json":{"example":{"error":"Unauthorized"}}}}},"security":[{"bearerAuth":[]}]}},"/api/mcp":{"post":{"summary":"Remote MCP server (Streamable HTTP, stateless)","description":"For LLM clients (Claude Code, Claude Desktop, any MCP client) to manage CMS content — every tool delegates in-process to the matching `/api/cms` route with the same bearer, so RBAC/tenancy/sanitization are the REST API's own. Authenticates with a personal access token ONLY — unlike the `pat-or-session` endpoints elsewhere in this document, a browser session cookie is never accepted here, since an MCP client has no session to send. A missing/invalid token gets a 401 with a `WWW-Authenticate: Bearer` challenge before any JSON-RPC handling, so MCP clients' own auth discovery works.","tags":["MCP"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"A JSON-RPC 2.0 request per the MCP Streamable HTTP transport (e.g. `initialize`, `tools/list`, `tools/call`)."}}}},"responses":{"200":{"description":"A `text/event-stream` (or plain JSON) JSON-RPC response."},"401":{"description":"Missing, malformed, unknown, revoked, or expired token.","content":{"application/json":{"example":{"error":"Unauthorized: pass a personal access token as 'Authorization: Bearer cms_pat_...'"}}}}},"security":[{"bearerAuth":[]}]}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"cms_pat","description":"A personal access token from /settings/tokens, sent as `Authorization: Bearer cms_pat_...`."}}}}