Writing safely: plan, then apply
centrex plan putRoutingQueue --params '{"path":{"queueId":"..."},"body":{"name":"Support Tier 1"}}'
centrex apply <planId>
-
planwrites nothing. What it shows depends on the write:- PUT or PATCH: reads the current resource with the GET on the same path and shows the fields that change as
before and after. A PUT replaces the whole resource, so the fields its body leaves out are listed as
removed(read-only fields and fields the body definition does not declare excepted). The body is validated against its definition first: types and enums for both, required fields for a PUT only; a mismatch is refused, naming each field. - Creating POST (a POST to a collection that has a GET on
<path>/{id}, likepostRoutingQueues): validates the payload against the body shape (required fields, types, enums) and echoes it; a bad payload is refused. - For all three, a top-level body field the definition does not declare is listed in the plan’s
warnings. - Action POST (any other POST, like
postConversationDisconnect): reads the resource it acts on and describes the call. - DELETE: reads and shows the whole resource.
- When no GET reads the current state (
postFlowsActionsPublish,putConversationTags), or the GET answers 403 or 404: says so (stateKnown: false, withstateErrornaming the GET, status and code when it answered), echoes the call and payload, andapplywrites without the staleness check. A DELETE whose GET answers 404 is refused: there is nothing to delete.
It lists the permissions the operation requires, saves the plan in the org’s
plans/folder and prints theplanId. Values under secret field names (apiKey,password,token,secret,credential…) are redacted in the plan file and listed insecretFieldsby dotted path (body.apiKey); give them again toapply(centrex apply <planId> --secrets '{"body.apiKey":"..."}', or thesecretsargument of the MCPapplytool). They are sent with the write and never saved or logged. A change to a secret-named field the plan touches is still detected at apply: the plan keeps a SHA-256 digest of its value, never the value. - PUT or PATCH: reads the current resource with the GET on the same path and shows the fields that change as
before and after. A PUT replaces the whole resource, so the fields its body leaves out are listed as
-
apply <planId>re-reads the resource and refuses when any field the plan touches (or the resource’sversion) has changed since the plan, naming the field, or when a resource to delete or act on is gone. Otherwise it writes, re-reads to confirm (a created resource by its returned id; a deleted one must answer 404), appends one JSON line to the org’sapply-log.jsonland marks the plan applied. The result saysconfirmed: truewhen the re-read shows the write; otherwiseconfirmed: falsewithwarnings(a deleted resource that still reads, a re-read that failed, a write with no GET to re-read it). The write went through either way, and the plan is applied. A plan is applied once and expires 30 minutes after it is made. An apply first claims the plan (its file moves toplans/applying/), so two applies of the same plan at once write once: the second is refused. When the write fails, the plan goes back to pending. A refusal (unknown, expired, already applied or being applied, stale, read-only mode, secrets missing) writes nothing and also appends one record, with"result": "refused"and thereason. -
executerefuses every write operation. -
With
CENTREX_READ_ONLY=1,planandapplyrefuse every write.
Flow files: export and publish
Centrex exports an Architect flow as YAML and publishes a YAML file, without Archy.
centrex exec postFlowsExportJobs --params '{"body":{"flows":[{"flow":{"id":"<flowId>"}}]}}'
centrex plan postFlowsJobs --params '{"body":{"file":"main-ivr-inboundcall-3.yaml"}}'
centrex apply <planId>
-
Export is a read and needs no plan.
executeregisters the export job of one flow (byflow.id, orflow.nameandflow.type; the published version unlessflow.versionis given; YAML only), polls it, downloads the file and writes it to<org folder>/flows/<name>-<type>-<version>.yaml, private to the user. An existing file is never overwritten: the same content is left as it is (written: false), a different one gets a numbered name (-2,-3…). The result gives the file path and its hash, not the YAML. -
Plan takes
body.file: a YAML file inside the org’s folder (a bare name is looked up inflows/). It reads the flow’s name and type from the file and shows:target:updateof the existing flow with that name and type, orcreate. A changed name creates a new flow and leaves the original as it is; the first warning says so in capitals.diff: a line diff against the published flow, exported at that moment (basekeeps its version and hash).validation: what validated the file, orran: falsewith a note. No validation ships yet, so today every plan says that none ran; a problem in the file surfaces as an error of the publish job.warnings: that publishing replaces a live flow at once.
The plan file keeps a frozen copy of the file and its SHA-256. Editing the file afterwards changes nothing:
applypublishes the copy the plan froze. Values under secret field names are redacted in that copy and listed insecretFieldsasflow.L<line>.<key>; give each one again toapplyas the text written in the file after the key. -
Apply refuses when the flow is no longer what the plan saw (another published version, another content, a flow that appeared or disappeared). Then it registers the job with
createStubs: false(always: a reference the flow cannot resolve must fail the job, not create resources), uploads the file, polls the job, and checks that the flow has a newer published version (for a new flow: that it exists with that name and type). A failed job is aFlowJobFailedErrorwith the job’s messages; nothing is published and the plan stays pending. A job still running after five minutes is reported as applied butconfirmed: false, with the job id to follow. -
Signed URLs. The download and the upload go to a storage host through signed URLs, the only calls Centrex makes outside the login and API hosts. They are made only for a URL that
postFlowsJobsorgetFlowsExportJobhas just returned, over https, with no token and no header but the ones the API returned for the upload, and without following redirects. A signed URL is never written to a plan, the apply log, a result or an error.
Never allow-list apply
Centrex does not try to prove that a human approved a plan. The human gate is your client’s permission prompt
on apply (the centrex apply command, or the apply tool of the MCP server). Never add apply to the
client’s allow-list (for example Claude Code’s permissions.allow): an allow-listed apply lets the agent
write to the org without anyone seeing the plan. Read-only actions (search, describe, execute, status,
plan) can be allow-listed.