Create Webhook Tool
curl --request POST \
--url https://api.fish.audio/v1/agent/tools \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"name": "Book appointment",
"description": "Creates an appointment in the scheduling system.",
"method": "POST",
"url": "https://api.example.com/appointments",
"arguments": [
{"name": "date", "description": "Appointment date, YYYY-MM-DD"}
],
"body_template": "{\"date\": \"{{date}}\"}",
"headers": [
{"name": "Authorization", "value": "Bearer <api-token>", "kind": "authorization_bearer"}
]
}'import requests
url = "https://api.fish.audio/v1/agent/tools"
payload = {
"name": "<string>",
"description": "",
"tool_type": "webhook",
"arguments": [
{
"name": "<string>",
"description": ""
}
],
"method": "POST",
"url": "",
"content_type": "application/json",
"body_template": "",
"headers": [
{
"name": "<string>",
"value": "<string>",
"kind": "custom"
}
],
"timeout_seconds": 30,
"error_handling": "passthrough",
"mock_responses": [
{
"name": "",
"status_code": 200,
"content_type": "application/json",
"body": ""
}
],
"expects_response": True
}
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: '<string>',
description: '',
tool_type: 'webhook',
arguments: [{name: '<string>', description: ''}],
method: 'POST',
url: '',
content_type: 'application/json',
body_template: '',
headers: [{name: '<string>', value: '<string>', kind: 'custom'}],
timeout_seconds: 30,
error_handling: 'passthrough',
mock_responses: [
{
name: '',
status_code: 200,
content_type: 'application/json',
body: JSON.stringify('')
}
],
expects_response: true
})
};
fetch('https://api.fish.audio/v1/agent/tools', 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.fish.audio/v1/agent/tools",
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' => '<string>',
'description' => '',
'tool_type' => 'webhook',
'arguments' => [
[
'name' => '<string>',
'description' => ''
]
],
'method' => 'POST',
'url' => '',
'content_type' => 'application/json',
'body_template' => '',
'headers' => [
[
'name' => '<string>',
'value' => '<string>',
'kind' => 'custom'
]
],
'timeout_seconds' => 30,
'error_handling' => 'passthrough',
'mock_responses' => [
[
'name' => '',
'status_code' => 200,
'content_type' => 'application/json',
'body' => ''
]
],
'expects_response' => 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://api.fish.audio/v1/agent/tools"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"\",\n \"tool_type\": \"webhook\",\n \"arguments\": [\n {\n \"name\": \"<string>\",\n \"description\": \"\"\n }\n ],\n \"method\": \"POST\",\n \"url\": \"\",\n \"content_type\": \"application/json\",\n \"body_template\": \"\",\n \"headers\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\",\n \"kind\": \"custom\"\n }\n ],\n \"timeout_seconds\": 30,\n \"error_handling\": \"passthrough\",\n \"mock_responses\": [\n {\n \"name\": \"\",\n \"status_code\": 200,\n \"content_type\": \"application/json\",\n \"body\": \"\"\n }\n ],\n \"expects_response\": true\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://api.fish.audio/v1/agent/tools")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"\",\n \"tool_type\": \"webhook\",\n \"arguments\": [\n {\n \"name\": \"<string>\",\n \"description\": \"\"\n }\n ],\n \"method\": \"POST\",\n \"url\": \"\",\n \"content_type\": \"application/json\",\n \"body_template\": \"\",\n \"headers\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\",\n \"kind\": \"custom\"\n }\n ],\n \"timeout_seconds\": 30,\n \"error_handling\": \"passthrough\",\n \"mock_responses\": [\n {\n \"name\": \"\",\n \"status_code\": 200,\n \"content_type\": \"application/json\",\n \"body\": \"\"\n }\n ],\n \"expects_response\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fish.audio/v1/agent/tools")
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\": \"<string>\",\n \"description\": \"\",\n \"tool_type\": \"webhook\",\n \"arguments\": [\n {\n \"name\": \"<string>\",\n \"description\": \"\"\n }\n ],\n \"method\": \"POST\",\n \"url\": \"\",\n \"content_type\": \"application/json\",\n \"body_template\": \"\",\n \"headers\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\",\n \"kind\": \"custom\"\n }\n ],\n \"timeout_seconds\": 30,\n \"error_handling\": \"passthrough\",\n \"mock_responses\": [\n {\n \"name\": \"\",\n \"status_code\": 200,\n \"content_type\": \"application/json\",\n \"body\": \"\"\n }\n ],\n \"expects_response\": true\n}"
response = http.request(request)
puts response.read_body{
"tool_id": "<string>",
"workspace_id": "<string>",
"name": "<string>",
"url": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"content_type": "<string>",
"timeout_seconds": 123,
"description": "",
"used_by": 0,
"arguments": [
{
"name": "<string>",
"description": ""
}
],
"body_template": "",
"headers": [
{
"name": "<string>",
"value": "<string>",
"has_secret": false
}
],
"mock_responses": [
{
"name": "",
"status_code": 200,
"content_type": "application/json",
"body": ""
}
],
"expects_response": true
}{
"status": 123,
"message": "<string>"
}{
"status": 123,
"message": "<string>"
}Tools
Create Tool
Create a workspace tool.
POST
/
v1
/
agent
/
tools
Create Webhook Tool
curl --request POST \
--url https://api.fish.audio/v1/agent/tools \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"name": "Book appointment",
"description": "Creates an appointment in the scheduling system.",
"method": "POST",
"url": "https://api.example.com/appointments",
"arguments": [
{"name": "date", "description": "Appointment date, YYYY-MM-DD"}
],
"body_template": "{\"date\": \"{{date}}\"}",
"headers": [
{"name": "Authorization", "value": "Bearer <api-token>", "kind": "authorization_bearer"}
]
}'import requests
url = "https://api.fish.audio/v1/agent/tools"
payload = {
"name": "<string>",
"description": "",
"tool_type": "webhook",
"arguments": [
{
"name": "<string>",
"description": ""
}
],
"method": "POST",
"url": "",
"content_type": "application/json",
"body_template": "",
"headers": [
{
"name": "<string>",
"value": "<string>",
"kind": "custom"
}
],
"timeout_seconds": 30,
"error_handling": "passthrough",
"mock_responses": [
{
"name": "",
"status_code": 200,
"content_type": "application/json",
"body": ""
}
],
"expects_response": True
}
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: '<string>',
description: '',
tool_type: 'webhook',
arguments: [{name: '<string>', description: ''}],
method: 'POST',
url: '',
content_type: 'application/json',
body_template: '',
headers: [{name: '<string>', value: '<string>', kind: 'custom'}],
timeout_seconds: 30,
error_handling: 'passthrough',
mock_responses: [
{
name: '',
status_code: 200,
content_type: 'application/json',
body: JSON.stringify('')
}
],
expects_response: true
})
};
fetch('https://api.fish.audio/v1/agent/tools', 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.fish.audio/v1/agent/tools",
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' => '<string>',
'description' => '',
'tool_type' => 'webhook',
'arguments' => [
[
'name' => '<string>',
'description' => ''
]
],
'method' => 'POST',
'url' => '',
'content_type' => 'application/json',
'body_template' => '',
'headers' => [
[
'name' => '<string>',
'value' => '<string>',
'kind' => 'custom'
]
],
'timeout_seconds' => 30,
'error_handling' => 'passthrough',
'mock_responses' => [
[
'name' => '',
'status_code' => 200,
'content_type' => 'application/json',
'body' => ''
]
],
'expects_response' => 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://api.fish.audio/v1/agent/tools"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"\",\n \"tool_type\": \"webhook\",\n \"arguments\": [\n {\n \"name\": \"<string>\",\n \"description\": \"\"\n }\n ],\n \"method\": \"POST\",\n \"url\": \"\",\n \"content_type\": \"application/json\",\n \"body_template\": \"\",\n \"headers\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\",\n \"kind\": \"custom\"\n }\n ],\n \"timeout_seconds\": 30,\n \"error_handling\": \"passthrough\",\n \"mock_responses\": [\n {\n \"name\": \"\",\n \"status_code\": 200,\n \"content_type\": \"application/json\",\n \"body\": \"\"\n }\n ],\n \"expects_response\": true\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://api.fish.audio/v1/agent/tools")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"\",\n \"tool_type\": \"webhook\",\n \"arguments\": [\n {\n \"name\": \"<string>\",\n \"description\": \"\"\n }\n ],\n \"method\": \"POST\",\n \"url\": \"\",\n \"content_type\": \"application/json\",\n \"body_template\": \"\",\n \"headers\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\",\n \"kind\": \"custom\"\n }\n ],\n \"timeout_seconds\": 30,\n \"error_handling\": \"passthrough\",\n \"mock_responses\": [\n {\n \"name\": \"\",\n \"status_code\": 200,\n \"content_type\": \"application/json\",\n \"body\": \"\"\n }\n ],\n \"expects_response\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fish.audio/v1/agent/tools")
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\": \"<string>\",\n \"description\": \"\",\n \"tool_type\": \"webhook\",\n \"arguments\": [\n {\n \"name\": \"<string>\",\n \"description\": \"\"\n }\n ],\n \"method\": \"POST\",\n \"url\": \"\",\n \"content_type\": \"application/json\",\n \"body_template\": \"\",\n \"headers\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\",\n \"kind\": \"custom\"\n }\n ],\n \"timeout_seconds\": 30,\n \"error_handling\": \"passthrough\",\n \"mock_responses\": [\n {\n \"name\": \"\",\n \"status_code\": 200,\n \"content_type\": \"application/json\",\n \"body\": \"\"\n }\n ],\n \"expects_response\": true\n}"
response = http.request(request)
puts response.read_body{
"tool_id": "<string>",
"workspace_id": "<string>",
"name": "<string>",
"url": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"content_type": "<string>",
"timeout_seconds": 123,
"description": "",
"used_by": 0,
"arguments": [
{
"name": "<string>",
"description": ""
}
],
"body_template": "",
"headers": [
{
"name": "<string>",
"value": "<string>",
"has_secret": false
}
],
"mock_responses": [
{
"name": "",
"status_code": 200,
"content_type": "application/json",
"body": ""
}
],
"expects_response": true
}{
"status": 123,
"message": "<string>"
}{
"status": 123,
"message": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Console payload minus the folder concept (folders are console-only).
Required string length:
1 - 120Maximum string length:
2000Available options:
webhook, client Show child attributes
Show child attributes
Available options:
GET, POST, PUT, PATCH, DELETE Maximum string length:
4000Maximum string length:
128Maximum string length:
100000Show child attributes
Show child attributes
Required range:
1 <= x <= 120Available options:
passthrough, hide Show child attributes
Show child attributes
Response
Document created, URL follows
Available options:
webhook, client Available options:
GET, POST, PUT, PATCH, DELETE Available options:
passthrough, hide How many agents reference this tool in their draft configuration.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Was this page helpful?
⌘I

