curl --request POST \
--url https://enterprise.tavrn.ai/v2/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Production webhook",
"url": "https://client.example.com/webhooks/tavrn",
"events": [
"retrieval_request.status_changed",
"retrieval_request.documents_available"
],
"description": "Production webhook for retrieval events"
}
'import requests
url = "https://enterprise.tavrn.ai/v2/webhooks"
payload = {
"name": "Production webhook",
"url": "https://client.example.com/webhooks/tavrn",
"events": ["retrieval_request.status_changed", "retrieval_request.documents_available"],
"description": "Production webhook for retrieval events"
}
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({
name: 'Production webhook',
url: 'https://client.example.com/webhooks/tavrn',
events: ['retrieval_request.status_changed', 'retrieval_request.documents_available'],
description: 'Production webhook for retrieval events'
})
};
fetch('https://enterprise.tavrn.ai/v2/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://enterprise.tavrn.ai/v2/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([
'name' => 'Production webhook',
'url' => 'https://client.example.com/webhooks/tavrn',
'events' => [
'retrieval_request.status_changed',
'retrieval_request.documents_available'
],
'description' => 'Production webhook for retrieval events'
]),
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://enterprise.tavrn.ai/v2/webhooks"
payload := strings.NewReader("{\n \"name\": \"Production webhook\",\n \"url\": \"https://client.example.com/webhooks/tavrn\",\n \"events\": [\n \"retrieval_request.status_changed\",\n \"retrieval_request.documents_available\"\n ],\n \"description\": \"Production webhook for retrieval events\"\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://enterprise.tavrn.ai/v2/webhooks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Production webhook\",\n \"url\": \"https://client.example.com/webhooks/tavrn\",\n \"events\": [\n \"retrieval_request.status_changed\",\n \"retrieval_request.documents_available\"\n ],\n \"description\": \"Production webhook for retrieval events\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://enterprise.tavrn.ai/v2/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 \"name\": \"Production webhook\",\n \"url\": \"https://client.example.com/webhooks/tavrn\",\n \"events\": [\n \"retrieval_request.status_changed\",\n \"retrieval_request.documents_available\"\n ],\n \"description\": \"Production webhook for retrieval events\"\n}"
response = http.request(request)
puts response.read_body{
"id": "507f1f77bcf86cd799439016",
"name": "Production webhook",
"url": "https://client.example.com/webhooks/tavrn",
"description": "<string>",
"events": [
"retrieval_request.status_changed"
],
"secret": "whsec_XyZ789AbCdEfGhIjKlMnOpQrSt",
"is_enabled": true,
"auto_disabled_at": "2023-11-07T05:31:56Z",
"last_failure": {},
"created_at": "2026-10-08T12:00:00.000Z"
}{
"error": {
"code": "validation_error",
"message": "The patient.date_of_birth field is required"
}
}{
"error": {
"code": "validation_error",
"message": "The patient.date_of_birth field is required"
}
}{
"error": {
"code": "validation_error",
"message": "The patient.date_of_birth field is required"
}
}Create webhook
Register a new webhook endpoint. Requires webhooks:write; subscribing to retrieval events also requires retrievals:read. The secret is returned only in this response.
curl --request POST \
--url https://enterprise.tavrn.ai/v2/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Production webhook",
"url": "https://client.example.com/webhooks/tavrn",
"events": [
"retrieval_request.status_changed",
"retrieval_request.documents_available"
],
"description": "Production webhook for retrieval events"
}
'import requests
url = "https://enterprise.tavrn.ai/v2/webhooks"
payload = {
"name": "Production webhook",
"url": "https://client.example.com/webhooks/tavrn",
"events": ["retrieval_request.status_changed", "retrieval_request.documents_available"],
"description": "Production webhook for retrieval events"
}
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({
name: 'Production webhook',
url: 'https://client.example.com/webhooks/tavrn',
events: ['retrieval_request.status_changed', 'retrieval_request.documents_available'],
description: 'Production webhook for retrieval events'
})
};
fetch('https://enterprise.tavrn.ai/v2/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://enterprise.tavrn.ai/v2/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([
'name' => 'Production webhook',
'url' => 'https://client.example.com/webhooks/tavrn',
'events' => [
'retrieval_request.status_changed',
'retrieval_request.documents_available'
],
'description' => 'Production webhook for retrieval events'
]),
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://enterprise.tavrn.ai/v2/webhooks"
payload := strings.NewReader("{\n \"name\": \"Production webhook\",\n \"url\": \"https://client.example.com/webhooks/tavrn\",\n \"events\": [\n \"retrieval_request.status_changed\",\n \"retrieval_request.documents_available\"\n ],\n \"description\": \"Production webhook for retrieval events\"\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://enterprise.tavrn.ai/v2/webhooks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Production webhook\",\n \"url\": \"https://client.example.com/webhooks/tavrn\",\n \"events\": [\n \"retrieval_request.status_changed\",\n \"retrieval_request.documents_available\"\n ],\n \"description\": \"Production webhook for retrieval events\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://enterprise.tavrn.ai/v2/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 \"name\": \"Production webhook\",\n \"url\": \"https://client.example.com/webhooks/tavrn\",\n \"events\": [\n \"retrieval_request.status_changed\",\n \"retrieval_request.documents_available\"\n ],\n \"description\": \"Production webhook for retrieval events\"\n}"
response = http.request(request)
puts response.read_body{
"id": "507f1f77bcf86cd799439016",
"name": "Production webhook",
"url": "https://client.example.com/webhooks/tavrn",
"description": "<string>",
"events": [
"retrieval_request.status_changed"
],
"secret": "whsec_XyZ789AbCdEfGhIjKlMnOpQrSt",
"is_enabled": true,
"auto_disabled_at": "2023-11-07T05:31:56Z",
"last_failure": {},
"created_at": "2026-10-08T12:00:00.000Z"
}{
"error": {
"code": "validation_error",
"message": "The patient.date_of_birth field is required"
}
}{
"error": {
"code": "validation_error",
"message": "The patient.date_of_birth field is required"
}
}{
"error": {
"code": "validation_error",
"message": "The patient.date_of_birth field is required"
}
}Authorizations
API key authentication. Use format: Authorization: Bearer tavrn_sk_live_...
Body
Webhook name, unique within your organization
1 - 100"Production webhook"
Webhook endpoint URL (must use HTTP/HTTPS)
2048"https://client.example.com/webhooks/tavrn"
Event types to subscribe to (at least one required)
1retrieval_request.status_changed, retrieval_request.action_required, retrieval_request.documents_available [
"retrieval_request.status_changed",
"retrieval_request.documents_available"
]
Optional webhook description
500"Production webhook for retrieval events"
Response
Webhook created successfully (secret is ONLY returned here!)
Creation response. Read or list the webhook for delivery health fields.
Opaque webhook identifier.
"507f1f77bcf86cd799439016"
Webhook name, unique within your organization
"Production webhook"
"https://client.example.com/webhooks/tavrn"
Optional webhook description
retrieval_request.status_changed, retrieval_request.action_required, retrieval_request.documents_available Webhook secret, returned only on creation. Store it securely.
"whsec_XyZ789AbCdEfGhIjKlMnOpQrSt"
true
Always null when the webhook is created
Always null when the webhook is created
"2026-10-08T12:00:00.000Z"