Patch Webhook Endpoint
curl --request PATCH \
--url https://api.baselayer.com/webhooks/{endpoint_id} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"channels": [
"project_1337"
],
"description": "<string>",
"disabled": true,
"filter_types": [
"user.signup"
],
"metadata": {},
"rate_limit": 1,
"secret": "whsec_C2FVsBQIhrscChlQIMV+b5sSYspob7oD",
"uid": "unique-ep-identifier",
"url": "<string>",
"version": 1
}
'import requests
url = "https://api.baselayer.com/webhooks/{endpoint_id}"
payload = {
"channels": ["project_1337"],
"description": "<string>",
"disabled": True,
"filter_types": ["user.signup"],
"metadata": {},
"rate_limit": 1,
"secret": "whsec_C2FVsBQIhrscChlQIMV+b5sSYspob7oD",
"uid": "unique-ep-identifier",
"url": "<string>",
"version": 1
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
channels: ['project_1337'],
description: '<string>',
disabled: true,
filter_types: ['user.signup'],
metadata: {},
rate_limit: 1,
secret: 'whsec_C2FVsBQIhrscChlQIMV+b5sSYspob7oD',
uid: 'unique-ep-identifier',
url: '<string>',
version: 1
})
};
fetch('https://api.baselayer.com/webhooks/{endpoint_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.baselayer.com/webhooks/{endpoint_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'channels' => [
'project_1337'
],
'description' => '<string>',
'disabled' => true,
'filter_types' => [
'user.signup'
],
'metadata' => [
],
'rate_limit' => 1,
'secret' => 'whsec_C2FVsBQIhrscChlQIMV+b5sSYspob7oD',
'uid' => 'unique-ep-identifier',
'url' => '<string>',
'version' => 1
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.baselayer.com/webhooks/{endpoint_id}"
payload := strings.NewReader("{\n \"channels\": [\n \"project_1337\"\n ],\n \"description\": \"<string>\",\n \"disabled\": true,\n \"filter_types\": [\n \"user.signup\"\n ],\n \"metadata\": {},\n \"rate_limit\": 1,\n \"secret\": \"whsec_C2FVsBQIhrscChlQIMV+b5sSYspob7oD\",\n \"uid\": \"unique-ep-identifier\",\n \"url\": \"<string>\",\n \"version\": 1\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.baselayer.com/webhooks/{endpoint_id}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"channels\": [\n \"project_1337\"\n ],\n \"description\": \"<string>\",\n \"disabled\": true,\n \"filter_types\": [\n \"user.signup\"\n ],\n \"metadata\": {},\n \"rate_limit\": 1,\n \"secret\": \"whsec_C2FVsBQIhrscChlQIMV+b5sSYspob7oD\",\n \"uid\": \"unique-ep-identifier\",\n \"url\": \"<string>\",\n \"version\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.baselayer.com/webhooks/{endpoint_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"channels\": [\n \"project_1337\"\n ],\n \"description\": \"<string>\",\n \"disabled\": true,\n \"filter_types\": [\n \"user.signup\"\n ],\n \"metadata\": {},\n \"rate_limit\": 1,\n \"secret\": \"whsec_C2FVsBQIhrscChlQIMV+b5sSYspob7oD\",\n \"uid\": \"unique-ep-identifier\",\n \"url\": \"<string>\",\n \"version\": 1\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"id": "ep_1srOrx2ZWZBpBUvZwXKQmoEYga2",
"metadata": {},
"updated_at": "2023-11-07T05:31:56Z",
"url": "https://example.com/webhook/",
"version": 1,
"channels": [
"project_123",
"group_2"
],
"disabled": false,
"filter_types": [
"user.signup",
"user.deleted"
],
"rate_limit": 1,
"uid": "unique-ep-identifier"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Webhook Endpoints
Patch Webhook Endpoint
PATCH
/
webhooks
/
{endpoint_id}
Patch Webhook Endpoint
curl --request PATCH \
--url https://api.baselayer.com/webhooks/{endpoint_id} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"channels": [
"project_1337"
],
"description": "<string>",
"disabled": true,
"filter_types": [
"user.signup"
],
"metadata": {},
"rate_limit": 1,
"secret": "whsec_C2FVsBQIhrscChlQIMV+b5sSYspob7oD",
"uid": "unique-ep-identifier",
"url": "<string>",
"version": 1
}
'import requests
url = "https://api.baselayer.com/webhooks/{endpoint_id}"
payload = {
"channels": ["project_1337"],
"description": "<string>",
"disabled": True,
"filter_types": ["user.signup"],
"metadata": {},
"rate_limit": 1,
"secret": "whsec_C2FVsBQIhrscChlQIMV+b5sSYspob7oD",
"uid": "unique-ep-identifier",
"url": "<string>",
"version": 1
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
channels: ['project_1337'],
description: '<string>',
disabled: true,
filter_types: ['user.signup'],
metadata: {},
rate_limit: 1,
secret: 'whsec_C2FVsBQIhrscChlQIMV+b5sSYspob7oD',
uid: 'unique-ep-identifier',
url: '<string>',
version: 1
})
};
fetch('https://api.baselayer.com/webhooks/{endpoint_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.baselayer.com/webhooks/{endpoint_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'channels' => [
'project_1337'
],
'description' => '<string>',
'disabled' => true,
'filter_types' => [
'user.signup'
],
'metadata' => [
],
'rate_limit' => 1,
'secret' => 'whsec_C2FVsBQIhrscChlQIMV+b5sSYspob7oD',
'uid' => 'unique-ep-identifier',
'url' => '<string>',
'version' => 1
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.baselayer.com/webhooks/{endpoint_id}"
payload := strings.NewReader("{\n \"channels\": [\n \"project_1337\"\n ],\n \"description\": \"<string>\",\n \"disabled\": true,\n \"filter_types\": [\n \"user.signup\"\n ],\n \"metadata\": {},\n \"rate_limit\": 1,\n \"secret\": \"whsec_C2FVsBQIhrscChlQIMV+b5sSYspob7oD\",\n \"uid\": \"unique-ep-identifier\",\n \"url\": \"<string>\",\n \"version\": 1\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.baselayer.com/webhooks/{endpoint_id}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"channels\": [\n \"project_1337\"\n ],\n \"description\": \"<string>\",\n \"disabled\": true,\n \"filter_types\": [\n \"user.signup\"\n ],\n \"metadata\": {},\n \"rate_limit\": 1,\n \"secret\": \"whsec_C2FVsBQIhrscChlQIMV+b5sSYspob7oD\",\n \"uid\": \"unique-ep-identifier\",\n \"url\": \"<string>\",\n \"version\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.baselayer.com/webhooks/{endpoint_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"channels\": [\n \"project_1337\"\n ],\n \"description\": \"<string>\",\n \"disabled\": true,\n \"filter_types\": [\n \"user.signup\"\n ],\n \"metadata\": {},\n \"rate_limit\": 1,\n \"secret\": \"whsec_C2FVsBQIhrscChlQIMV+b5sSYspob7oD\",\n \"uid\": \"unique-ep-identifier\",\n \"url\": \"<string>\",\n \"version\": 1\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"id": "ep_1srOrx2ZWZBpBUvZwXKQmoEYga2",
"metadata": {},
"updated_at": "2023-11-07T05:31:56Z",
"url": "https://example.com/webhook/",
"version": 1,
"channels": [
"project_123",
"group_2"
],
"disabled": false,
"filter_types": [
"user.signup",
"user.deleted"
],
"rate_limit": 1,
"uid": "unique-ep-identifier"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Path Parameters
Body
application/json
Maximum string length:
128Pattern:
^[a-zA-Z0-9\-_.]+$The event type's name
Maximum string length:
256Pattern:
^[a-zA-Z0-9\-_.]+$Show child attributes
Show child attributes
Required range:
x >= 0The endpoint's verification secret. If null is passed, a secret is automatically generated. Format: base64 encoded random bytes optionally prefixed with whsec_. Recommended size: 24.
Pattern:
^(whsec_)?[a-zA-Z0-9+/=]{32,100}$Example:
"whsec_C2FVsBQIhrscChlQIMV+b5sSYspob7oD"
The ep's UID
Required string length:
1 - 256Pattern:
^[a-zA-Z0-9\-_.]+$Example:
"unique-ep-identifier"
Minimum string length:
1Required range:
x >= 1Example:
1
Response
Successful Response
An example endpoint name
The ep's ID
Example:
"ep_1srOrx2ZWZBpBUvZwXKQmoEYga2"
Show child attributes
Show child attributes
Minimum string length:
1Example:
"https://example.com/webhook/"
Required range:
x >= 1Example:
1
List of message channels this endpoint listens to (omit for all)
Required array length:
1 - 10 elementsMaximum string length:
128Pattern:
^[a-zA-Z0-9\-_.]+$Example:
["project_123", "group_2"]
Example:
false
Minimum array length:
1The event type's name
Maximum string length:
256Pattern:
^[a-zA-Z0-9\-_.]+$Example:
["user.signup", "user.deleted"]
Required range:
x >= 0Optional unique identifier for the endpoint
Required string length:
1 - 256Pattern:
^[a-zA-Z0-9\-_.]+$Example:
"unique-ep-identifier"