Create Webhook
POST {{endpoint}}/webhooks
Creates a new webhook
Required properties:
-
name
string with a minimum length of 1 -
projectId
string -
url
url string -
httpMethod
string, should be a valid HTTP method -
topics
list of topics, should include at least one topic (minimum length of 1)- You can fetch all the available topics using our Webhook Topics route
Optional properties:
-
customHeaders
object containing optional headers that will be added to the webhook's request -
status
string, should be either"live"
or"paused"
- If the status is
paused
then no events will be sent to the webhook
- If the status is
Returns
-
201
if webhook was created successfully -
401
if authentication fails -
403
if user has insufficient roles (users withuser
andadmin
roles can create a webhook, users withviewer
role cannot)
Request Body
{"name"=>"YOUR_WEBHOOK_NAME", "url"=>"YOUR_WEBHOOK_URL", "projectId"=>"{{projectId}}", "topics"=>["api-key.created", "api-key.deleted", "api-key.updated", "api-key.firstUsed", "access-key.created", "access-key.updated", "access-key.deleted", "project.updated"], "httpMethod"=>"HTTP_METHOD", "status"=>"WEBHOOKS_STATUS"}
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
x-api-key | string |
RESPONSES
status: Created
{"id":"06af9398-428d-424f-80dd-4ec8b0428ce4","accountId":null,"projectId":"e3be2c12-a842-4cfd-a4d1-2b1846edd875","createdBy":"57626077-d74d-4449-ae3e-4a31c05a62fe","createdByType":"ACCESS_KEY","customHeaders":{"from":"theauthapi docs"},"httpMethod":"POST","name":"All fields webhook","topics":["project.updated","api-key.created","api-key.deleted","api-key.updated","api-key.firstUsed","access-key.created","access-key.updated","access-key.deleted"],"url":"https://webhook.site/3d224d6e-b525-45dd-9a60-5581df9264b9","status":"live","isActive":true,"secret":"whsec_0NTKuUQ331uNvLEaf8tvPxTIRVJ9J7aw96M61","createdAt":"2022-08-23T22:17:49.436Z"}