Skip to main content

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

ParameterTypeDescription
slugstringUnique 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

FieldTypeDescription
namestringAgent name.
greetingstringOpening message said when the call starts.
promptstringSystem prompt that defines the agent behavior.
textPromptstringPrompt used for text/chat conversations.
farewellstringClosing message said at the end of the call.
voiceIdstringVoice identifier for the agent.
outputVariablesarrayVariables to capture during the call (same shape as in Create agent).
recallLogicobjectRetry/recall configuration.
numberOfAttemptintegerNumber of call attempts.
allowReturnCallbooleanWhether the agent allows return calls.
localizationsobjectLocalization settings.
workingHoursobjectWorking-hours configuration.
dtmfbooleanWhether DTMF (keypad) input is enabled.
transferCallDestinationsarrayCall-transfer destinations.
endOfCallWebhookstringURL notified when a call ends.
endOfSessionWebhookstringURL notified when a session ends.
callUpdatesWebhookstringURL notified on call status updates.
knowledgeBaseFilesinteger[]IDs of knowledge base files to attach.
toolsarrayTools/skills available to the agent. See below.
configobjectAlternative way to send configuration values. See below.

tools items

FieldTypeDescription
idintegerID of an existing tool (omit to create a new one).
namestringTool name. Falls back to content.functionName if omitted.
typestringTool type (e.g. API_CALL).
descriptionstringWhat the tool does.
variablesarrayInput variables for the tool.
contentobjectTool 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 configtop-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

StatusDescription
400Invalid request body.
403Agent not found or not accessible by this API key.