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 (dev→staging, staging→prod).

CI tokenscope: bundle:publishoperation_id: bundles.promote

Authentication

Create via POST /v1/orgs/{org_id}/tokens/ci. Project-scoped, allows bundle lifecycle.

SDK install

pip install znyx-sdknpm install @znyx/sdk

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

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.

Request

curl -X POST 'https://api.znyx.ai/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"
}

Schema: object