Update agent
const url = 'https://api.somebodyai.co/api/v1/agents/507f1f77bcf86cd799439011';const options = { method: 'PUT', headers: { 'x-base-revision-id': '665f1f77bcf86cd799439099', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"name":"My Voice Agent","templateId":"gaussian","shareLink":true,"preset":{"id":"customer-support","version":2}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://api.somebodyai.co/api/v1/agents/507f1f77bcf86cd799439011 \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'x-base-revision-id: 665f1f77bcf86cd799439099' \ --data '{ "name": "My Voice Agent", "templateId": "gaussian", "shareLink": true, "preset": { "id": "customer-support", "version": 2 } }'Updates an agent name, template or recorded preset. Every field is optional. Settings are not accepted here — use PATCH /agents/{id}/settings, which merges rather than replacing. Changing the template revalidates the settings the agent already has against it. Send X-Base-Revision-Id to refuse overwriting a name or template someone else changed since that revision.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”MongoDB ObjectId
MongoDB ObjectId
Header Parameters
Section titled “Header Parameters”The revisionId the edit was made against. With it, a value someone else changed since then is not overwritten: the save answers 409 edit_conflict and writes nothing. Without it, the last write wins.
The revisionId the edit was made against. With it, a value someone else changed since then is not overwritten: the save answers 409 edit_conflict and writes nothing. Without it, the last write wins.
Request Body
Section titled “Request Body”object
Anyone with the link can talk to this agent: its ID works on any page with the global player. Defaults to on for an agent created by a signed-in user, off through an API key.
The template's system-prompt preset the agent's prompt was copied from, and that preset's version then. Send it on create when settings holds a preset's prompt, so the dashboard can offer the preset's later versions.
object
Responses
Section titled “Responses”Agent updated
object
Anyone with the link can talk to this agent
object
Values explicitly set on this agent. Never contains template defaults.
object
Settings with the template defaults resolved over it — what the player receives. Read-only: writing this back would persist defaults.
object
The newest revision of the agent: the version token to send as X-Base-Revision-Id on PUT /agents/{id} and PATCH /agents/{id}/settings. null for an agent saved before revisions existed, until its next save.
Example
{ "id": "507f1f77bcf86cd799439011", "name": "My Voice Agent", "templateId": "gaussian", "playerUrl": "https://player.example.com/voice", "moderation": { "status": "active" }, "preset": { "id": "customer-support", "version": 2 }, "settings": { "transportService": "daily", "systemPrompt": "You are a helpful assistant" }, "effectiveSettings": { "transportService": "daily", "llmService": "openai", "systemPrompt": "You are a helpful assistant" }, "revisionId": "665f1f77bcf86cd799439099", "createdAt": "2024-01-15T10:30:00.000Z", "updatedAt": "2024-01-15T10:30:00.000Z"}Bad request - validation failed
object
Example
{ "error": "Resource not found", "details": [ "Field is required" ]}Unauthorized - missing or invalid auth
object
Example
{ "error": "Resource not found", "details": [ "Field is required" ]}The organization's plan does not include this
object
Example
{ "code": "plan_required", "capability": "integrations.shopify", "requiredPlan": "team"}Resource not found
object
Example
{ "error": "Resource not found", "details": [ "Field is required" ]}Someone saved a different value for a path this save writes since X-Base-Revision-Id. Nothing was written.
object
object
A settings param path such as agent.voiceId, or name / templateId on PUT.
The effective value in the base revision; null when that revision has been purged.
The effective value stored now.
The value this save tried to write.
User id behind the newest revision that changed the path since the base (the newest revision when the base was purged); null for a save made with an API key.
The newest revision now, to send as the base when saving again.
Example
{ "error": "Edit conflict", "code": "edit_conflict", "conflicts": [ { "path": "agent.voiceId" } ]}