curl --location --request PATCH 'https://api.weya.live/backend/api/agents/687b1c2ab7c7d3f123456789' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"agent_name": "Updated Sales Agent",
"systemMessage": "You are a friendly sales assistant calling {customer_name}.",
"startMessage": "Hello {customer_name}! How can I help you today?"
}'
{
"status": true,
"code": 200,
"message": "Agent updated successfully",
"errorMessage": null,
"data": {
"_id": "687b1c2ab7c7d3f123456789",
"agent_name": "Updated Sales Agent",
"systemMessage": "You are a friendly sales assistant calling {customer_name}.",
"startMessage": "Hello {customer_name}! How can I help you today?",
"latest_version": 4
}
}
Agents
Update Agent
Update the configuration of one of your AI agents.
PATCH
/
api
/
agents
/
{id}
curl --location --request PATCH 'https://api.weya.live/backend/api/agents/687b1c2ab7c7d3f123456789' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"agent_name": "Updated Sales Agent",
"systemMessage": "You are a friendly sales assistant calling {customer_name}.",
"startMessage": "Hello {customer_name}! How can I help you today?"
}'
{
"status": true,
"code": 200,
"message": "Agent updated successfully",
"errorMessage": null,
"data": {
"_id": "687b1c2ab7c7d3f123456789",
"agent_name": "Updated Sales Agent",
"systemMessage": "You are a friendly sales assistant calling {customer_name}.",
"startMessage": "Hello {customer_name}! How can I help you today?",
"latest_version": 4
}
}
Overview
Update an agent created by the user who owns the API key. Send only the fields you want to change; fields you leave out keep their values. Nested objects such ascallSetting are merged, not replaced.
Each update is saved as a new agent version. Phone numbers that follow the agent’s latest version use the change on their next call; numbers pinned to an older version don’t.
Prerequisites
- An API key for your workspace
- The agent’s ID, from Get Agents
Request
curl --location --request PATCH 'https://api.weya.live/backend/api/agents/687b1c2ab7c7d3f123456789' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"agent_name": "Updated Sales Agent",
"systemMessage": "You are a friendly sales assistant calling {customer_name}.",
"startMessage": "Hello {customer_name}! How can I help you today?"
}'
Request Parameters
You can send any field described in Create Agent, for example:| Field | Description |
|---|---|
agent_name | Name of the agent |
systemMessage | The agent’s instructions. Checked for valid [condition] / [variations] syntax |
startMessage | First thing the agent says |
voice | Voice ID |
selectedLanguage | Language codes |
knowledgeBase | Knowledge base IDs |
gender | Male or Female |
Response
{
"status": true,
"code": 200,
"message": "Agent updated successfully",
"errorMessage": null,
"data": {
"_id": "687b1c2ab7c7d3f123456789",
"agent_name": "Updated Sales Agent",
"systemMessage": "You are a friendly sales assistant calling {customer_name}.",
"startMessage": "Hello {customer_name}! How can I help you today?",
"latest_version": 4
}
}
Error Handling
Errors returnstatus: false, with the reason in errorMessage.
- 400 Bad Request – A field has an invalid value,
Invalid system message syntax — …, oridisn’t a valid ID. - 401 Unauthorized – Missing or invalid API key.
- 404 Not Found –
Agent not found: the agent doesn’t exist or wasn’t created by the user who owns the API key. - 500 Internal Server Error – Unexpected server error.
Was this page helpful?

