Update a webhook
curl --request PATCH \
--url https://agp.eu.hcompany.ai/api/v2/webhooks/{webhook_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"enabled_events": [
"<string>"
],
"description": "<string>",
"disabled": true
}
'import requests
url = "https://agp.eu.hcompany.ai/api/v2/webhooks/{webhook_id}"
payload = {
"url": "<string>",
"enabled_events": ["<string>"],
"description": "<string>",
"disabled": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: '<string>',
enabled_events: ['<string>'],
description: '<string>',
disabled: true
})
};
fetch('https://agp.eu.hcompany.ai/api/v2/webhooks/{webhook_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://agp.eu.hcompany.ai/api/v2/webhooks/{webhook_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([
'url' => '<string>',
'enabled_events' => [
'<string>'
],
'description' => '<string>',
'disabled' => true
]),
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://agp.eu.hcompany.ai/api/v2/webhooks/{webhook_id}"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"enabled_events\": [\n \"<string>\"\n ],\n \"description\": \"<string>\",\n \"disabled\": true\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://agp.eu.hcompany.ai/api/v2/webhooks/{webhook_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"enabled_events\": [\n \"<string>\"\n ],\n \"description\": \"<string>\",\n \"disabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://agp.eu.hcompany.ai/api/v2/webhooks/{webhook_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\",\n \"enabled_events\": [\n \"<string>\"\n ],\n \"description\": \"<string>\",\n \"disabled\": true\n}"
response = http.request(request)
puts response.read_bodyWebhooks
Update a webhook
Change a webhook’s URL, events, description, or disabled state.
PATCH
/
api
/
v2
/
webhooks
/
{webhook_id}
Update a webhook
curl --request PATCH \
--url https://agp.eu.hcompany.ai/api/v2/webhooks/{webhook_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"enabled_events": [
"<string>"
],
"description": "<string>",
"disabled": true
}
'import requests
url = "https://agp.eu.hcompany.ai/api/v2/webhooks/{webhook_id}"
payload = {
"url": "<string>",
"enabled_events": ["<string>"],
"description": "<string>",
"disabled": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: '<string>',
enabled_events: ['<string>'],
description: '<string>',
disabled: true
})
};
fetch('https://agp.eu.hcompany.ai/api/v2/webhooks/{webhook_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://agp.eu.hcompany.ai/api/v2/webhooks/{webhook_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([
'url' => '<string>',
'enabled_events' => [
'<string>'
],
'description' => '<string>',
'disabled' => true
]),
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://agp.eu.hcompany.ai/api/v2/webhooks/{webhook_id}"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"enabled_events\": [\n \"<string>\"\n ],\n \"description\": \"<string>\",\n \"disabled\": true\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://agp.eu.hcompany.ai/api/v2/webhooks/{webhook_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"enabled_events\": [\n \"<string>\"\n ],\n \"description\": \"<string>\",\n \"disabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://agp.eu.hcompany.ai/api/v2/webhooks/{webhook_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\",\n \"enabled_events\": [\n \"<string>\"\n ],\n \"description\": \"<string>\",\n \"disabled\": true\n}"
response = http.request(request)
puts response.read_bodyPartially updates a webhook. Only the fields you send are changed. The signing
secret cannot be changed here; use Rotate.
Returns the updated webhook object.
Path parameters
The webhook’s
id (UUID).Request body
New target URL. Must be
https:// and publicly reachable; it is verified with a HEAD request before the change is saved, and the old URL is kept if verification fails.Replacement list of event types, or
["*"] for the session.status_updated firehose.New label (max 255 characters).
Set
true to pause deliveries without deleting the webhook. Setting false re-enables a webhook that was disabled automatically after repeated delivery failures.Examples
curl -X PATCH https://agp.eu.hcompany.ai/api/v2/webhooks/f47ac10b-58cc-4372-a567-0e02b2c3d479 \
-H "Authorization: Bearer $HAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"disabled": true}'
from hai_agents import Client
client = Client()
webhook = client.webhooks.update_webhook(
webhook_id="f47ac10b-58cc-4372-a567-0e02b2c3d479",
disabled=True,
)
print(webhook.disabled)
import { HaiAgentsClient } from "hai-agents";
const client = new HaiAgentsClient();
const webhook = await client.webhooks.updateWebhook({
webhookId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
disabled: true,
});
console.log(webhook.disabled);
Errors
| Status | Cause |
|---|---|
400 | The new URL does not resolve to a public address or could not be reached. |
404 | Webhook not found or you don’t have access. |
422 | Body failed validation: non-https URL, empty or unknown enabled_events. |
Was this page helpful?
⌘I