Publish a release gate
const url = 'https://example.com/v1/release-gates';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"id":"example","version":"example","agentId":"example","scope":{"kind":"tenant"},"spec":{"comparison":{"maxAgeHours":1,"testSet":{"id":"example","version":"example"}},"evidence":{"minCases":1,"minWeight":1},"metrics":[{"name":"passRate","k":1,"minCandidate":1,"maxDrop":1}],"replay":{"maxDiverged":1,"maxErrors":1,"maxRefusedWrites":1,"maxStopped":1},"cases":{"minPassing":1,"noNewFailures":true},"approvals":{"role":"standard","separateApprover":true},"onlyExpertGroups":true},"description":"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/release-gates \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "id": "example", "version": "example", "agentId": "example", "scope": { "kind": "tenant" }, "spec": { "comparison": { "maxAgeHours": 1, "testSet": { "id": "example", "version": "example" } }, "evidence": { "minCases": 1, "minWeight": 1 }, "metrics": [ { "name": "passRate", "k": 1, "minCandidate": 1, "maxDrop": 1 } ], "replay": { "maxDiverged": 1, "maxErrors": 1, "maxRefusedWrites": 1, "maxStopped": 1 }, "cases": { "minPassing": 1, "noNewFailures": true }, "approvals": { "role": "standard", "separateApprover": true }, "onlyExpertGroups": true }, "description": "example" }'Registers a release gate, or a new version of one: what a pin of agentId for scope must show. One gate per agent and scope: another gate id for a scope that has one is refused with 409 release-gate-scope-taken (details.heldBy names it; publish a new version of that one instead), and a new version can’t change the agent or scope (409 release-gate-scope-changed). The spec is checked strictly: an unknown key is refused (400 validation-failed, details.issues). Needs admin on the workspace: whoever may pin can’t loosen their own gate.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
Responses
Section titled “Responses”Release gate published.
object
Example
{ "scope": { "kind": "tenant" }, "spec": { "metrics": [ { "name": "passRate" } ], "approvals": { "role": "standard" } }}Validation failed (see details.issues).
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" }}permission-denied: the caller may not make this change. Without an authorization store, key-project-mismatch (details.keyProjectId): the API key or session is limited to a project, and this writes above it, to the workspace, an org or a team (with a store, that is permission-denied).
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}release-gate-already-registered: that (id, version) exists. release-gate-scope-taken: another release gate gates the agent for the scope (details.heldBy). release-gate-scope-changed: the version would change the agent or scope. release-gate-scope-unpinned: the scope has no pinned version of its own; a gated scope holds its own pin (a pin above it is not enough, since a pin there would change this scope ungated), so pin a version for the scope first. Or idempotency-key-in-flight (with Retry-After): a request with the same Idempotency-Key still runs, so this one wasn’t run; send it again after Retry-After to get that request’s answer.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”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" }}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" }}The Idempotency-Key store (idempotency-store-unavailable) or the authorization store (authz-backend-unavailable) couldn’t be reached before the request ran, or the database was too busy for its authorization check (database-busy), so nothing was changed; Retry-After (whole seconds) says when to try again with the same key. 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/release-gates: List release gates- Error code
authz-backend-unavailable - Error code
database-busy - Error code
idempotency-key-in-flight - Error code
idempotency-store-unavailable - Error code
key-project-mismatch - Error code
permission-denied - Error code
rate-limit-exceeded - Error code
release-gate-already-registered - Error code
release-gate-scope-changed - Error code
release-gate-scope-taken - Error code
release-gate-scope-unpinned - Error code
request-too-large - Error code
tenant-state-unavailable - Every error code