Create webhook
curl --request POST \
--url https://fanifyai.com/api/v1/hub/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://host/FanifyHub/Webhook",
"events": [
"generation.running",
"generation.completed"
]
}
'import requests
url = "https://fanifyai.com/api/v1/hub/webhooks"
payload = {
"url": "https://host/FanifyHub/Webhook",
"events": ["generation.running", "generation.completed"]
}
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: 'https://host/FanifyHub/Webhook',
events: ['generation.running', 'generation.completed']
})
};
fetch('https://fanifyai.com/api/v1/hub/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://fanifyai.com/api/v1/hub/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://host/FanifyHub/Webhook',
'events' => [
'generation.running',
'generation.completed'
]
]),
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://fanifyai.com/api/v1/hub/webhooks"
payload := strings.NewReader("{\n \"url\": \"https://host/FanifyHub/Webhook\",\n \"events\": [\n \"generation.running\",\n \"generation.completed\"\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://fanifyai.com/api/v1/hub/webhooks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://host/FanifyHub/Webhook\",\n \"events\": [\n \"generation.running\",\n \"generation.completed\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://fanifyai.com/api/v1/hub/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\": \"https://host/FanifyHub/Webhook\",\n \"events\": [\n \"generation.running\",\n \"generation.completed\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "0192f3a4-8c1e-7b2a-9f10-2b6d4e0c9a11",
"url": "https://host/FanifyHub/Webhook",
"events": [
"generation.running",
"generation.completed"
],
"created_at": "2026-09-07T10:00:00Z",
"last_error": null,
"secret": "3s9K7dQ2pR1sT4uV6wX9yZ0aB2cD4eF6gH8iJ0kL2mN"
}{
"type": "https://fanifyai.com/docs/hub/errors#invalid_input",
"title": "Invalid input",
"status": 400,
"code": "invalid_input"
}{
"type": "https://fanifyai.com/docs/hub/errors#unauthorized",
"title": "Unauthorized",
"status": 401,
"code": "unauthorized"
}{
"type": "https://fanifyai.com/docs/hub/errors#rate_limited",
"title": "Rate limit reached",
"status": 429,
"code": "rate_limited"
}{
"type": "https://fanifyai.com/docs/hub/errors#webhooks_not_configured",
"title": "Webhooks not configured",
"status": 503,
"code": "webhooks_not_configured"
}Webhooks
Create webhook
Registers a webhook and returns its secret once.
POST
/
api
/
v1
/
hub
/
webhooks
Create webhook
curl --request POST \
--url https://fanifyai.com/api/v1/hub/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://host/FanifyHub/Webhook",
"events": [
"generation.running",
"generation.completed"
]
}
'import requests
url = "https://fanifyai.com/api/v1/hub/webhooks"
payload = {
"url": "https://host/FanifyHub/Webhook",
"events": ["generation.running", "generation.completed"]
}
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: 'https://host/FanifyHub/Webhook',
events: ['generation.running', 'generation.completed']
})
};
fetch('https://fanifyai.com/api/v1/hub/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://fanifyai.com/api/v1/hub/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://host/FanifyHub/Webhook',
'events' => [
'generation.running',
'generation.completed'
]
]),
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://fanifyai.com/api/v1/hub/webhooks"
payload := strings.NewReader("{\n \"url\": \"https://host/FanifyHub/Webhook\",\n \"events\": [\n \"generation.running\",\n \"generation.completed\"\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://fanifyai.com/api/v1/hub/webhooks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://host/FanifyHub/Webhook\",\n \"events\": [\n \"generation.running\",\n \"generation.completed\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://fanifyai.com/api/v1/hub/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\": \"https://host/FanifyHub/Webhook\",\n \"events\": [\n \"generation.running\",\n \"generation.completed\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "0192f3a4-8c1e-7b2a-9f10-2b6d4e0c9a11",
"url": "https://host/FanifyHub/Webhook",
"events": [
"generation.running",
"generation.completed"
],
"created_at": "2026-09-07T10:00:00Z",
"last_error": null,
"secret": "3s9K7dQ2pR1sT4uV6wX9yZ0aB2cD4eF6gH8iJ0kL2mN"
}{
"type": "https://fanifyai.com/docs/hub/errors#invalid_input",
"title": "Invalid input",
"status": 400,
"code": "invalid_input"
}{
"type": "https://fanifyai.com/docs/hub/errors#unauthorized",
"title": "Unauthorized",
"status": 401,
"code": "unauthorized"
}{
"type": "https://fanifyai.com/docs/hub/errors#rate_limited",
"title": "Rate limit reached",
"status": 429,
"code": "rate_limited"
}{
"type": "https://fanifyai.com/docs/hub/errors#webhooks_not_configured",
"title": "Webhooks not configured",
"status": 503,
"code": "webhooks_not_configured"
}Authorizations
Fanify API key.
Body
application/json
Webhook registration
Was this page helpful?
