Bundles
/v1/orgs/{org_id}/projects/{project_id}/envs/{source_env}/promotePromote Bundle
Promote the active bundle from source env to the next stage in the project's configured promotion sequence (ordered by environment position).
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/sdkCode 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
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
| Name | Type | Required | Description |
|---|---|---|---|
| org_id#path | string | required | - |
| project_id#path | string | required | - |
| source_env#path | string | required | - |
Header parameters
| Name | Type | Required | Description |
|---|---|---|---|
| X-API-Key#header | string | null | optional | - |
| authorization#header | string | null | optional | - |
Request bodyrequired
| Field | Type | Required | Description |
|---|---|---|---|
| promoted_by | string | optional | - |
Responses
| Status | Description |
|---|---|
| 200 | Successful Response |
| 422 | Validation Error |
Response schema
Errors & what triggers them
| Code | Trigger | Fix |
|---|---|---|
| 400 | source_env has no valid promotion target (e.g. source=prod). | - |
| 404 | No active bundle in the source environment to promote. | - |
Notes & examples
Promotion order
Promotion moves the currently active bundle forward one stage:
dev→stagingstaging→prod
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}/environmentsif 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.