Webhooks API

Reference for the management API's endpoints that make a database's webhook endpoints and its collections' triggers.

These endpoints are a database's webhooks: the endpoints it posts to and the triggers that decide when. They are the paths and the JSON of the engine's own administration API, under /v1/databases/{databaseId} instead of the engine's /v1/admin/databases/{db}, so a tool that manages a self-hosted database's triggers manages one here by changing its base URL, the prefix and its credential. The dashboard's Webhooks page does the same with a builder over each collection's schema. See the management API overview for authentication.

MethodPathDoes
GET/v1/databases/{databaseId}/endpointsLists the database's endpoints
GET/v1/databases/{databaseId}/endpoints/{endpointId}Reads an endpoint
PUT/v1/databases/{databaseId}/endpoints/{endpointId}Makes an endpoint, or changes its settings
DELETE/v1/databases/{databaseId}/endpoints/{endpointId}Removes an endpoint no trigger calls
POST/v1/databases/{databaseId}/endpoints/{endpointId}/rotate-secretRotates its signing secret
POST/v1/databases/{databaseId}/endpoints/{endpointId}/pingSends it a signed ping
POST/v1/databases/{databaseId}/endpoints/{endpointId}/pause, /resumePauses or resumes its deliveries
GET/v1/databases/{databaseId}/collections/{collectionId}/triggersLists a collection's triggers
GET/v1/databases/{databaseId}/collections/{collectionId}/triggers/{triggerId}Reads a trigger
PUT/v1/databases/{databaseId}/collections/{collectionId}/triggers/{triggerId}Makes or changes a trigger
DELETE/v1/databases/{databaseId}/collections/{collectionId}/triggers/{triggerId}Removes a trigger

Ids are yours to draw: 32 lowercase hexadecimal characters, unique among a database's endpoints and triggers. An endpoint is { name, url, secret?, headers?, maxAgeMs?, concurrency? }; a body naming anything else is refused, as the database refuses it. Its URL is HTTPS to a public address on port 443: a hosted endpoint on another port is refused (400 invalid_argument), since our cloud's nodes call nothing else. A trigger is its definition: the places of the collection's schema it watches and what happens there, an optional debounce, and whether a delivery carries the values.

Secrets

You may draw an endpoint's signing secret yourself (whsec_ and the base64 of 32 random bytes), as tools that manage a self-hosted database's endpoints do: a PUT sent again with it is recognized and answered with it again, so a creation whose answer was lost is simply sent again. Without one, the database draws the secret and answers it once, as secret, in the answer to the PUT that made the endpoint; a PUT sent again changing nothing is then 409 already_exists and carries none, and you rotate the secret to get a new one. A rotation is { id, after?, secret?, expirePrevious? }, after the endpoint's current rotation: the replaced secrets keep signing for 24 hours, unless expirePrevious ends them at once.

Our cloud keeps no secret and no header value: it passes them to the database sealed, and the database keeps them as it keeps its own keys and never reads them back. A reader whose role does not let them change endpoints sees each endpoint's URL by its origin alone, since a path or a query often carries a token.

Answers

Every answer is the database's own, its refusals included ({ "code", "message" }): 400 invalid_argument names the trigger's rule that does not fit the schema, 429 resource_exhausted a limit of your plan, 400 unsupported_version a database whose cluster does not run webhooks yet. What our cloud refuses before the database is asked comes in the same form, as for the collections API. Endpoints and triggers of a suspended database are read, never changed, until it is resumed. A management key of either role reads and changes them; a key scoped to one database reaches only that one. Each change is recorded in the audit log by its kind and its ids, never with a URL, a header or a definition.

On this page