⚠️ Work in progress — createCMS is pre-1.0 and not production-ready (not tested in production). Expect breaking changes.
createCMS
Reference

Approvals API

Request and record approvals on merge requests and publications.

Approval methods let you request sign-off from reviewers and record their approve or reject decisions on a merge request or a direct publication. They live at cms.api.<collection>.<method> and mirror on the client at client.<collection>.<method> with identical types. Examples below use pages as the sample collection. An approval targets either a merge request or a direct publication (a branch's head commit); the targetType field reflects which.

These methods record approvals against an existing commit, they don't produce content commits, so none returns the commit: { id, message, createdAt, createdBy } envelope that commit-producing mutations elsewhere in the API return.

Request Approval

Ask one or more reviewers to sign off on a merge request or a branch's head commit (a direct publication). Each reviewer gets their own pending approval and a notification. Provide exactly one of mergeRequestId or branchId.

approval:create
POST/{collection}/requestApproval
const { data, error } = await client.pages.requestApproval({
  body: {
    branchId: 'br_9f2a1c', // required (or mergeRequestId, exactly one)
    requestedReviewers: ['user_editor', 'user_legal'], // required
    message: 'Ready for review before publishing.',
  },
});
Parameters
requestedReviewersstring[]required

User IDs to request approval from (non-empty, unique).

mergeRequestIdstring

Merge request to request approval on. Provide exactly one of `mergeRequestId` or `branchId`.

branchIdstring

Branch whose head commit to request approval on (direct publication). Provide exactly one of `mergeRequestId` or `branchId`.

messagestring

Message sent to reviewers with the request.

Returns
approvalsApproval[]

One newly created pending approval per requested reviewer. Each carries `id`, `status` (`pending`), `mergeRequestId`, `branchId`, `commitId`, `requestedBy`, `requestedReviewer`, `targetType`, and timestamps.

List Approvals

Page through approvals, filtered by status, target, requester, or reviewer, so you can build a review queue or an audit trail. Approvals on archived entries are left out, and every query field is optional.

approval:read
GET/{collection}/listApprovals
const { data, error } = await client.pages.listApprovals({
  query: { status: 'pending', requestedReviewer: 'user_editor', limit: 20 },
});
Parameters
limitnumber= 20

Page size, 1 to 100.

offsetnumber= 0

Rows to skip.

status'pending' | 'approved' | 'rejected'

Filter by approval status.

mergeRequestIdstring

Filter by merge request.

branchIdstring

Filter by branch.

commitIdstring

Filter by commit.

requestedBystring

Filter by the user who requested the approval.

requestedReviewerstring

Filter by the requested reviewer.

reviewedBystring

Filter by the user who reviewed the approval.

targetType'mergeRequest' | 'publication'

Filter by target: merge-request approvals or direct-publication approvals.

Returns
approvalsApproval[]

The approvals on this page, newest first. Each carries the full approval record, plus enriched `requestedByUser` / `requestedReviewerUser` / `reviewedByUser` (`ExposedUser`) when user enrichment is enabled.

totalnumber

Total approvals matching the filters across all pages, ignoring limit/offset.

hasMoreboolean

Whether more approvals exist after this page.

Get an Approval

Fetch a single approval by id, with its requester, requested reviewer, and reviewer enriched as full user profiles (when user enrichment is enabled), so you can render who asked and who signed off.

approval:read
GET/{collection}/getApproval
const { data, error } = await client.pages.getApproval({
  query: { approvalId: 'apr_1a2b3c' }, // required
});
Parameters
approvalIdstringrequired

Approval id to fetch.

Returns
approvalApproval

The approval record: `id`, `status`, `mergeRequestId`, `branchId`, `commitId`, `requestedBy`, `requestedReviewer`, `reviewedBy`, `message`, `rejectionReason`, `reviewedAt`, `createdAt`, `updatedAt`, `targetType`. When user enrichment is enabled it also carries `requestedByUser`, `requestedReviewerUser`, and (once reviewed) `reviewedByUser` as `ExposedUser` profiles.

Approve a Request

Approve a pending approval as its requested reviewer. Only that reviewer may approve it, and for a direct-publication approval it fails if the branch head has moved since the request went out.

approval:update
POST/{collection}/submitApproval
const { data, error } = await client.pages.submitApproval({
  body: { approvalId: 'apr_1a2b3c' }, // required
});
Parameters
approvalIdstringrequired

Approval to approve (must be pending).

Returns
approvalApproval

The now-approved record, with `status` set to `approved`, `reviewedBy` set to you, and `reviewedAt` timestamped.

Reject a Request

Reject a pending approval, optionally recording why. The same requested-reviewer and staleness rules as submitApproval apply.

approval:update
POST/{collection}/submitRejection
const { data, error } = await client.pages.submitRejection({
  body: {
    approvalId: 'apr_1a2b3c', // required
    rejectionReason: 'Needs revision before publishing.',
  },
});
Parameters
approvalIdstringrequired

Approval to reject (must be pending).

rejectionReasonstring

Reason recorded on the rejection.

Returns
approvalApproval

The now-rejected record, with `status` set to `rejected`, your `rejectionReason` recorded, `reviewedBy` set to you, and `reviewedAt` timestamped.

Cancel a Request

Cancel a pending approval, deleting the request outright. Only pending approvals can be canceled; an already-approved or rejected one can't be undone this way.

approval:delete
POST/{collection}/cancelApproval
const { data, error } = await client.pages.cancelApproval({
  body: { approvalId: 'apr_1a2b3c' }, // required
});
Parameters
approvalIdstringrequired

Pending approval to cancel.

Returns
approvalIdstring

The id of the canceled (deleted) approval, echoed back.

On this page