Flow versions
A flow's versions: each upload of its Flow JSON, the poll target for a create or a publish, and the publish and unpublish actions.
List versions
Every version of the flow, oldest-changed first, paginated with an opaque cursor: follow `next_cursor` until `has_more` is false. A version moves to the end of the list each time WhatsApp's processing writes to it, so a version in flight is usually last. Requires the `flows:read` scope.
Add a version
Adds a version of the flow from Flow JSON. 202 with the version `pending` while WhatsApp processes it; poll it. Identical Flow JSON to a version that is pending, in draft or failed answers 200 with that version as it is now, so a deploy script that runs twice creates nothing — except for a version that failed before WhatsApp ever saw the document, which is resumed instead: 202, the same version, `pending` again. A document rejected by WhatsApp ends `failed` with `failure_reason`; post a corrected document as a new version. A version already published or deprecated is never reused. Bodies up to 5 MB. `Idempotency-Key` is accepted. Requires the `flows:write` scope.
Get a version (the poll target)
The progress report for a create, an added version and a publish: every background step writes its outcome here. Poll every 2 to 3 seconds, back off after 30 seconds, and stop when `state` is no longer `pending` (after a publish, when it is no longer `draft`). `publishable` is true exactly when a publish will be accepted. Requires the `flows:read` scope.
Publish a version
Publishes the version: 202, and WhatsApp's publish runs in the background. Poll the version until `state` is `published` or `failure_reason.stage` is `publish`. On success the flow's current version moves to it, the flow's `status` becomes `active`, and the previously published version is deprecated. Only a draft that has finished uploading can be published (`publishable`): 409 `not_in_draft_state` names the version's state (a pending version: poll until draft; a published one is already live; a deprecated one is never republished, post its Flow JSON as a new version), 409 `draft_not_yet_uploaded` for a draft WhatsApp has not received, 409 `plan_cap_reached` when the organisation's plan has reached its published-flow cap. `Idempotency-Key` is accepted. Requires the `flows:write` scope.
Unpublish a version
Takes the published version off WhatsApp: 202, and the version is `deprecated` once the background job has run; the flow's `status` becomes `inactive` and `current_version` null. One-way: to go live again, post the Flow JSON as a new version and publish that. 409 `not_published` unless the version is currently published. `Idempotency-Key` is accepted. Requires the `flows:write` scope.