- Docs
- Api%2Freference%2Fwebhooks%2FCreateWebhook
Create a webhook
Point an address of yours at the things happening in your organization, and we will tell you about them as they happen. **Choosing what you hear about.** Add one rule for every template you want to watch. Inside a rule, use `actions` and `addresses` to narrow it to particular action names or signers. Empty action and address lists mean all actions and all signers for that template. Rules are ORed; fields inside a rule are ANDed. There is no organization-wide webhook. **Keep the signing key.** The response includes a `signing_key`, and this is the only time it is ever shown — there is no way to read it back and no way to roll it over. Save it now, and use it to check that each delivery really came from us; the section introduction shows how. **About your address.** It has to be an ordinary public `https` address with no username or password built into it. Literal private addresses are turned away immediately. Hostnames are resolved and checked when each delivery is made, which also protects against later DNS changes. An organization can have five webhooks. A sixth comes back as `400`. Requires the `webhooks.create` permission.
The access token returned after a successful sign-in, sent as
Authorization: Bearer <access_token>.
It identifies the person and the organization they are working in, and
it lasts about fifteen minutes. When it runs out, use their refresh
token at POST /auth/refresh-token instead of asking them to sign in
again.
In: header
Request Body
application/json
The subscription to create.
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
curl -X POST "https://api.dual.network/webhooks" \ -H "Content-Type: application/json" \ -d '{ "name": "Ticket activity", "url": "https://hooks.example.com/dual", "rules": [ { "template_id": "665f1c2d4b1a2c3d4e5f6a99" } ] }'{
"id": "665f1c2d4b1a2c3d4e5f6a7b",
"signing_key": "<the signing key, shown only here>"
}{
"code": 3,
"message": "Key: 'limit' Error:Field validation for 'limit' failed on the 'lte' tag"
}{
"code": 16,
"message": "no auth provided"
}{
"code": 13,
"message": "internal error"
}