Create agent
const url = 'https://api.somebodyai.co/api/v1/agents';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"My Voice Agent","templateId":"gaussian","shareLink":true,"settings":{"transportService":"daily","transportApiKey":"507f1f77bcf86cd799439011","systemPrompt":"You are a helpful assistant"},"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 POST \ --url https://api.somebodyai.co/api/v1/agents \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "My Voice Agent", "templateId": "gaussian", "shareLink": true, "settings": { "transportService": "daily", "transportApiKey": "507f1f77bcf86cd799439011", "systemPrompt": "You are a helpful assistant" }, "preset": { "id": "customer-support", "version": 2 } }'Creates a new agent with the specified template and settings. Settings are validated against the template parameters. A roleplay agent created without learning.gradingMode is set to after, grading after the role-play, or to in-call on an Azure credential, where grading needs a deployment first.
Authorizations
Section titled “Authorizations”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.
object
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 created
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"}