Test API Tool
curl --request POST \
--url https://app.tuco.ai/api/campaign-tools/test \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"toolId": "<string>",
"leadId": "<string>"
}
'import requests
url = "https://app.tuco.ai/api/campaign-tools/test"
payload = {
"toolId": "<string>",
"leadId": "<string>"
}
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({toolId: '<string>', leadId: '<string>'})
};
fetch('https://app.tuco.ai/api/campaign-tools/test', 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://app.tuco.ai/api/campaign-tools/test",
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([
'toolId' => '<string>',
'leadId' => '<string>'
]),
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://app.tuco.ai/api/campaign-tools/test"
payload := strings.NewReader("{\n \"toolId\": \"<string>\",\n \"leadId\": \"<string>\"\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://app.tuco.ai/api/campaign-tools/test")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"toolId\": \"<string>\",\n \"leadId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.tuco.ai/api/campaign-tools/test")
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 \"toolId\": \"<string>\",\n \"leadId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"value": "<any>",
"rawResponse": "<any>",
"testedWithLeadId": {}
}API Tools
Test API Tool
Test a Tuco AI API tool with sample arguments before wiring it into a goal bot — returns the live response, latency, and validation errors.
POST
/
api
/
campaign-tools
/
test
Test API Tool
curl --request POST \
--url https://app.tuco.ai/api/campaign-tools/test \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"toolId": "<string>",
"leadId": "<string>"
}
'import requests
url = "https://app.tuco.ai/api/campaign-tools/test"
payload = {
"toolId": "<string>",
"leadId": "<string>"
}
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({toolId: '<string>', leadId: '<string>'})
};
fetch('https://app.tuco.ai/api/campaign-tools/test', 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://app.tuco.ai/api/campaign-tools/test",
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([
'toolId' => '<string>',
'leadId' => '<string>'
]),
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://app.tuco.ai/api/campaign-tools/test"
payload := strings.NewReader("{\n \"toolId\": \"<string>\",\n \"leadId\": \"<string>\"\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://app.tuco.ai/api/campaign-tools/test")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"toolId\": \"<string>\",\n \"leadId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.tuco.ai/api/campaign-tools/test")
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 \"toolId\": \"<string>\",\n \"leadId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"value": "<any>",
"rawResponse": "<any>",
"testedWithLeadId": {}
}An API tool lets a goal bot call your endpoint mid-conversation — check stock, look up an
order, fetch a balance — and use the answer in its reply. Attach a tool to a bot by putting its
_id in that bot’s allowedToolIds.responseMapping pulled out of it. Use it to confirm the mapping before a bot depends on it.
This makes a real call to your URL. If the tool is a
POST that creates something, it will
create it.Authentication
Pass your workspace API key as a Bearer token, or use a Clerk session token.Authorization: Bearer tuco_xxxxxxxxxxxxx
Request body
string
required
The tool
_id from GET /api/campaign-tools. Missing or
malformed returns 400 Valid toolId required.string
Optional. Run the tool with a real lead’s data interpolated into the URL and body, so you see
exactly what a live conversation would send. An unknown or malformed id is ignored and the tool
runs with empty lead data.
Example
curl -X POST "https://app.tuco.ai/api/campaign-tools/test" \
-H "Authorization: Bearer tuco_xxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"toolId": "6ac3ed9271adb32c88d566e0",
"leadId": "6ac3ea0d71adb32c88d56219"
}'
Success (200 OK)
{
"value": "https://httpbin.org/get",
"rawResponse": {
"args": {},
"headers": { "User-Agent": "node" },
"url": "https://httpbin.org/get"
},
"testedWithLeadId": "6ac3ea0d71adb32c88d56219"
}
Response
any
What
responseMapping resolved to. If this is null or missing, the mapping does not match
your response shape — fix it with save-tool before attaching
the tool to a bot.any
The full response your endpoint returned.
string | null
The lead whose data was interpolated, or
null when none was used.Errors
| Status | When | Body |
|---|---|---|
400 | toolId missing or malformed | { "error": "Valid toolId required" } |
401 | Missing or invalid API key | { "error": "Unauthorized" } |
404 | No tool with that id in your workspace | { "error": "Tool not found" } |