Edit agent
Updates and publishes an existing agent. Only the fields you include are changed; everything else is left untouched. All fields are optional, so you can send partial updates.
Endpoint
POST /v1/agents/:slug/publish
Path parameters
| Parameter | Type | Description |
|---|---|---|
slug | string | Unique slug of the agent to update. |
Request body
{
"name": "API Test Agent",
"greeting": "Hello! Thanks for calling.",
"prompt": "You are a helpful sales assistant.",
"farewell": "Thank you for calling. Goodbye!",
"voiceId": "YOUR_VOICE_ID",
"allowReturnCall": true,
"numberOfAttempt": 3,
"outputVariables": [
{
"name": "customerName",
"description": "The caller's full name",
"type": "string"
}
],
"knowledgeBaseFiles": [],
"tools": [
{
"name": "lookup_order",
"type": "API_CALL",
"description": "Look up an order by ID",
"variables": [
{
"orderId": {
"type": "string",
"description": "The order ID provided by the caller"
}
}
],
"content": {
"functionName": "lookup_order",
"parameters": ["orderId"],
"url": "https://example.com/api/orders",
"authType": "Bearer",
"token": "your-token-here"
}
}
],
"config": {
"transcriberLanguage": "es-419",
"silenceTimeoutSeconds": 30,
"maxDurationSeconds": 600,
"endOfCallWebhook": "https://example.com/webhooks/end-of-call"
}
}
Top-level parameters
| Field | Type | Description |
|---|---|---|
name | string | Agent name. |
greeting | string | Opening message said when the call starts. |
prompt | string | System prompt that defines the agent behavior. |
textPrompt | string | Prompt used for text/chat conversations. |
farewell | string | Closing message said at the end of the call. |
voiceId | string | Voice identifier for the agent. |
outputVariables | array | Variables to capture during the call (same shape as in Create agent). |
recallLogic | object | Retry/recall configuration. |
numberOfAttempt | integer | Number of call attempts. |
allowReturnCall | boolean | Whether the agent allows return calls. |
localizations | object | Localization settings. |
workingHours | object | Working-hours configuration. |
dtmf | boolean | Whether DTMF (keypad) input is enabled. |
transferCallDestinations | array | Call-transfer destinations. |
endOfCallWebhook | string | URL notified when a call ends. |
endOfSessionWebhook | string | URL notified when a session ends. |
callUpdatesWebhook | string | URL notified on call status updates. |
knowledgeBaseFiles | integer[] | IDs of knowledge base files to attach. |
tools | array | Tools/skills available to the agent. See below. |
config | object | Alternative way to send configuration values. See below. |
tools items
| Field | Type | Description |
|---|---|---|
id | integer | ID of an existing tool (omit to create a new one). |
name | string | Tool name. Falls back to content.functionName if omitted. |
type | string | Tool type (e.g. API_CALL). |
description | string | What the tool does. |
variables | array | Input variables for the tool. |
content | object | Tool implementation details (function name, URL, auth, etc.). |
config object
config accepts the same configuration as several top-level fields. You can send values either at the top level or inside config — top-level fields take precedence when both are present. Supported keys:
transcriberLanguage, endOfCallMessage, silenceTimeoutSeconds, maxDurationSeconds, voice, captureDataVariables, endOfCallWebhook, endOfSessionWebhook, callUpdatesWebhook, allowReturnCall, workingHours, dtmf, transferCallDestinations, localizations.
Request example
curl -X POST "https://api.fonema.ai/v1/agents/sales-agent-ab12cd34/publish" \
-H "Authorization: Bearer YOUR_API_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{
"greeting": "Hello! Thanks for calling.",
"config": {
"silenceTimeoutSeconds": 30,
"maxDurationSeconds": 600
}
}'
Response
Returns the full, updated agent — the same structure as Get agent.
Errors
| Status | Description |
|---|---|
400 | Invalid request body. |
403 | Agent not found or not accessible by this API key. |