calmposts

REST API and webhooks

With an API key, a script or an AI agent works in one calmposts workspace, within the scopes the key was given.

Keys and sign-in come from a calmposts workspace, and every plan starts with a free trial. Try it free

REST API v1

At /api/v1, with an API key.

Hosted MCP server

At /mcp (Streamable HTTP), with an API key or an OAuth token from claude.ai or ChatGPT.

MCP docs

The machine-readable reference is https://calmposts.com/api/v1/openapi.json (OpenAPI 3.1, readable without a key), with every call's errors and the webhooks' events.

The REST API reference lists every call with its fields

API keys

The workspace's owner creates keys under API & MCP in the app and picks their scopes. A key (cp_live_…) is shown once; calmposts keeps only its SHA-256 hash and its first 12 characters. The plan sets how many keys a workspace may hold.

Send it as Authorization: Bearer cp_live_…. A key has the rights of the person who made it, checked on every request. It stops working once they are blocked, deleted or gone from the workspace, keeps only its read scopes, without leads:read, while they are a viewer, and is refused as soon as it is revoked.

By default a post made with a key comes back as pending_approval and goes out once a person approves it. It skips the wait only when both the workspace and the key are set to publish.

Each key gets 60 requests a minute, REST and MCP together. Past that the answer is 429 rate_limited, with Retry-After in seconds.

ScopeAllows
accounts:readGET /accounts, GET /customers, GET /limits
posts:readGET /posts, GET /posts/:id, GET /posts/:id/metrics, GET /queue/next
posts:writePOST /posts, PATCH /posts/:id, DELETE /posts/:id, POST /posts/:id/retry
media:writePOST /media, POST /media/uploads
gates:readGET /gates, GET /gates/:id, GET /gates/:id/stats, gate_id in POST /posts
gates:writePOST /gates, PATCH /gates/:id, POST /gates/:id/publish, POST /gates/:id/pause
leads:readGET /gates/:id/leads

Errors

Errors share one body, {"error": "…", "code": "…", "field": "…"}. Branch on code, which is stable; error is a message for people, and field names the field at fault when there is one.

A post that fails validation is a 422. Its field and code name the first problem (targets[0].parts[0].text, too_long), and the errors array lists every one.

Other codes: 400 invalid_body or invalid_query; 401 missing_api_key, invalid_api_key, api_key_revoked or api_key_inactive; 402 quota_exceeded with the metric as field, or no_plan while the workspace has no plan; 403 insufficient_scope with the missing scope as field; 404 post_not_found, account_not_found, customer_not_found or page_not_found.

Calls

Set up

The examples use curl in bash. Keep the key in an environment variable; $auth carries the header.

export CALMPOSTS_API_KEY=cp_live_…
export CALMPOSTS=https://calmposts.com
auth=(-H "Authorization: Bearer $CALMPOSTS_API_KEY")

Accounts

Each connected account with its status, its network's rules (capabilities), the character limit for its tier (char_limit) and its customer.

curl "${auth[@]}" $CALMPOSTS/api/v1/accounts
# {"items":[{"id":"…","provider":"x","handle":"@carol","status":"active","char_limit":280,"capabilities":{…}}]}

Customers

An agency's clients, each with its channels' ids. Pass customer_id to the account and post lists to work for one client; a post belongs to every customer whose channel it goes to. The API only reads customers, and the app creates and edits them.

curl "${auth[@]}" $CALMPOSTS/api/v1/customers
# {"items":[{"id":"CUSTOMER_ID","name":"Acme","color":"sky","sort":0,"account_ids":["…"]}]}
curl "${auth[@]}" "$CALMPOSTS/api/v1/accounts?customer_id=CUSTOMER_ID"

Limits

The plan's usage this period (used and limit per metric), the workspace's time zone and each connected network's rules, such as max_chars, link_length, max_thread_parts and thread_as_one.

curl "${auth[@]}" $CALMPOSTS/api/v1/limits
# {"billing":{"plan":{…},"usage":{"posts_per_day":{"used":3,"limit":30,…}}},"networks":[…],"timezone":"Europe/Berlin"}

Create a post

schedule.mode is draft, queue (the accounts' next free slot), at (an RFC 3339 time), day (that time, or the day's nearest free slot if the accounts already post at that minute) or now. Several parts make a thread; a target's own parts give that channel its own wording. A part of the post's own text too long for a network goes out there as a thread of posts that fit (a target's own parts aren't cut: each must fit), cut at blank lines, line breaks, sentence ends, then spaces, with nothing numbered or added, and each of those posts counts toward posts_per_day. A network with thread_as_one joins the parts into one post instead. A post takes at most 20 channels and a time at most two years ahead. The same text to the same account within 7 days is 422 duplicate_recent. Posts made through REST get source "api", through MCP "mcp".

curl -X POST $CALMPOSTS/api/v1/posts "${auth[@]}" -H "Content-Type: application/json" -d '{
  "parts":    [{"text": "Calm posts, scheduled."}],
  "targets":  [{"account_id": "ACCOUNT_ID"}],
  "schedule": {"mode": "queue"}
}'
# 201 {"id":"…","status":"pending_approval","version":1,"source":"api","approval":{…},…}

Attach media

Upload the file first, then put its id in a part's media_ids. calmposts takes JPEG, PNG, WebP, GIF and MP4 files of up to 50 MB (413 media_too_large past that) with alt text of up to 1,000 characters; each network's own limits apply when the post is checked. When the file is with something that has no key, such as an agent's shell, POST /media/uploads gives a one-time URL that takes that file with PUT for 15 minutes.

curl -X POST $CALMPOSTS/api/v1/media "${auth[@]}" -F file=@cat.png -F alt="A calm cat"
# 201 {"id":"MEDIA_ID","kind":"image",…}  →  "parts": [{"text": "…", "media_ids": ["MEDIA_ID"]}]
curl -X POST $CALMPOSTS/api/v1/media/uploads "${auth[@]}" -H "Content-Type: application/json" -d '{"alt": "A calm clip"}'
# 201 {"media_id":"MEDIA_ID","upload_url":"https://calmposts.com/api/media/uploads/…","chunk_bytes":8388608,"command":"sh -c '…' _ ./FILE 'https://calmposts.com/api/media/uploads/…'",…}
# No key: within 15 minutes run the answer's command with ./FILE replaced by clip.mp4.
# It PUTs the file in parts of chunk_bytes, since a request over 100 MB is refused on the way.

List and read

Filters: status (comma-separated), account_id, customer_id, from and to (RFC 3339, on scheduled_at), q, limit (50 by default, at most 500) and offset. metrics has a published post's counts on each X and Bluesky channel at 1 h, 24 h and 7 days, read on that schedule; asking never triggers a new read. A plan without analytics gets 402 feature_not_in_plan.

curl "${auth[@]}" "$CALMPOSTS/api/v1/posts?status=scheduled,failed&limit=20"   # {"items":[…],"total":n}
curl "${auth[@]}" $CALMPOSTS/api/v1/posts/POST_ID
curl "${auth[@]}" $CALMPOSTS/api/v1/posts/POST_ID/metrics   # plans with analytics

Edit

PATCH sends the version you read and only what changes: parts, targets or schedule. A stale version is 409 version_conflict. Drafts, scheduled posts and posts waiting for approval can be edited; any other post is 409 not_editable.

curl -X PATCH $CALMPOSTS/api/v1/posts/POST_ID "${auth[@]}" -H "Content-Type: application/json" \
  -d '{"version": 1, "schedule": {"mode": "at", "at": "2027-01-15T09:30:00+01:00"}}'

Delete, retry, next slot

DELETE removes a post from calmposts and cancels it if it is scheduled. A published post stays on the network, and one being published right now is 409 publishing_now. retry sends the failed channels again at once (409 nothing_to_retry when none failed, and 409 outcome_unknown_needs_person for a channel whose outcome is unknown: only a person can resend it). queue/next is the slot queue would give these accounts; if the workspace's queue jitter is on, a queued post may land a few minutes either side of it.

curl -X DELETE "${auth[@]}" $CALMPOSTS/api/v1/posts/POST_ID          # 204
curl -X POST "${auth[@]}" $CALMPOSTS/api/v1/posts/POST_ID/retry      # the post
curl "${auth[@]}" "$CALMPOSTS/api/v1/queue/next?account_ids=A,B"     # {"at":"2027-01-15T09:00:00Z"}

Webhooks

The workspace's owner adds up to 10 webhooks under API & MCP, each an https URL on a public address with the events it wants. Every event is one POST with the JSON body below and the headers X-Calmposts-Event (its type), X-Calmposts-Delivery (this delivery's id) and X-Calmposts-Signature. The Send test button sends a ping event.

The signature is t=<unix seconds>,v1=<hex HMAC-SHA256 of "t.body">, keyed with the whole secret, whsec_ included, which is shown once when you add the webhook. Compute it over the raw body before parsing, compare in constant time and refuse a t more than five minutes off.

A 2xx within 10 seconds is a delivery, and redirects are not followed. Anything else is retried after 1, 5 and 30 minutes and after 2, 6 and 24 hours; after the seventh try the delivery waits in the webhook's log for the owner to redeliver it. An event can come twice and out of order, so deduplicate on its id. A webhook that fails for three days straight is switched off, and the owner gets an email.

Events that name a channel carry its customer_id (null when it has none).

EventSent when
post.publishedevery channel of a post went out (data: post_id and targets, each with its account_id, provider and url)
post.faileda channel of a post failed for good, once per channel (data: post_id, target_id, account_id, provider, error_code, error)
post.pending_approvalan agent's post waits for a person to approve it (data: post_id, approval_id, source, created_by, credential, the start of the text, accounts, schedule and the post's url)
account.needs_reconnecta network revoked the access and the account needs reconnecting (data: account_id, provider, handle)
member.joinedsomeone accepted an invitation into the workspace (data: user_id, role, invited_by)
member.role_changedan owner changed a member's role, or the platform's admin named an owner (data: user_id, role, previous_role, by)
member.removedan owner removed a member, or they left (data: user_id, role, by, reason)
{
  "id": "…",
  "type": "post.published",
  "workspace_id": "…",
  "created_at": "2026-10-21T09:00:03Z",
  "data": {"post_id": "…", "targets": [{"id": "…", "account_id": "…", "customer_id": null, "provider": "x", "url": "https://x.com/…"}]}
}

The body never carries a token or a secret.

Connect an agent over MCP