Documentation
Connect an agent, connect a website, and the reference for everything in between.
Concepts
A workspace holds the content of one website. Inside it, content types describe the kinds of content you publish (blog posts, landing pages, authors) and entries are the individual pieces.
Every entry has a title, a slug, a status, a publish date and search settings. A content type adds its own fields on top: Markdown, text, images, tags, references to other entries and more. New workspaces start with a post type that has an excerpt, cover image, body, tags and author.
There are two kinds of API key:
- Public keys (
cp_pub_…) read the published content of one workspace. They are safe to use in front-end code. - Secret keys (
cp_sk_…) are for agents and servers. Each one has its own permissions (read only, drafts only, publishing, or full access), can be limited to one workspace, and expires on a date you choose. Rotate or revoke them under API keys.
Connect an agent
CitrusPeel is a Model Context Protocol (MCP) server. Every action in the dashboard is exposed as a tool, so a connected agent can do anything you can. The server address is:
https://studio.citruspeel.app/mcpClaude and ChatGPT
Add a custom connector in the app’s settings and paste the address above. The app opens CitrusPeel in your browser so you can approve the connection; there is no key to copy. You can disconnect it at any time under API keys in the dashboard.
Claude Code
claude mcp add --transport http citruspeel https://studio.citruspeel.app/mcpThen run /mcp inside Claude Code to sign in.
Clients configured with JSON
Clients that support OAuth need only the URL. Otherwise create a secret key under API keys and send it as a header:
{
"mcpServers": {
"citruspeel": {
"url": "https://studio.citruspeel.app/mcp",
"headers": {
"Authorization": "Bearer cp_sk_YOUR_SECRET_KEY"
}
}
}
}Your own agents and scripts
Each action is also a plain HTTP call. Send a JSON body to /api/actions/{name} with a secret key. GET https://studio.citruspeel.app/api/actions returns every action with a JSON Schema for its input.
curl -X POST https://studio.citruspeel.app/api/actions/create_entry \
-H "Authorization: Bearer cp_sk_YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"workspace": "my-site",
"type": "post",
"title": "How to dial in espresso grind size",
"fields": { "body": "## Why grind size matters\n\n...", "tags": ["espresso"] },
"seo": { "keyword": "espresso grind size" }
}'The response contains the saved entry and an seoReport with a score and a list of checks. Agents use it as a feedback loop: create a draft, read the warnings, fix them with update_entry, then call publish_entry.
What to tell your agent
Fill in the description of each workspace under Settings: who the site is for and how it should sound. Agents read it before writing. After that, requests can be as short as “write three posts for my coffee site about grinders, as drafts”.
Connect a website
Install the client and create a public key under API keys.
npm install citruspeelimport { createClient } from 'citruspeel';
export const cms = createClient({
apiKey: process.env.CITRUSPEEL_KEY!, // cp_pub_...
baseUrl: 'https://studio.citruspeel.app',
});
// A page of posts (bodies are left out of listings)
const { entries, hasMore } = await cms.entries.list({ type: 'post', limit: 10 });
// One post with rendered HTML. Returns null when it does not exist.
const post = await cms.entries.get('my-post-slug', { type: 'post' });
post.rendered.body.html; // HTML with heading ids and sized, lazy-loaded images
post.rendered.body.toc; // [{ id, text, level }]
post.readingMinutes;
post.fields.cover; // { url, width, height, alt }
post.seo; // { title, description, canonical, image, noindex }Next.js
Metadata, structured data and a sitemap, using the helpers that ship with the client:
// app/blog/[slug]/page.tsx
import { metadata, articleJsonLd, jsonLdScript, type PostFields } from 'citruspeel';
import { notFound } from 'next/navigation';
import { cms } from '@/lib/cms';
export async function generateStaticParams() {
return (await cms.entries.all({ type: 'post' })).map((p) => ({ slug: p.slug }));
}
export async function generateMetadata({ params }) {
const post = await cms.entries.get((await params).slug, { type: 'post' });
return post ? metadata(post, { siteName: 'My site' }) : {};
}
export default async function Page({ params }) {
const post = await cms.entries.get<PostFields>((await params).slug, { type: 'post' });
if (!post) notFound();
return (
<article>
<h1>{post.title}</h1>
<div dangerouslySetInnerHTML={{ __html: post.rendered.body!.html }} />
<script type="application/ld+json"
dangerouslySetInnerHTML={{ __html: jsonLdScript(articleJsonLd(post)) }} />
</article>
);
}// app/sitemap.xml/route.ts
import { sitemapXml } from 'citruspeel';
import { cms } from '@/lib/cms';
export async function GET() {
const xml = sitemapXml(await cms.sitemap(), {
baseUrl: 'https://example.com',
staticPages: [{ path: '/' }, { path: '/blog' }],
});
return new Response(xml, { headers: { 'content-type': 'application/xml' } });
}To cache with Next.js and refresh on publish, pass fetchOptions: { next: { tags: ['cms'] } } to createClient and call revalidateTag('cms') from a webhook route (see below).
Other helpers
metaTags(entry)returns the same metadata as HTML tags, for Astro, SvelteKit, Remix or plain templates.rssXml(entries, options)builds an RSS feed.cms.tags()lists tags with counts;cms.site()returns the site details and content types.cms.action(name, input)runs any action from code when the client is created with a secret key.
Content API
The client is a thin layer over a read-only JSON API. Send the key as Authorization: Bearer cp_pub_…. All responses carry an ETag.
| Request | Returns |
|---|---|
GET /v1/site | Site name, URL, description, locale and content types |
GET /v1/entries | A page of published entries. Parameters: type, limit (max 100), offset, tag, search, sort, exclude, field.{key}, include=body |
GET /v1/entries/{slug} | One entry with rendered HTML. Add type if slugs repeat across types |
GET /v1/tags | Tags with entry counts |
GET /v1/sitemap | Every indexable entry with its path and last-modified date |
Drafts and scheduled entries are never returned to public keys. To build a preview, use a secret key on your server and add preview=true, or pass preview: true to createClient.
Webhooks
Add a webhook under Connect to be told when published content changes. CitrusPeel sends a POST with a JSON body for entry.published, entry.updated, entry.unpublished and entry.deleted. Scheduled entries fire entry.published within five minutes of going live.
Each request is signed with the secret shown when you created the webhook. Verify it before acting:
// app/api/revalidate/route.ts
import { verifyWebhook } from 'citruspeel';
import { revalidateTag } from 'next/cache';
export async function POST(request: Request) {
const body = await request.text();
const ok = await verifyWebhook(body, request.headers.get('x-citruspeel-signature'), process.env.CITRUSPEEL_WEBHOOK_SECRET!);
if (!ok) return new Response('Bad signature', { status: 401 });
revalidateTag('cms');
return Response.json({ revalidated: true });
}For a statically built site, point the webhook at your host’s deploy hook instead.
Actions reference
These are the actions available to agents as MCP tools and over HTTP at POST /api/actions/{name}. Input schemas are served at GET https://studio.citruspeel.app/api/actions.
list_workspacesLists every workspace (website) in the account. Start here to find the workspace slug to use in other calls.get_workspaceReturns one workspace with its content types, their fields and entry counts. Call this before writing content so you know which fields each type accepts.create_workspaceCreates a workspace for one website. It starts with a "post" content type (excerpt, cover, body, tags, author) served at /blog/{slug}.update_workspaceChanges a workspace name, slug, site URL, description or locale. Only the properties you pass are changed.delete_workspacePermanently deletes a workspace with all of its content types, entries, media, keys and webhooks. This cannot be undone.list_content_typesLists the content types of a workspace with their fields.create_content_typeDefines a new kind of content (for example "landing_page", "author" or "faq"). Every entry already has a title, slug, status, publish date and SEO settings; "fields" lists what it has beyond those.update_content_typeChanges a content type. "fields" replaces the whole field list, so include the fields you want to keep. Values of removed fields stay stored and come back if the field is added again.delete_content_typeDeletes a content type. If it still has entries you must pass deleteEntries: true, which permanently deletes them too.list_entriesLists entries in a workspace, newest first, without their Markdown bodies. Filter by type, state, tag or a search phrase. Use get_entry for the full content of one entry.get_entryReturns one entry with all field values (Markdown as source text), its SEO settings and an SEO report listing what to improve.create_entryCreates an entry. It is saved as a draft unless status is "published" or publishAt is set. The response includes an SEO report; fix its warnings with update_entry before publishing.update_entryEdits an entry. Only what you pass changes: "fields" and "seo" are merged into the existing values, and null clears a value. The previous version is kept as a revision.publish_entryPublishes an entry now, or schedules it when publishAt is in the future. Required fields must be filled.unpublish_entryTakes an entry off the site and returns it to draft. Its content is kept.delete_entryPermanently deletes an entry and its revisions. To take a page down but keep it, use unpublish_entry instead.list_revisionsLists earlier versions of an entry (up to 30), newest first.restore_revisionReplaces the title, fields and SEO settings of an entry with those of an earlier revision. Status and slug stay as they are, and the current version becomes a revision.list_mediaLists uploaded images and files in a workspace, newest first. Use an item's id in image fields, or its url inside Markdown.get_mediaReturns one uploaded file by id, with its url, dimensions and alt text.upload_media_from_urlDownloads an image or file from a public URL and stores it in the workspace. Returns its id and permanent url. Always pass alt text for images.upload_mediaStores a file sent as base64 (for images you generated or hold locally). Prefer upload_media_from_url when the file is already online.update_mediaSets the alt text of an image.delete_mediaPermanently deletes a file. Pages that still reference it will show a broken image; the response lists entries that use it.get_accountReturns who you are acting for, the subscription status and how much media storage is used.update_accountChanges the display name on the account.create_billing_linkReturns a Stripe link for the account owner to open: checkout to start the $50/month subscription, or the billing portal to change the card, download invoices or cancel.list_api_keysLists API keys and connected apps with their permissions, expiry and last use. Key values are only shown once, when created.create_api_keyCreates an API key and returns its value once. kind "public" (cp_pub_) can only read published content of one workspace and is safe to ship in a website. kind "secret" (cp_sk_) is for agents and servers: give it only the permissions it needs (content:read, content:write, content:publish, content:delete, schema:write, webhooks:manage, keys:manage, account:manage) and an expiry date.rotate_api_keyReplaces an API key with a new value that has the same name, permissions and workspace, and returns the new value once. The old value stops working immediately, or after graceHours so you can swap it without downtime. Use this on a schedule, and at once if a key may have leaked (with no grace).revoke_api_keyRevokes an API key or disconnects a connected app. Anything using it stops working immediately.list_webhooksLists the URLs that are notified when published content changes in a workspace.create_webhookRegisters a URL that receives a signed POST whenever published content changes (entry.published, entry.updated, entry.unpublished, entry.deleted). Point it at a deploy hook or a revalidation route so the site updates itself. Returns the signing secret once.test_webhookSends a webhook.test event to one webhook and returns the HTTP status it answered with (0 means it could not be reached).delete_webhookStops notifying a URL.list_activityShows recent changes in the account and who made them (the owner, or the name of the API key an agent used).