Update Agent
curl --request PUT \
--url https://api.talkifai.dev/v1/agents/{agentId} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "<string>",
"description": "<string>",
"sysMsg": "<string>",
"model": "<string>",
"stt": "<string>",
"voiceId": "<string>",
"greetingMessage": "<string>",
"lastMessage": "<string>",
"temperature": 123,
"inactivityTimeout": 35,
"languages": [
"<string>"
],
"functionCallingEnabled": true,
"enabledFunctions": [
"<string>"
],
"enabledCustomFunctions": [
"<string>"
]
}
'import requests
url = "https://api.talkifai.dev/v1/agents/{agentId}"
payload = {
"name": "<string>",
"description": "<string>",
"sysMsg": "<string>",
"model": "<string>",
"stt": "<string>",
"voiceId": "<string>",
"greetingMessage": "<string>",
"lastMessage": "<string>",
"temperature": 123,
"inactivityTimeout": 35,
"languages": ["<string>"],
"functionCallingEnabled": True,
"enabledFunctions": ["<string>"],
"enabledCustomFunctions": ["<string>"]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
sysMsg: '<string>',
model: '<string>',
stt: '<string>',
voiceId: '<string>',
greetingMessage: '<string>',
lastMessage: '<string>',
temperature: 123,
inactivityTimeout: 35,
languages: ['<string>'],
functionCallingEnabled: true,
enabledFunctions: ['<string>'],
enabledCustomFunctions: ['<string>']
})
};
fetch('https://api.talkifai.dev/v1/agents/{agentId}', 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.talkifai.dev/v1/agents/{agentId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'sysMsg' => '<string>',
'model' => '<string>',
'stt' => '<string>',
'voiceId' => '<string>',
'greetingMessage' => '<string>',
'lastMessage' => '<string>',
'temperature' => 123,
'inactivityTimeout' => 35,
'languages' => [
'<string>'
],
'functionCallingEnabled' => true,
'enabledFunctions' => [
'<string>'
],
'enabledCustomFunctions' => [
'<string>'
]
]),
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.talkifai.dev/v1/agents/{agentId}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"sysMsg\": \"<string>\",\n \"model\": \"<string>\",\n \"stt\": \"<string>\",\n \"voiceId\": \"<string>\",\n \"greetingMessage\": \"<string>\",\n \"lastMessage\": \"<string>\",\n \"temperature\": 123,\n \"inactivityTimeout\": 35,\n \"languages\": [\n \"<string>\"\n ],\n \"functionCallingEnabled\": true,\n \"enabledFunctions\": [\n \"<string>\"\n ],\n \"enabledCustomFunctions\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.talkifai.dev/v1/agents/{agentId}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"sysMsg\": \"<string>\",\n \"model\": \"<string>\",\n \"stt\": \"<string>\",\n \"voiceId\": \"<string>\",\n \"greetingMessage\": \"<string>\",\n \"lastMessage\": \"<string>\",\n \"temperature\": 123,\n \"inactivityTimeout\": 35,\n \"languages\": [\n \"<string>\"\n ],\n \"functionCallingEnabled\": true,\n \"enabledFunctions\": [\n \"<string>\"\n ],\n \"enabledCustomFunctions\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.talkifai.dev/v1/agents/{agentId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"sysMsg\": \"<string>\",\n \"model\": \"<string>\",\n \"stt\": \"<string>\",\n \"voiceId\": \"<string>\",\n \"greetingMessage\": \"<string>\",\n \"lastMessage\": \"<string>\",\n \"temperature\": 123,\n \"inactivityTimeout\": 35,\n \"languages\": [\n \"<string>\"\n ],\n \"functionCallingEnabled\": true,\n \"enabledFunctions\": [\n \"<string>\"\n ],\n \"enabledCustomFunctions\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"agent": {
"id": "5b710eca-ee67-4c3a-aeb6-8b541f451b40",
"name": "Customer Support Bot",
"description": "Handles tier-1 support queries",
"agentArchitecture": "pipeline",
"model": "gpt_4o_mini",
"stt": "deepgram",
"voiceId": "gemini-leda-en",
"realtimeProvider": "openai",
"sysMsg": "You are a helpful customer support agent for Acme Corp. Be concise and friendly.",
"greetingType": "agentFirst",
"greetingMessage": "Hello! How can I help you today?",
"temperature": 0.7,
"inactivityTimeout": 30,
"lastMessage": "Is there anything else I can help you with?",
"mode": "public",
"functionCallingEnabled": false,
"enabledFunctions": [
"<string>"
],
"enabledCustomFunctions": [
"<string>"
],
"languages": [
{
"id": "<string>",
"language": "en"
}
],
"userId": "<string>",
"organizationId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}
}Agents
Update Agent
Updates one or more fields on an agent. Only send the fields you want to change. Architecture cannot be changed after creation.
PUT
/
v1
/
agents
/
{agentId}
Update Agent
curl --request PUT \
--url https://api.talkifai.dev/v1/agents/{agentId} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "<string>",
"description": "<string>",
"sysMsg": "<string>",
"model": "<string>",
"stt": "<string>",
"voiceId": "<string>",
"greetingMessage": "<string>",
"lastMessage": "<string>",
"temperature": 123,
"inactivityTimeout": 35,
"languages": [
"<string>"
],
"functionCallingEnabled": true,
"enabledFunctions": [
"<string>"
],
"enabledCustomFunctions": [
"<string>"
]
}
'import requests
url = "https://api.talkifai.dev/v1/agents/{agentId}"
payload = {
"name": "<string>",
"description": "<string>",
"sysMsg": "<string>",
"model": "<string>",
"stt": "<string>",
"voiceId": "<string>",
"greetingMessage": "<string>",
"lastMessage": "<string>",
"temperature": 123,
"inactivityTimeout": 35,
"languages": ["<string>"],
"functionCallingEnabled": True,
"enabledFunctions": ["<string>"],
"enabledCustomFunctions": ["<string>"]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
sysMsg: '<string>',
model: '<string>',
stt: '<string>',
voiceId: '<string>',
greetingMessage: '<string>',
lastMessage: '<string>',
temperature: 123,
inactivityTimeout: 35,
languages: ['<string>'],
functionCallingEnabled: true,
enabledFunctions: ['<string>'],
enabledCustomFunctions: ['<string>']
})
};
fetch('https://api.talkifai.dev/v1/agents/{agentId}', 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.talkifai.dev/v1/agents/{agentId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'sysMsg' => '<string>',
'model' => '<string>',
'stt' => '<string>',
'voiceId' => '<string>',
'greetingMessage' => '<string>',
'lastMessage' => '<string>',
'temperature' => 123,
'inactivityTimeout' => 35,
'languages' => [
'<string>'
],
'functionCallingEnabled' => true,
'enabledFunctions' => [
'<string>'
],
'enabledCustomFunctions' => [
'<string>'
]
]),
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.talkifai.dev/v1/agents/{agentId}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"sysMsg\": \"<string>\",\n \"model\": \"<string>\",\n \"stt\": \"<string>\",\n \"voiceId\": \"<string>\",\n \"greetingMessage\": \"<string>\",\n \"lastMessage\": \"<string>\",\n \"temperature\": 123,\n \"inactivityTimeout\": 35,\n \"languages\": [\n \"<string>\"\n ],\n \"functionCallingEnabled\": true,\n \"enabledFunctions\": [\n \"<string>\"\n ],\n \"enabledCustomFunctions\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.talkifai.dev/v1/agents/{agentId}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"sysMsg\": \"<string>\",\n \"model\": \"<string>\",\n \"stt\": \"<string>\",\n \"voiceId\": \"<string>\",\n \"greetingMessage\": \"<string>\",\n \"lastMessage\": \"<string>\",\n \"temperature\": 123,\n \"inactivityTimeout\": 35,\n \"languages\": [\n \"<string>\"\n ],\n \"functionCallingEnabled\": true,\n \"enabledFunctions\": [\n \"<string>\"\n ],\n \"enabledCustomFunctions\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.talkifai.dev/v1/agents/{agentId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"sysMsg\": \"<string>\",\n \"model\": \"<string>\",\n \"stt\": \"<string>\",\n \"voiceId\": \"<string>\",\n \"greetingMessage\": \"<string>\",\n \"lastMessage\": \"<string>\",\n \"temperature\": 123,\n \"inactivityTimeout\": 35,\n \"languages\": [\n \"<string>\"\n ],\n \"functionCallingEnabled\": true,\n \"enabledFunctions\": [\n \"<string>\"\n ],\n \"enabledCustomFunctions\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"agent": {
"id": "5b710eca-ee67-4c3a-aeb6-8b541f451b40",
"name": "Customer Support Bot",
"description": "Handles tier-1 support queries",
"agentArchitecture": "pipeline",
"model": "gpt_4o_mini",
"stt": "deepgram",
"voiceId": "gemini-leda-en",
"realtimeProvider": "openai",
"sysMsg": "You are a helpful customer support agent for Acme Corp. Be concise and friendly.",
"greetingType": "agentFirst",
"greetingMessage": "Hello! How can I help you today?",
"temperature": 0.7,
"inactivityTimeout": 30,
"lastMessage": "Is there anything else I can help you with?",
"mode": "public",
"functionCallingEnabled": false,
"enabledFunctions": [
"<string>"
],
"enabledCustomFunctions": [
"<string>"
],
"languages": [
{
"id": "<string>",
"language": "en"
}
],
"userId": "<string>",
"organizationId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}
}Overview
Updates an existing agent’s configuration. Send only the fields you want to modify — all other fields remain unchanged. Authentication: Session-based (Better Auth) Scope: Active organization from sessionRequest
Path Parameters:| Parameter | Type | Required | Description |
|---|---|---|---|
agentId | string | ✅ | Agent ID (ULID format) |
Authorization: Bearer YOUR_SESSION_TOKEN
Content-Type: application/json
{
"name": "Updated Agent Name",
"description": "Updated description",
"sysMsg": "Updated system prompt...",
"languages": ["english", "urdu"],
"agentArchitecture": "pipeline",
"model": "gpt_4o_mini",
"stt": "deepgram",
"voiceId": "cartesia-voice-456",
"realtimeProvider": "gemini",
"greetingType": "agentFirst",
"greetingMessage": "Hello! How can I assist you?",
"lastMessage": "Goodbye!",
"temperature": 0.7,
"inactivityTimeout": 30,
"mode": "public"
}
| Field | Type | Validation | Description |
|---|---|---|---|
name | string | 2-50 chars | Agent display name |
description | string | Max 200 chars | Internal description |
sysMsg | string | Max 5000 chars | System prompt |
languages | array | 1+ items | Language codes (en, ur, sd) |
agentArchitecture | string | Fixed after create | pipeline, realtime, or text |
model | string | Required for pipeline/text | LLM model |
stt | string | Required for pipeline | STT provider |
voiceId | string | Required for pipeline | Voice ID |
realtimeProvider | string | Required for realtime | openai or gemini |
greetingType | string | agentFirst or userFirst | Who speaks first |
greetingMessage | string | Optional | Greeting text |
lastMessage | string | Max 100 chars | Farewell message |
temperature | number | 0.1–1.0 | Response randomness |
inactivityTimeout | number | 10–60 seconds | Silence timeout |
mode | string | public, private, commercial | Visibility mode |
Response
Status:200 OK
{
"success": true,
"agent": {
"id": "agent_abc123",
"name": "Updated Agent Name",
"description": "Updated description",
"agentArchitecture": "pipeline",
"mode": "public",
"model": "gpt_4o_mini",
"stt": "deepgram",
"voiceId": "cartesia-voice-456",
"sysMsg": "Updated system prompt...",
"functionCallingEnabled": true,
"enabledFunctions": ["web_search", "end_call"],
"enabledCustomFunctions": [],
"greetingType": "agentFirst",
"greetingMessage": "Hello! How can I assist you?",
"lastMessage": "Goodbye!",
"temperature": 0.7,
"inactivityTimeout": 30,
"createdAt": "2024-01-10T09:00:00Z",
"updatedAt": "2024-01-15T14:30:00Z",
"userId": "user_xyz789",
"organizationId": "org_123",
"languages": [
{
"id": "lang_123",
"language": "english"
},
{
"id": "lang_124",
"language": "urdu"
}
],
"VoiceOption": {
"voiceId": "cartesia-voice-456",
"voiceName": "Sonic British",
"provider": "cartesia"
}
}
}
{
"success": true,
"agent": { /* ... agent object ... */ },
"missingKeys": ["openaiKey"],
"usedDefaults": true,
"finalModel": "gemini-2.0-flash",
"finalStt": "gemini",
"redirectUrl": "/organization?callbackUrl=/agents/create-agent/agent_abc123"
}
Access Control
| User Role | Can Update |
|---|---|
| Owner | ✅ Any agent in organization |
| Admin | ✅ Any agent in organization |
| Member (Creator) | ✅ Own agents (except commercial) |
| Member (Not Creator) | ❌ Cannot update |
- Only Owners/Admins can update commercial agents
- Creators cannot modify their own commercial agents
Validation Rules
Architecture-Specific Validation
Pipeline:{
"agentArchitecture": "pipeline",
"voiceId": "required",
"model": "required",
"stt": "required"
}
{
"agentArchitecture": "realtime",
"realtimeProvider": "required (openai or gemini)",
"voiceId": "required if greetingType=agentFirst"
}
{
"agentArchitecture": "text",
"model": "required",
"voiceId": "not applicable",
"stt": "not applicable"
}
Field Validation
| Field | Rule | Error Message |
|---|---|---|
inactivityTimeout | 10–60 seconds | ”Inactivity timeout must be between 10 and 60 seconds” |
mode | public/private/commercial | ”Invalid agent mode” |
languages | en/ur/sd only | ”Invalid language: “ |
name | Required | ”Name is required” |
description | Required | ”Description is required” |
sysMsg | Required | ”System message is required” |
Mode Change Validation
Changing to Commercial:{
"mode": "commercial"
}
- ✅ Allowed for Owners/Admins
- ❌ Forbidden for Members
- Error: “Only organization owners and admins can set agent as commercial”
Error Responses
401 Unauthorized
{
"error": "Unauthorized"
}
403 Forbidden
{
"error": "You don't have permission to update this agent"
}
400 Bad Request
{
"error": "Inactivity timeout must be between 10 and 60 seconds"
}
{
"error": "For pipeline architecture, voiceId, model, and STT are required"
}
{
"error": "Invalid agent mode. Must be 'public', 'private', or 'commercial'"
}
404 Not Found
{
"error": "Agent not found"
}
500 Server Error
{
"error": "Update failed"
}
Examples
cURL
curl -X PUT "https://studio.talkifai.dev/api/agents/agent_abc123" \
-H "Authorization: Bearer YOUR_SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Support Bot",
"temperature": 0.5,
"mode": "public"
}'
JavaScript (Fetch)
const agentId = "agent_abc123";
const updateData = {
name: "Updated Support Bot",
temperature: 0.5,
mode: "public"
};
const response = await fetch(`/api/agents/${agentId}`, {
method: 'PUT',
headers: {
'Authorization': `Bearer ${sessionToken}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(updateData)
});
const data = await response.json();
if (data.redirectUrl) {
// Missing API keys - redirect to configure
window.location.href = data.redirectUrl;
}
Next.js (Client Component)
async function updateAgent(agentId: string, updates: Partial<Agent>) {
const response = await fetch(`/api/agents/${agentId}`, {
method: 'PUT',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(updates)
});
const data = await response.json();
if (!response.ok) {
throw new Error(data.error || "Update failed");
}
// Handle missing keys redirect
if (data.redirectUrl) {
router.push(data.redirectUrl);
return;
}
// Success - agent updated
toast.success("Agent updated successfully!");
return data.agent;
}
// Usage
await updateAgent("agent_abc123", {
name: "New Name",
temperature: 0.5
});
Update Languages
const response = await fetch(`/api/agents/${agentId}`, {
method: 'PUT',
headers: {
'Authorization': `Bearer ${sessionToken}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
languages: ["english", "urdu", "sindhi"]
})
});
Change to Commercial Mode
// Only works for Owners/Admins
const response = await fetch(`/api/agents/${agentId}`, {
method: 'PUT',
headers: {
'Authorization': `Bearer ${sessionToken}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
mode: "commercial"
})
});
if (response.status === 403) {
console.error("Only owners/admins can create commercial agents");
}
Use Cases
Partial Update (Recommended)
// Only send fields you want to change
await updateAgent(agentId, {
temperature: 0.5 // Only change temperature
});
Full Configuration Update
await updateAgent(agentId, {
name: "New Name",
description: "New description",
sysMsg: "New system prompt...",
languages: ["english"],
model: "gpt_4o_mini",
stt": "deepgram",
voiceId: "cartesia-voice-123",
greetingType: "agentFirst",
greetingMessage: "Hello!",
temperature: 0.7,
inactivityTimeout: 30,
mode: "public"
});
Architecture-Specific Update
// Pipeline agent update
await updateAgent(agentId, {
agentArchitecture: "pipeline",
voiceId: "cartesia-voice-456",
model: "gpt_4o_mini",
stt: "deepgram"
});
// Realtime agent update
await updateAgent(agentId, {
agentArchitecture: "realtime",
realtimeProvider: "gemini",
voiceId: "gemini-leda-en"
});
// Text agent update
await updateAgent(agentId, {
agentArchitecture: "text",
model: "gpt_4o_mini"
});
Related Endpoints
- List Agents — List all agents
- Get Agent — Get agent details
- Create Agent — Create new agent
- Delete Agent — Delete agent
Authorizations
Your TalkifAI API key. Generate from Studio → Settings → API Keys. Format: tk_live_...
Path Parameters
Body
application/json
Available options:
openai, gemini Available options:
agentFirst, userFirst Required range:
10 <= x <= 60Available options:
public, private, commercial ⌘I