Promote a deployment to the next environment
const url = 'https://example.com/v1/deployments/example/promotions';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"toProjectId":"example","reason":"example","pin":true,"replace":[{"blockId":"example","reason":"example"}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/deployments/example/promotions \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "toProjectId": "example", "reason": "example", "pin": true, "replace": [ { "blockId": "example", "reason": "example" } ] }'Moves the exact build a deployment runs into the next environment of its environment order: a new deployment of the target project with the same image, signature, signer and contents, and promotedFromDeploymentId. Nothing is built again and no registry is written. The edits of the build’s agents and flows (versions made from a version it ships) move with it (moved.agents[].carried); edits made from a version it doesn’t ship stay (leftBehind). Needs read on the deployment’s project and admin on the target. Refused, with nothing written, when the target isn’t the next environment, the deployment (or the target’s copy) no longer serves, its signer is no longer trusted or its signature doesn’t verify, or a value the build needs isn’t ready in the target. The target having this build already answers 200 with its deployment, and records the edits made since. With pin, the build’s blocks (contents.blocks) are checked first against what runs in the target, as a deploy’s are against what runs: a newer version of one running there stops the promotion with nothing written, unless replace names the block, and blockCheck answers what the check found. Then the move commits; then each carried agent is pinned through its target scope’s release gate, and each carried flow is pinned. pin is the ask to take a target project that follows Latest off it: such a pin gets no 409 pin-stops-latest, and records stoppedFollowingLatest. A release gate that refuses or holds an agent isn’t an error: its pinned entry has pinned: false and the gate’s status. A refusal after the move leaves the move in place, and lists the pins already made in details.pinned and details.pinnedFlows.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
Examplegenerated
{ "toProjectId": "example", "reason": "example", "pin": true, "replace": [ { "blockId": "example", "reason": "example" } ]}Responses
Section titled “Responses”The target has this build already: its deployment, with the edits made since recorded, and no planWarning.
object
Example
{ "deployment": { "productionEntry": "promote-only", "endpoint": { "status": "pending", "waiting": true, "packEnvProblem": { "code": "pack-env-ambiguous" }, "keptFor": [ { "registered": true, "held": true } ] }, "contents": { "agents": [ { "reason": "pins-changed", "pinChanges": [ { "kind": "tool" } ] } ], "flows": [ { "reason": "pins-changed", "pinChanges": [ { "kind": "tool" } ] } ] }, "replaced": [ { "by": { "kind": "user" } } ] }, "moved": { "agents": [ { "carried": true } ], "flows": [ { "carried": true } ] }, "pinned": [ { "gate": { "status": "pinned" } } ]}Promoted: a new deployment in the target.
object
Example
{ "deployment": { "productionEntry": "promote-only", "endpoint": { "status": "pending", "waiting": true, "packEnvProblem": { "code": "pack-env-ambiguous" }, "keptFor": [ { "registered": true, "held": true } ] }, "contents": { "agents": [ { "reason": "pins-changed", "pinChanges": [ { "kind": "tool" } ] } ], "flows": [ { "reason": "pins-changed", "pinChanges": [ { "kind": "tool" } ] } ] }, "replaced": [ { "by": { "kind": "user" } } ] }, "moved": { "agents": [ { "carried": true } ], "flows": [ { "carried": true } ] }, "pinned": [ { "gate": { "status": "pinned" } } ]}Malformed body (bad-input). Or signature-invalid: the deployment’s signature doesn’t verify over the fields it keeps.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Missing / malformed / expired / revoked bearer token.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}No admin on the target project. Or key-project-mismatch: the API key or session is limited to a project, and a promotion reads one project and writes another (details.keyProjectId, details.projectId). Or signer-not-trusted: the key that signed the build is no longer on the workspace’s trust list (details.signerKeyId). Or plan-limit-reached: this adds flows or agents to production past the most this runtime’s license key runs, so none of them is added; what runs keeps running. details has projectId (on a reinstate, when its version records one); over, each count over (flows first) with its limit (flows or agents), the number it adds (adding), and the key’s plan, most and inUse when they count this workspace alone; the first of them again at the top (details.limit, …); newIds, the flows and agents it adds; and next, where a larger plan is, when the runtime names one. It counts what the build ships and carries in the target, before the move: nothing moved. With pin, after the move: no right to pin a carried agent or a carried flow in the target; nothing is pinned.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}deployment-not-found: no deployment with that id in this workspace, one in a project you don’t read, or one whose project is deleted.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}promotion-not-next-environment: the target isn’t the next environment of the deployment’s order, or the deployment’s environment is last or in no order (details.position, the next environment’s place; details.nextProjectId, when you can read it). promotion-values-not-ready: values the build needs aren’t ready in the target, each in details.values (DeploymentValue). deployment-superseded: the deployment no longer serves its environment, or the target’s copy no longer serves there: newer deployments serve every tool version it ships (details.environment, source or target; details.newerDeploymentId). project-suspended, pack-suspended, tenant-suspended or tenant-closing: a suspension of the source or the target (details.environment). deploy-would-put-back-older-blocks, with pin: a newer version of one of the build’s blocks than its own runs in the target now, each in details.blocks (DeployCheckStop). Nothing is written for any of these. With pin, after the move has committed: nothing-runs-in-scope, a carried agent has no version running in the target yet (the message names it); or pin-superseded or release-gate-descendant-unpinned, as POST /v1/agents/{agentId}/pinned/pin answers them. The carried agents pinned before it are in details.pinned; it, the ones after it and the carried flows aren’t pinned.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}The request body is over the API’s limit (request-too-large; details.maxBytes says how much).
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}approvals-pending-limit, with pin, after the move has committed: a carried agent’s release gate wants an approval, and the workspace’s approvals waiting for a decision are at its limit. The carried agents pinned before it are in details.pinned; it, the ones after it and the carried flows aren’t pinned. Or rate-limit-exceeded with details.limit: "api-requests", on a runtime that sets workspace limits (Kindgi Cloud): this workspace’s limit on API requests a minute is reached, so the request wasn’t run; Retry-After says when to send it again.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”Server error (unmapped domain code or framework crash).
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}promotions-unsupported: this runtime’s deployment ledger can’t promote. With pin, after the move: promotions-unsupported when this runtime can’t pin versions, or pin-gate-unsupported when a release gate applies to a carried agent’s scope and the runtime can’t record a gated pin; nothing is pinned.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}plan-count-busy (with Retry-After): counting the flows and agents in production took too long, so none of them is added; a retry is safe. Or the authorization store couldn’t be reached (authz-backend-unavailable, with Retry-After), or the database was too busy for the authorization check (database-busy, with Retry-After), so the request wasn’t run. Or tenant-state-unavailable (with Retry-After), on a runtime serving many workspaces: the workspace’s state couldn’t be read, so nothing was changed.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”See also
GET /v1/deployments/{deploymentId}: Fetch a signed deployment recordGET /v1/deployments/{deploymentId}/pack-env: Show where each name a deployment's pack declares is setPOST /v1/deployments/{deploymentId}/secrets: Sync secrets against a deploymentGET /v1/deployments/{deploymentId}/values: List the values a deployment needs in a project- Plan limits
- Kindgi 0.4.0
- Error code
approvals-pending-limit - Error code
authz-backend-unavailable - Error code
bad-input - Error code
database-busy - Error code
deploy-would-put-back-older-blocks - Error code
deployment-not-found - Error code
deployment-superseded - Error code
key-project-mismatch - Error code
nothing-runs-in-scope - Error code
pack-suspended - Error code
pin-gate-unsupported - Error code
pin-superseded - Error code
plan-count-busy - Error code
plan-limit-reached - Error code
project-suspended - Error code
promotion-not-next-environment - Error code
promotion-values-not-ready - Error code
promotions-unsupported - Error code
rate-limit-exceeded - Error code
release-gate-descendant-unpinned - Error code
request-too-large - Error code
signature-invalid - Error code
signer-not-trusted - Error code
tenant-closing - Error code
tenant-state-unavailable - Error code
tenant-suspended - Every error code