Sync secrets against a deployment
const url = 'https://example.com/v1/deployments/example/secrets';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"envName":"example","secrets":[{"name":"example","ref":"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/secrets \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "envName": "example", "secrets": [ { "name": "example", "ref": "example" } ] }'Deployment-scoped bulk secret sync. Body carries { envName, secrets: Array<{ name, ref } | { name, value }> }. { name, ref } entries validate against SecretBinding.get — no bytes cross the wire; missing → 404 secret-not-found. { name, value } entries write via SecretBinding.set with writeMode: add-version + tags.deployment = deploymentId and return the created reference. The write scope is derived from the deployment record itself (tenant scope, or project scope when the deployment carries a projectId) and CANNOT be overridden on the wire. A secret the tools of this deployment name that was set nowhere when a deploy or a promotion published them is read at that scope, when whoever published them administers it: a deploy needs admin there, while a promotion into the Default project needs it only on that project. Requires the secrets:write capability. Idempotency-Key applies.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Deployment id assigned by the ledger at register time.
Header Parameters
Section titled “Header Parameters”Caller-supplied idempotency key, scoped to the caller: the same key from someone else in the tenant is their own request (from 0.1.5). Retries with the same key return the original response byte-identical (per docs/API-ROUTE-CONVENTIONS.md §3.1). A retry sent while the first request still runs is answered 409 idempotency-key-in-flight with Retry-After, on a runtime whose store holds keys (from 0.1.5); retry after it, and you get the first request’s answer. An answer that carries a secret (a new API key or public run token, a session token, a generated signing secret) isn’t kept: a retry gets 409 idempotency-key-replay-withheld, with the first request’s status and when it succeeded (from 0.1.5).
Request Bodyrequired
Section titled “Request Bodyrequired”object
Per-environment slug. [a-z][a-z0-9-]{0,62} — RFC-1035-like label.
Zero or more secret entries. Each entry MUST set exactly one of ref (validate-only) or value (write new version).
object
Opaque reference to an existing secret record — validated via SecretBinding.get; no bytes cross the wire.
object
Plaintext secret value written via SecretBinding.set with writeMode: add-version. The response returns only the framework-generated reference.
Examplegenerated
{ "envName": "example", "secrets": [ { "name": "example", "ref": "example" } ]}Responses
Section titled “Responses”Sync complete.
object
object
Opaque reference — either echoed from the request ({ name, ref } entries) or freshly minted (secret:<envName>/<name>#<version> for { name, value } entries).
Examplegenerated
{ "resolved": 1, "added": 1, "references": [ { "name": "example", "ref": "example", "version": 1 } ]}A body that fails validation (bad-input), or a secret the store refuses for its name or its value: reserved-name-prefix, secret-name-invalid (a new name that isn’t 1 to 255 ASCII letters, digits, ., - and _ starting with a letter, digit or _, with any . between two non-. characters, or, under kindgi dev, isn’t capital letters, digits and underscores, starts with a digit, or is KINDGI_*; the message says the rule), secret-value-too-large, or secret-value-invalid (under kindgi dev, a value no env-file quoting can hold so that it reads back unchanged; the message says why).
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Missing / malformed / expired / revoked bearer token.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Bearer token missing secrets:write capability, or no admin on the scope it writes: the deployment’s project, else the tenant.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}No deployment with that id, or one in a project the caller doesn’t read, or referenced secret does not exist.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Idempotency-Key was reused with a different body, or resource-state conflict. Or env-not-served: this runtime keeps every value under the env it serves (whoami’s servedEnv, with refusesOtherEnvs), so a value under another env would never be read. details.envName is the env asked for, details.servedEnv the one to use. A secret that a provider, MCP endpoint or webhook endpoint registered before names under that env, at the scope it’s read at, is still written: it’s read there. Nothing is stored otherwise.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
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
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}secret-provider-rate-limited: the secrets store’s external provider is limiting the runtime’s requests.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Server error (unmapped domain code or framework crash).
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}secret-provider-unauthorized: the secrets store’s external provider refused the runtime’s credentials.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}secret-provider-unavailable: the secrets store’s external provider can’t be reached.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}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 setGET /v1/deployments/{deploymentId}/values: List the values a deployment needs in a projectPOST /v1/deployments/{deploymentId}/promotions: Promote a deployment to the next environment- Error code
bad-input - Error code
env-not-served - Error code
request-too-large - Error code
reserved-name-prefix - Error code
secret-name-invalid - Error code
secret-provider-rate-limited - Error code
secret-provider-unauthorized - Error code
secret-provider-unavailable - Error code
secret-value-invalid - Error code
secret-value-too-large - Every error code