Create Webhook Endpoint
curl --request POST \
--url https://api.bunship.com/api/v1/organizations/{orgId}/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"description": "<string>",
"events": [
"<string>"
]
}
'import requests
url = "https://api.bunship.com/api/v1/organizations/{orgId}/webhooks"
payload = {
"url": "<string>",
"description": "<string>",
"events": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: '<string>', description: '<string>', events: ['<string>']})
};
fetch('https://api.bunship.com/api/v1/organizations/{orgId}/webhooks', 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.bunship.com/api/v1/organizations/{orgId}/webhooks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => '<string>',
'description' => '<string>',
'events' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.bunship.com/api/v1/organizations/{orgId}/webhooks"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"description\": \"<string>\",\n \"events\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.post("https://api.bunship.com/api/v1/organizations/{orgId}/webhooks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"description\": \"<string>\",\n \"events\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bunship.com/api/v1/organizations/{orgId}/webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\",\n \"description\": \"<string>\",\n \"events\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "wh_abc123",
"organizationId": "org_cld2abc123def456",
"url": "https://example.com/webhooks/bunship",
"description": "Production webhook handler",
"events": ["member.added", "member.removed"],
"secret": "whsec_abc123def456...",
"isActive": true,
"createdAt": "2024-01-15T10:00:00Z",
"updatedAt": "2024-01-15T10:00:00Z"
}
}
Webhooks
Create Webhook Endpoint
Register a new webhook endpoint
POST
/
api
/
v1
/
organizations
/
{orgId}
/
webhooks
Create Webhook Endpoint
curl --request POST \
--url https://api.bunship.com/api/v1/organizations/{orgId}/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"description": "<string>",
"events": [
"<string>"
]
}
'import requests
url = "https://api.bunship.com/api/v1/organizations/{orgId}/webhooks"
payload = {
"url": "<string>",
"description": "<string>",
"events": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: '<string>', description: '<string>', events: ['<string>']})
};
fetch('https://api.bunship.com/api/v1/organizations/{orgId}/webhooks', 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.bunship.com/api/v1/organizations/{orgId}/webhooks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => '<string>',
'description' => '<string>',
'events' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.bunship.com/api/v1/organizations/{orgId}/webhooks"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"description\": \"<string>\",\n \"events\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.post("https://api.bunship.com/api/v1/organizations/{orgId}/webhooks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"description\": \"<string>\",\n \"events\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bunship.com/api/v1/organizations/{orgId}/webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\",\n \"description\": \"<string>\",\n \"events\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "wh_abc123",
"organizationId": "org_cld2abc123def456",
"url": "https://example.com/webhooks/bunship",
"description": "Production webhook handler",
"events": ["member.added", "member.removed"],
"secret": "whsec_abc123def456...",
"isActive": true,
"createdAt": "2024-01-15T10:00:00Z",
"updatedAt": "2024-01-15T10:00:00Z"
}
}
Creates a new webhook endpoint for the organization. A signing secret is generated automatically and returned in the response. Store the secret securely — it is only shown once and is used to verify webhook signatures.
Auth
Requires a valid Bearer token. User must be a member of the organization.
Path Parameters
Organization identifier.
Request Body
Webhook delivery URL. Must be a valid HTTPS URI.
Description of what this webhook endpoint is used for.
Array of event types to subscribe to. If omitted or empty, the endpoint receives all events.
Response
Returns the created webhook endpoint including the signing secret.{
"success": true,
"data": {
"id": "wh_abc123",
"organizationId": "org_cld2abc123def456",
"url": "https://example.com/webhooks/bunship",
"description": "Production webhook handler",
"events": ["member.added", "member.removed"],
"secret": "whsec_abc123def456...",
"isActive": true,
"createdAt": "2024-01-15T10:00:00Z",
"updatedAt": "2024-01-15T10:00:00Z"
}
}
Example
curl -X POST https://api.bunship.com/api/v1/organizations/org_cld2abc123def456/webhooks \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/webhooks/bunship",
"description": "Production webhook handler",
"events": ["member.added", "member.removed"]
}'
⌘I

