Update a webhook subscription
curl --request PATCH \
--url https://agents.assemblyai.com/v1/webhook-subscriptions/{subscription_id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"events": [],
"secret": "<string>",
"enabled": true
}
'import requests
url = "https://agents.assemblyai.com/v1/webhook-subscriptions/{subscription_id}"
payload = {
"url": "<string>",
"events": [],
"secret": "<string>",
"enabled": True
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: '<string>', events: [], secret: '<string>', enabled: true})
};
fetch('https://agents.assemblyai.com/v1/webhook-subscriptions/{subscription_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://agents.assemblyai.com/v1/webhook-subscriptions/{subscription_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>',
'events' => [
],
'secret' => '<string>',
'enabled' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://agents.assemblyai.com/v1/webhook-subscriptions/{subscription_id}"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"events\": [],\n \"secret\": \"<string>\",\n \"enabled\": true\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<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://agents.assemblyai.com/v1/webhook-subscriptions/{subscription_id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"events\": [],\n \"secret\": \"<string>\",\n \"enabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://agents.assemblyai.com/v1/webhook-subscriptions/{subscription_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\",\n \"events\": [],\n \"secret\": \"<string>\",\n \"enabled\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"agent_id": "<string>",
"url": "<string>",
"events": [],
"enabled": true,
"secret_version": 1,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"detail": "Unauthorized"
}{
"detail": "Unauthorized"
}Webhooks
Update a webhook subscription
Update any of url, events, secret, or enabled. Sending a new secret rotates it and increments secret_version.
PATCH
/
v1
/
webhook-subscriptions
/
{subscription_id}
Update a webhook subscription
curl --request PATCH \
--url https://agents.assemblyai.com/v1/webhook-subscriptions/{subscription_id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"events": [],
"secret": "<string>",
"enabled": true
}
'import requests
url = "https://agents.assemblyai.com/v1/webhook-subscriptions/{subscription_id}"
payload = {
"url": "<string>",
"events": [],
"secret": "<string>",
"enabled": True
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: '<string>', events: [], secret: '<string>', enabled: true})
};
fetch('https://agents.assemblyai.com/v1/webhook-subscriptions/{subscription_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://agents.assemblyai.com/v1/webhook-subscriptions/{subscription_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>',
'events' => [
],
'secret' => '<string>',
'enabled' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://agents.assemblyai.com/v1/webhook-subscriptions/{subscription_id}"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"events\": [],\n \"secret\": \"<string>\",\n \"enabled\": true\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<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://agents.assemblyai.com/v1/webhook-subscriptions/{subscription_id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"events\": [],\n \"secret\": \"<string>\",\n \"enabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://agents.assemblyai.com/v1/webhook-subscriptions/{subscription_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\",\n \"events\": [],\n \"secret\": \"<string>\",\n \"enabled\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"agent_id": "<string>",
"url": "<string>",
"events": [],
"enabled": true,
"secret_version": 1,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"detail": "Unauthorized"
}{
"detail": "Unauthorized"
}Authorizations
Your AssemblyAI API key in the Authorization header (raw key; a Bearer prefix is also accepted).
Path Parameters
Example:
"0d75ebd7-937c-495c-b638-ba582ec05b39"
Body
application/json
Response
The updated subscription.
A subscription. The signing secret is never returned, only its version.
Was this page helpful?
⌘I