Skip to content

Create agent

POST
/agents
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.

Media typeapplication/json
object
name
required
string
>= 1 characters
templateId
required
string
shareLink

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.

boolean
settings
required
object
key
additional properties
preset

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
id
required
string
>= 1 characters
version
required
integer
> 0

Agent created

Media typeapplication/json
object
id
required
string
name
required
string
templateId
required
string
playerUrl
required
string
shareLink
required

Anyone with the link can talk to this agent

boolean
moderation
required
object
status
required
string
Allowed values: active under_review suspended removed
notice
required
string | null
updatedAt
required
string | null
preset
Any of:

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
id
required
string
>= 1 characters
version
required
integer
> 0
settings
required

Values explicitly set on this agent. Never contains template defaults.

object
key
additional properties
effectiveSettings
required

Settings with the template defaults resolved over it — what the player receives. Read-only: writing this back would persist defaults.

object
key
additional properties
revisionId
required

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.

string | null
createdAt
required
string format: date-time
updatedAt
required
string format: date-time
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

Media typeapplication/json
object
error
required
string
details
Array<string>
Example
{
"error": "Resource not found",
"details": [
"Field is required"
]
}

Unauthorized - missing or invalid auth

Media typeapplication/json
object
error
required
string
details
Array<string>
Example
{
"error": "Resource not found",
"details": [
"Field is required"
]
}

The organization's plan does not include this

Media typeapplication/json
object
error
required
string
code
required
string
Allowed values: plan_required
capability
required
string
requiredPlan
required
string | null
Example
{
"code": "plan_required",
"capability": "integrations.shopify",
"requiredPlan": "team"
}