Skip to main content

Bundles

POST/v1/orgs/{org_id}/projects/{project_id}/envs/{source_env}/promote

Promote Bundle

Promote the active bundle from source env to the next stage in the project's configured promotion sequence (ordered by environment position).

Bearer token or X-API-Keyscope: bundle:publishoperation_id: bundles.promote

Authentication

Send either Authorization: Bearer <token> or X-API-Key: <token>. The caller must hold the "bundle:publish" role on the organization. CI token — create via POST /v1/orgs/{org_id}/tokens/ci. Project-scoped, allows the bundle lifecycle. Requests without a valid credential are rejected with 401.

SDK install

pip install znyx-sdknpm install @znyx/sdk

Code samples

Request

curl -X POST "$ZNYX_API_URL/v1/orgs/00000000-0000-0000-0000-000000000000/projects/00000000-0000-0000-0000-000000000000/envs/<source_env>/promote" \
  -H "Authorization: Bearer $ZNYX_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "promoted_by": "ui"
}'

Response

application/json

Successful Response

{
  "id": "string",
  "version": 0,
  "policy_hash": "string",
  "is_active": false,
  "published_by": null,
  "published_at": "string",
  "scope_count": 0
}

Schema: object

Path parameters

NameTypeRequiredDescription
org_id#pathstringrequired-
project_id#pathstringrequired-
source_env#pathstringrequired-

Header parameters

NameTypeRequiredDescription
X-API-Key#headerstring | nulloptional-
authorization#headerstring | nulloptional-

Request bodyrequired

FieldTypeRequiredDescription
promoted_bystringoptional-

Responses

StatusDescription
200Successful Response
422Validation Error

Response schema

idrequiredstring
versionrequiredinteger
policy_hashrequiredstring
is_activerequiredboolean
published_byrequiredstring | null
published_atrequiredstring
scope_countinteger

Errors & what triggers them

CodeTriggerFix
400source_env has no valid promotion target (e.g. source=prod).-
404No active bundle in the source environment to promote.-

Notes & examples

Promotion order

Promotion moves the currently active bundle forward one stage:

  • devstaging
  • stagingprod

There is no prod? — the path ends there. If you want to push a specific dev version straight to prod, use activate with an explicit version instead.

Guardrails

  • The target environment must already exist. Create it with POST /v1/orgs/{org}/projects/{p}/environments if not.
  • The target env's tier-gate quota is checked (e.g. free plan gets limited bundle versions per env).
  • If there's no active bundle in the source env, you get a 404 — nothing to promote.

Webhook

Emits bundle.promoted with from_environment, to_environment, and policy_hash. Wire this to Slack / PagerDuty for prod awareness.