Update a destination
const url = 'https://example.com/v1/destinations/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example","people":["2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"],"url":"https://example.com","urlRef":{"envName":"example","name":"example"},"secretRef":{"envName":"example","name":"example"},"projects":["2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"],"content":"link"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://example.com/v1/destinations/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0 \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "people": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "url": "https://example.com", "urlRef": { "envName": "example", "name": "example" }, "secretRef": { "envName": "example", "name": "example" }, "projects": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "content": "link" }'Absent fields are kept, and kind never changes. A new url replaces the stored one; urlRef replaces where it’s kept. projects: null lets every project’s schedules use it again. The kind’s rules hold for the result: content: "answer" still needs projects.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The destination id.
Header Parameters
Section titled “Header Parameters”Caller-supplied idempotency key, scoped to the caller: the same key from someone else in the workspace 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). A request whose key store can’t be read before it runs is answered 503 idempotency-store-unavailable with Retry-After: nothing ran, so retry with the same key (from 0.3.0).
Request Bodyrequired
Section titled “Request Bodyrequired”Fields to change; absent fields are kept and kind never changes. A new url rotates the stored one; urlRef replaces it.
object
Absolute https URL to post to. No credentials in the URL. Write-only: the deployment keeps it in its secrets store and it is never returned (host and urlRef say where it goes). Give url or urlRef, not both. The deployment may refuse private network addresses (400 destination-url-refused).
A secret by name in the deployment’s secrets store, resolved at tenant scope (the same shape as a webhook endpoint’s secretRef). The store keeps the value; the destination keeps only this reference.
object
A secret by name in the deployment’s secrets store, resolved at tenant scope (the same shape as a webhook endpoint’s secretRef). The store keeps the value; the destination keeps only this reference.
object
null lets every project’s schedules use it again.
What a message carries. link: the run’s status and its console link. answer: also the run’s answer, up to its first 1,000 characters; only on a destination that names projects, and never on the webhook kind, whose receiver reads the run with its own key.
Responses
Section titled “Responses”The updated destination.
Where a schedule sends its results. Its URL is never returned: host and urlRef say where it goes. GET /v1/destinations?projectId= answers a caller who is not a workspace admin without people, host, urlRef, secretRef and projects.
object
Where a destination sends. email goes to workspace members, each checked when a message is sent; the others post to a URL.
email: the workspace members it goes to. Absent on the other kinds.
The URL’s host, on every kind but email. The URL itself is never returned.
Where its URL is kept, on every kind but email.
object
webhook: its signing secret, by reference, as a webhook endpoint’s.
object
The projects whose schedules may use it. Absent: every project’s may.
What a message carries. link: the run’s status and its console link. answer: also the run’s answer, up to its first 1,000 characters; only on a destination that names projects, and never on the webhook kind, whose receiver reads the run with its own key.
active: it takes messages. failing: its last delivery got an answer that won’t change on a retry (such as a removed webhook’s 404 or 410); later messages for it are kept but held until a sendTest reaches it.
Why it is failing, as a fixed reason that never holds the URL; null when it is active.
Example
{ "kind": "email", "content": "link", "status": "active"}destinationId is not a destination id (a UUID); malformed body, unknown field (unknown-field), kind given, or fields that don’t fit the kind (bad-input); the deployment lacks what the kind needs; a person in people is no member of the workspace; the URL is refused (destination-url-refused); a secret urlRef or secretRef names does not exist (destination-secret-not-found), the signing secret is too weak (destination-secret-too-weak), it’s a model provider’s key (provider-key-refused), or it’s under the reserved kindgi. prefix (reserved-name-prefix). Or connection-key-refused: a secret it names is the account key of a texts connection app registration (details.secret, details.appId), which only that registration names. Use a key of its own: a new API key from the provider, stored under its own name. A copy of this one under another name reaches the same account. Or identity-provider-key-refused: a secret it names is an identity provider’s secret, an OIDC client secret or a SAML signing or decryption key (details.secret, details.identityProviderId), which only sign-in names. If one app registration serves both, give it a second secret of its own (a second client secret), store that under its own name and use that name.
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" }}Not a tenant admin (permission-denied). Without an authorization store, a tenant admin is the deployment’s API token, an admin key, or a console signed in with either.
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 destination with that id (destination-not-found), or a project in projects does not exist (project-not-found).
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), and the secret reference names another. Name it under details.servedEnv. Nothing is stored. 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
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" }}Headers
Section titled “Headers”Whole seconds to wait before sending the request again, at least 1. Sent with the codes the answer names as sending it, so it may be absent.
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" }}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
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" }}Headers
Section titled “Headers”Whole seconds to wait before sending the request again, at least 1. Sent with the codes the answer names as sending it, so it may be absent.
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" }}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
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" }}Headers
Section titled “Headers”Whole seconds to wait before sending the request again, at least 1. Sent with the codes the answer names as sending it, so it may be absent.
See also
GET /v1/destinations/{destinationId}: Fetch a destinationDELETE /v1/destinations/{destinationId}: Remove a destination (soft delete)GET /v1/destinations/{destinationId}/deliveries: List a destination's deliveriesPOST /v1/destinations/{destinationId}/deliveries/{deliveryId}/redeliver: Redeliver a message- Send results to a destination
- Error code
authz-backend-unavailable - Error code
bad-input - Error code
connection-key-refused - Error code
database-busy - Error code
destination-not-found - Error code
destination-secret-not-found - Error code
destination-secret-too-weak - Error code
destination-url-refused - Error code
env-not-served - Error code
idempotency-key-in-flight - Error code
idempotency-store-unavailable - Error code
identity-provider-key-refused - Error code
permission-denied - Error code
project-not-found - Error code
provider-key-refused - Error code
rate-limit-exceeded - Error code
request-too-large - Error code
reserved-name-prefix - Error code
tenant-state-unavailable - Error code
unknown-field - Every error code