Create a webhook endpoint
curl --request POST \
--url https://api.humain.ai/api/v1/webhooks \
--header 'Content-Type: application/json' \
--cookie __session= \
--data '
{
"url": "https://example.com/webhooks/humain",
"event_types": [
"session.opened",
"session.ended",
"guardrail.fired"
],
"enabled": true
}
'import requests
url = "https://api.humain.ai/api/v1/webhooks"
payload = {
"url": "https://example.com/webhooks/humain",
"event_types": ["session.opened", "session.ended", "guardrail.fired"],
"enabled": True
}
headers = {
"cookie": "__session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: '__session=', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://example.com/webhooks/humain',
event_types: ['session.opened', 'session.ended', 'guardrail.fired'],
enabled: true
})
};
fetch('https://api.humain.ai/api/v1/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.humain.ai/api/v1/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' => 'https://example.com/webhooks/humain',
'event_types' => [
'session.opened',
'session.ended',
'guardrail.fired'
],
'enabled' => true
]),
CURLOPT_COOKIE => "__session=",
CURLOPT_HTTPHEADER => [
"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.humain.ai/api/v1/webhooks"
payload := strings.NewReader("{\n \"url\": \"https://example.com/webhooks/humain\",\n \"event_types\": [\n \"session.opened\",\n \"session.ended\",\n \"guardrail.fired\"\n ],\n \"enabled\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("cookie", "__session=")
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.humain.ai/api/v1/webhooks")
.header("cookie", "__session=")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://example.com/webhooks/humain\",\n \"event_types\": [\n \"session.opened\",\n \"session.ended\",\n \"guardrail.fired\"\n ],\n \"enabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.humain.ai/api/v1/webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["cookie"] = '__session='
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://example.com/webhooks/humain\",\n \"event_types\": [\n \"session.opened\",\n \"session.ended\",\n \"guardrail.fired\"\n ],\n \"enabled\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "wh_9f2a1c",
"url": "https://example.com/webhooks/humain",
"event_types": [
"session.opened"
],
"enabled": true,
"secret_prefix": "whsec_a1",
"created_at": "2023-11-07T05:31:56Z",
"secret": "whsec_a1b2c3d4e5f6..."
}{
"error": "UNAUTHENTICATED",
"message": "Missing or invalid device token.",
"details": {}
}{
"error": "UNAUTHENTICATED",
"message": "Missing or invalid admin session.",
"details": {}
}Webhooks
Create a webhook endpoint
Creates a new webhook endpoint. The response includes the signing secret — it is
shown only once and cannot be retrieved again. Regenerate it from
POST /api/v1/webhooks/{webhook_id}/regenerate-secret if lost.
POST
/
api
/
v1
/
webhooks
Create a webhook endpoint
curl --request POST \
--url https://api.humain.ai/api/v1/webhooks \
--header 'Content-Type: application/json' \
--cookie __session= \
--data '
{
"url": "https://example.com/webhooks/humain",
"event_types": [
"session.opened",
"session.ended",
"guardrail.fired"
],
"enabled": true
}
'import requests
url = "https://api.humain.ai/api/v1/webhooks"
payload = {
"url": "https://example.com/webhooks/humain",
"event_types": ["session.opened", "session.ended", "guardrail.fired"],
"enabled": True
}
headers = {
"cookie": "__session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: '__session=', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://example.com/webhooks/humain',
event_types: ['session.opened', 'session.ended', 'guardrail.fired'],
enabled: true
})
};
fetch('https://api.humain.ai/api/v1/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.humain.ai/api/v1/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' => 'https://example.com/webhooks/humain',
'event_types' => [
'session.opened',
'session.ended',
'guardrail.fired'
],
'enabled' => true
]),
CURLOPT_COOKIE => "__session=",
CURLOPT_HTTPHEADER => [
"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.humain.ai/api/v1/webhooks"
payload := strings.NewReader("{\n \"url\": \"https://example.com/webhooks/humain\",\n \"event_types\": [\n \"session.opened\",\n \"session.ended\",\n \"guardrail.fired\"\n ],\n \"enabled\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("cookie", "__session=")
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.humain.ai/api/v1/webhooks")
.header("cookie", "__session=")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://example.com/webhooks/humain\",\n \"event_types\": [\n \"session.opened\",\n \"session.ended\",\n \"guardrail.fired\"\n ],\n \"enabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.humain.ai/api/v1/webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["cookie"] = '__session='
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://example.com/webhooks/humain\",\n \"event_types\": [\n \"session.opened\",\n \"session.ended\",\n \"guardrail.fired\"\n ],\n \"enabled\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "wh_9f2a1c",
"url": "https://example.com/webhooks/humain",
"event_types": [
"session.opened"
],
"enabled": true,
"secret_prefix": "whsec_a1",
"created_at": "2023-11-07T05:31:56Z",
"secret": "whsec_a1b2c3d4e5f6..."
}{
"error": "UNAUTHENTICATED",
"message": "Missing or invalid device token.",
"details": {}
}{
"error": "UNAUTHENTICATED",
"message": "Missing or invalid admin session.",
"details": {}
}Authorizations
Body
application/json
Minimum array length:
1See Webhooks — event types for payload schemas.
Available options:
session.opened, session.ended, guardrail.fired, fraud.blocked, credential.revoked, kiosk.updated, document.processed, escalation.created Response
Webhook endpoint created
See Webhooks — event types for payload schemas.
Available options:
session.opened, session.ended, guardrail.fired, fraud.blocked, credential.revoked, kiosk.updated, document.processed, escalation.created