Attach Tool
curl --request POST \
--url https://api.kejue.co/api/v1/agents/{agent_id}/tools \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"tool_name": "<string>",
"tool_id": "<string>",
"channels": [
"voice:in-call"
],
"config": {}
}
'import requests
url = "https://api.kejue.co/api/v1/agents/{agent_id}/tools"
payload = {
"tool_name": "<string>",
"tool_id": "<string>",
"channels": ["voice:in-call"],
"config": {}
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
tool_name: '<string>',
tool_id: '<string>',
channels: ['voice:in-call'],
config: {}
})
};
fetch('https://api.kejue.co/api/v1/agents/{agent_id}/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.kejue.co/api/v1/agents/{agent_id}/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([
'tool_name' => '<string>',
'tool_id' => '<string>',
'channels' => [
'voice:in-call'
],
'config' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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.kejue.co/api/v1/agents/{agent_id}/tools"
payload := strings.NewReader("{\n \"tool_name\": \"<string>\",\n \"tool_id\": \"<string>\",\n \"channels\": [\n \"voice:in-call\"\n ],\n \"config\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.kejue.co/api/v1/agents/{agent_id}/tools")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"tool_name\": \"<string>\",\n \"tool_id\": \"<string>\",\n \"channels\": [\n \"voice:in-call\"\n ],\n \"config\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kejue.co/api/v1/agents/{agent_id}/tools")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"tool_name\": \"<string>\",\n \"tool_id\": \"<string>\",\n \"channels\": [\n \"voice:in-call\"\n ],\n \"config\": {}\n}"
response = http.request(request)
puts response.read_body{
"tool_name": "<string>",
"channels": [
"<string>"
],
"config": {},
"tool_id": "<string>"
}{
"error": "Invalid or missing API key",
"code": "UNAUTHORIZED",
"details": {}
}{
"error": "Agent not found",
"code": "NOT_FOUND",
"details": {
"agent_id": "non_existent_id"
}
}{
"error": "Tool 'send_email' is already attached to this agent",
"code": "CONFLICT",
"details": {}
}{
"error": "Validation failed",
"code": "VALIDATION_ERROR",
"details": {
"errors": [
{
"field": "body.name",
"message": "Field required",
"type": "missing"
}
]
}
}Agents
Attach Tool
Attach a tool to an agent.
POST
/
agents
/
{agent_id}
/
tools
Attach Tool
curl --request POST \
--url https://api.kejue.co/api/v1/agents/{agent_id}/tools \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"tool_name": "<string>",
"tool_id": "<string>",
"channels": [
"voice:in-call"
],
"config": {}
}
'import requests
url = "https://api.kejue.co/api/v1/agents/{agent_id}/tools"
payload = {
"tool_name": "<string>",
"tool_id": "<string>",
"channels": ["voice:in-call"],
"config": {}
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
tool_name: '<string>',
tool_id: '<string>',
channels: ['voice:in-call'],
config: {}
})
};
fetch('https://api.kejue.co/api/v1/agents/{agent_id}/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.kejue.co/api/v1/agents/{agent_id}/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([
'tool_name' => '<string>',
'tool_id' => '<string>',
'channels' => [
'voice:in-call'
],
'config' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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.kejue.co/api/v1/agents/{agent_id}/tools"
payload := strings.NewReader("{\n \"tool_name\": \"<string>\",\n \"tool_id\": \"<string>\",\n \"channels\": [\n \"voice:in-call\"\n ],\n \"config\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.kejue.co/api/v1/agents/{agent_id}/tools")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"tool_name\": \"<string>\",\n \"tool_id\": \"<string>\",\n \"channels\": [\n \"voice:in-call\"\n ],\n \"config\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kejue.co/api/v1/agents/{agent_id}/tools")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"tool_name\": \"<string>\",\n \"tool_id\": \"<string>\",\n \"channels\": [\n \"voice:in-call\"\n ],\n \"config\": {}\n}"
response = http.request(request)
puts response.read_body{
"tool_name": "<string>",
"channels": [
"<string>"
],
"config": {},
"tool_id": "<string>"
}{
"error": "Invalid or missing API key",
"code": "UNAUTHORIZED",
"details": {}
}{
"error": "Agent not found",
"code": "NOT_FOUND",
"details": {
"agent_id": "non_existent_id"
}
}{
"error": "Tool 'send_email' is already attached to this agent",
"code": "CONFLICT",
"details": {}
}{
"error": "Validation failed",
"code": "VALIDATION_ERROR",
"details": {
"errors": [
{
"field": "body.name",
"message": "Field required",
"type": "missing"
}
]
}
}Authorizations
Workspace API key (e.g. kej_live_...)
Path Parameters
Body
application/json
Attach a tool to an agent.
Tool name — custom tool name or builtin name
Tool ID — required for custom HTTP tools
Channels where the tool is active: 'voice:in-call', 'voice:post-call', 'whatsapp'
Tool-specific configuration. The shape depends on the tool — see the Tools guide for the full schema of each builtin.
Examples for selected builtins:
agent_transfer — transfer the live call to a different persona:
{
"targets": [
{
"key": "billing",
"persona_id": "<persona-uuid>",
"voice_config_id": "<voice-config-uuid>",
"when_to_use": "Caller has questions about invoices, refunds, or payments."
},
{
"key": "tech_support",
"persona_id": "<persona-uuid>",
"when_to_use": "Caller is reporting a technical issue with the product."
}
]
}
create_call — create a new outbound call from inside a conversation:
{
"default_persona_id": "<persona-uuid>",
"default_context": "Follow-up call about the contact's inquiry.",
"allow_persona_override": false
}
⌘I

