Register a webhook endpoint
const url = 'https://example.com/v1/webhook-endpoints';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"url":"https://example.com","events":["run.finished"],"filter":{"projectId":"example","flowIds":["example"],"includeDryRuns":true},"secretRef":{"envName":"example","name":"example"},"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/webhook-endpoints \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "url": "https://example.com", "events": [ "run.finished" ], "filter": { "projectId": "example", "flowIds": [ "example" ], "includeDryRuns": true }, "secretRef": { "envName": "example", "name": "example" }, "description": "example" }'Registers a URL the platform sends signed events to. The signing secret is shared with the receiver, so it lives in your secrets (.env in development, the secrets store in production) and the endpoint references it by name (secretRef). Store it first; POST /v1/webhook-endpoints/generate-secret makes a strong one. Deliveries are signed in the Standard Webhooks format (webhook-id, webhook-timestamp, webhook-signature); verify with verifyWebhook from @kindgi/crypto or any Standard Webhooks library. The event bodies are described under webhooks in this document.
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”Endpoint registered.
object
Example
{ "events": [ "run.finished" ]}Malformed body or unknown field; the deployment refuses the URL (webhook-url-refused); the referenced secret does not exist (webhook-secret-not-found) or is too weak (webhook-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
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" }}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
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}filter.projectId names no project (project-not-found).
object
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
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/webhook-endpoints: List webhook endpoints- Error code
authz-backend-unavailable - Error code
connection-key-refused - Error code
database-busy - 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
webhook-secret-not-found - Error code
webhook-secret-too-weak - Error code
webhook-url-refused - Every error code