Skip to content

Publishing API

Overview

Publishing is a three-step flow:

  1. publish — dry-run that builds a reviewable diff manifest and a short-lived confirmation token. No data is written.
  2. publish-confirm — presents the token and kicks off the pipeline immediately. Returns { publish_id, status: "running" } within seconds — it does not wait for the deploy to finish.
  3. publish-status — poll until the job reaches succeeded or failed.

Authentication: OAuth Bearer token or service API key. The caller must have manager role on the project.

Step 1 — publish (dry-run)

Builds a manifest of pending changes and returns a one-time confirmation token. Nothing is written or deployed in this step.

Arguments

FieldRequiredNotes
project_idyesThe project to publish.
project_nameyesMust match the stored project name exactly (case-insensitive trim). A mismatch returns an error showing both the expected and supplied values.

Response

{
"manifest": {
"project_name": "Acme Real Estate",
"target_site_url": "https://tf-acme.web.app",
"drafts": [
{ "path": "abc123", "language": "en", "slug": "guides/intro", "title": "Getting started" }
],
"theme_changes": { "colors": { "primary": "#14b8a6" } },
"translations_planned": 4
},
"confirmation_token": "ec1a4b…(64 hex)",
"expires_at": "2026-05-11T01:23:45.678Z"
}

The confirmation_token is single-use and expires after 5 minutes.

Step 2 — publish-confirm (async kickoff)

Presents the token and enqueues the deployment pipeline. Returns immediately — the promote → translate → deploy chain runs in the background.

Arguments

FieldRequiredNotes
project_idyesMust match the project bound to the token.
confirmation_tokenyesReturned by publish.

Response

{
"publish_id": "auto-generated-id",
"status": "running",
"site_url": "https://tf-acme.web.app"
}

Save publish_id — you need it to poll status and to revert the publish within one hour.

Step 3 — publish-status (poll until terminal)

Poll until the job status reaches succeeded or failed. The caller needs member role or above.

Arguments

FieldRequired
project_idyes
publish_idyes

Response by status

statusAdditional fields
queued / runningPoll again.
succeededpublished_urls: [{ title, language, slug, url }] — present as clickable links.
failederror — the failure message.

Promotion pipeline

Validation

Every draft is validated before any writes occur. A validation error aborts the entire batch.

RuleError
metadata.title missingMissing required field 'title'
metadata.title not 10–60 charsTitle must be 10–60 characters
metadata.description missingMissing required field 'description'
metadata.description not 50–160 charsDescription must be 50–160 characters
metadata.slug missingMissing required field 'metadata.slug'
content emptyContent cannot be empty
content starts with # Content contains an h1. Start content with ## instead.

Index requirement

Each published language must have a live or in-batch document with metadata.slug === "index".

Concurrency

Only one publish job runs at a time per project. A concurrent publish-confirm call returns publish in progress.

Translations

After promotion, draft copies of every promoted document are created automatically for all additional locales configured in the project. Translated drafts are validated in a second pass before promotion — a faulty translation cannot reach production directly.

Skip-on-unchanged: if a previously-translated variant’s source content and translation configuration are identical to the last publish, the translation is reused with no new AI call. This covers both content changes and AI model version bumps — a model upgrade is never silently skipped.

Reversion

revert-publish rolls back within one hour using the publish_id from publish-confirm.

Errors

PhaseErrorCause
AuthorizationInsufficient permission: this tool requires 'manager' on project '…'Caller has member role or no role.
Authorizationproject_name does not match project …: expected 'X', got 'Y'project_name echo failed.
TokenInvalid or already-used confirmation tokenToken expired, already used, or wrong project.
TokenConfirmation token has expired5-minute window elapsed. Run publish again.
Lockpublish in progressAnother publish is already running. Wait and retry.
PromoteValidation failed for one or more draftsA validation rule was violated. Details include the draft path and field.
PromoteMissing mandatory index page for locale(s): …A configured language lacks an index page.
Deploy{ "success": false, "error": "…" }Build or deployment failure. The error field contains the detail.

Last updated: