REST API
Only available on hosted Pages CMS.
The REST API lets scripts and services do what an editor can do in Pages CMS: list and edit content, upload media and run actions, with the same permissions. It lives at https://app.pagescms.org/api/v1. For AI assistants, use MCP instead; it exposes the same operations as tools.
Connect
- Open Account → Personal access tokens and create a token.
- Choose its scopes and expiry, and optionally limit it to specific repositories.
- Copy the token. It's shown only once.
Send it as a bearer token. Never put it in a URL.
export API="https://app.pagescms.org/api/v1"
export PAGESCMS_TOKEN="..."
curl "$API/repositories?query=acme/docs" \
-H "Authorization: Bearer $PAGESCMS_TOKEN"REST and MCP check the deployment’s email allowlist on each request. If an account is excluded, its credentials cannot be used while that restriction applies.
Revoke tokens under Account → Personal access tokens, and OAuth apps under Account → Connected applications. Revoking stops future requests; it doesn't undo completed ones.
Start with discovery
Use a known repository ID directly, or search for up to five accessible Pages CMS projects. Use a repository name for partial matches or owner/name for an exact lookup. An empty search is rejected.
# 1. Find the repository ID (the GitHub repository ID, as a string)
curl "$API/repositories?query=acme/docs" -H "Authorization: Bearer $PAGESCMS_TOKEN"
# 2. List branches
curl $API/repositories/123/branches -H "Authorization: Bearer $PAGESCMS_TOKEN"
# 3. Read the content model: collections, files, media, actions and their fields
curl $API/repositories/123/branches/main/model -H "Authorization: Bearer $PAGESCMS_TOKEN"URL-encode branch names as one path segment (feature/docs → feature%2Fdocs) and file paths in query strings. Paths are repository-relative, without . or .. segments.
Endpoints
Paths are relative to /api/v1. {b} stands for repositories/{repository}/branches/{branch}.
{collection}, {file}, {media} and {action} are the names from .pages.yml. Writes accept JSON bodies; GET and DELETE take query parameters. Unknown fields are rejected.
Find translations
List a collection with ?locale=fr to see French entries in a file-per-language collection, or French field values when translations share one file. Omit locale to use the configured default. Keep the same locale when following a pagination cursor.
For a file-per-language collection, pass an entry’s repository-relative path to look up its translations:
curl "$API/repositories/123/branches/main/collections/posts/entry/translations?path=content%2Fposts%2Fhello.en.md" \
-H "Authorization: Bearer $PAGESCMS_TOKEN"The response lists each configured locale in order, including its expected path. Missing translations have exists: false and revision: null. You need read access to every translated path. Collections with shared-file translations or no localization return an empty items array.
Writing content
Read before you write: updates, moves and deletes need the current revision, which makes concurrent edits fail with 409 conflict instead of overwriting each other.
curl -X PUT "$API/repositories/123/branches/main/collections/posts/entry?path=content%2Fposts%2Fhello.md" \
-H "Authorization: Bearer $PAGESCMS_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: update-hello-2026-11-01" \
--data '{"revision":"0123456789abcdef0123456789abcdef01234567","content":{"title":"Hello"}}'- Send either
content, structured fields matching the model, orsource, the raw file text, up to 5 MiB. - Creates and uploads fail if the destination already exists.
- Media uploads are one file up to 4 MiB, base64 without a
data:prefix. Delete media with therevisionfrom a listing or upload; reading a media file doesn't return one. PUT /files/{file}with"revision": nullcreates a configured file that doesn't exist yet.
Idempotency and retries
Every write needs an Idempotency-Key header: 8–200 letters, digits, ., _, : or -. To retry a write, resend it with the same key and the same body. You'll get the original result, with Idempotent-Replayed: true, and it won't count twice. Keys last 24 hours.
If a request is interrupted, its outcome can be unknown: the response is operation_in_progress or operation_outcome_unknown. Don't blindly retry with a new key. Read the current state first, then decide whether to submit a new change.
Permissions and controls
A token acts as its owner and can never do more than its owner can in Pages CMS, including any role restrictions. Scopes narrow it further:
read: repositories, branches, the model, content, media and actionswrite: creating, updating, moving and deleting content and mediaactions:run: running actions
The API can't edit configuration, create branches, manage collaborators, roles or billing, or read files outside what .pages.yml exposes.
Managers control API and MCP access per repository under API & MCP:
- Access: everyone with access, managers only, or off.
- Read-only: blocks all writes and actions through the API and MCP.
- Allow action execution: turns running actions on or off.
These apply to every token, managers' included, and don't affect editing in Pages CMS.
Usage limits
Each repository has a monthly allowance shared by every user, token, branch, REST call and MCP tool call: 1,000 operations on Free and 100,000 on Pro. It resets at the start of each UTC month, and usage is shown under API & MCP and by GET /{b}/usage.
A read, model request, write or upload counts as one operation. Discovering repositories, checking usage or run status, and idempotent replays are free. Invalid or unauthorized requests don't count. Rate limits also apply; a 429 response includes Retry-After when available. Editing in Pages CMS never counts.
Pagination
Lists take limit (default 50, max 200) and return nextCursor; pass it back as cursor until it's null. Pages reflect live data, so changes between requests can shift results.
Errors
Errors return { "error": { "code", "message", "requestId", "details" } }. Every response includes X-Request-Id.
OAuth
Apps that act on behalf of other users should use OAuth instead of personal tokens. Discover the endpoints from the protected resource metadata at /.well-known/oauth-protected-resource/api/v1, and request tokens for the /api/v1 resource. Unauthenticated responses include a WWW-Authenticate header pointing there.