Skip to main content
POST
/
api
/
v1
/
workspaces
/
{workspace_id}
/
agents
/
Create Agent
curl --request POST \
  --url https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/ \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "agent_name": "<string>",
  "provider_name": "<string>",
  "api_key": "<string>",
  "agent_id": "<string>",
  "summary": "<string>",
  "agent_lang": "<string>",
  "call_direction": "inbound",
  "prompt": "<string>",
  "workflow": {},
  "webhook_url": "<string>"
}
'
import requests

url = "https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/"

payload = {
"agent_name": "<string>",
"provider_name": "<string>",
"api_key": "<string>",
"agent_id": "<string>",
"summary": "<string>",
"agent_lang": "<string>",
"call_direction": "inbound",
"prompt": "<string>",
"workflow": {},
"webhook_url": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent_name: '<string>',
provider_name: '<string>',
api_key: '<string>',
agent_id: '<string>',
summary: '<string>',
agent_lang: '<string>',
call_direction: 'inbound',
prompt: '<string>',
workflow: {},
webhook_url: '<string>'
})
};

fetch('https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'agent_name' => '<string>',
'provider_name' => '<string>',
'api_key' => '<string>',
'agent_id' => '<string>',
'summary' => '<string>',
'agent_lang' => '<string>',
'call_direction' => 'inbound',
'prompt' => '<string>',
'workflow' => [

],
'webhook_url' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/"

payload := strings.NewReader("{\n \"agent_name\": \"<string>\",\n \"provider_name\": \"<string>\",\n \"api_key\": \"<string>\",\n \"agent_id\": \"<string>\",\n \"summary\": \"<string>\",\n \"agent_lang\": \"<string>\",\n \"call_direction\": \"inbound\",\n \"prompt\": \"<string>\",\n \"workflow\": {},\n \"webhook_url\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent_name\": \"<string>\",\n \"provider_name\": \"<string>\",\n \"api_key\": \"<string>\",\n \"agent_id\": \"<string>\",\n \"summary\": \"<string>\",\n \"agent_lang\": \"<string>\",\n \"call_direction\": \"inbound\",\n \"prompt\": \"<string>\",\n \"workflow\": {},\n \"webhook_url\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent_name\": \"<string>\",\n \"provider_name\": \"<string>\",\n \"api_key\": \"<string>\",\n \"agent_id\": \"<string>\",\n \"summary\": \"<string>\",\n \"agent_lang\": \"<string>\",\n \"call_direction\": \"inbound\",\n \"prompt\": \"<string>\",\n \"workflow\": {},\n \"webhook_url\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": 123,
  "integration_id": 123,
  "name": "<string>",
  "call_direction": "<string>",
  "remote_identifier": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z",
  "description": "<string>",
  "lang": "<string>",
  "persona": {
    "language": "<string>",
    "accent": "<string>"
  },
  "prompt": "<string>",
  "workflow": {},
  "webhook_url": "<string>",
  "integration_name": "<string>",
  "deleted_at": "2023-11-07T05:31:56Z",
  "created_by": 123,
  "updated_by": 123,
  "integration": {
    "id": 123,
    "uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "workspace_id": 123,
    "provider_id": 123,
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z",
    "api_key": "<string>",
    "deleted_at": "2023-11-07T05:31:56Z",
    "created_by": 123,
    "updated_by": 123,
    "provider": {
      "id": 123,
      "name": "<string>"
    }
  }
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}

Authorizations

Authorization
string
header
required

Use Tuner API key (tr_api_...) or user session token. Find your API key in Workspace Settings > API Keys.

Path Parameters

workspace_id
integer
required

Body

application/json

Request schema for agent creation.

agent_name
string
required

Display name for the agent (e.g., 'Support Bot', 'Sales Agent').

Required string length: 1 - 200
provider_name
string
required

Voice provider this agent is connected to (e.g., 'retell', 'vapi'). Must match a provider name supported by Tuner.

Required string length: 1 - 200
api_key
string
required

API key for authenticating with your voice provider. Find this in your provider's account settings.

Required string length: 1 - 500
agent_id
string
required

Your voice provider's unique identifier for this agent. Find this in your provider's agent configuration.

Required string length: 1 - 36
summary
string | null

Brief description of what this agent does (e.g., 'Handles billing inquiries').

agent_lang
string | null

BCP 47 language tag for the agent's primary language (e.g., 'en', 'es', 'fr'). Defaults to workspace language if omitted.

Maximum string length: 10
call_direction
string
default:inbound

Whether this agent handles 'inbound' (customer-initiated) or 'outbound' (agent-initiated) calls. Defaults to 'inbound'.

Pattern: ^(inbound|outbound)$
prompt
string | null

System prompt or instructions given to the agent.

workflow
Workflow · object | null

Agent workflow configuration as a JSON object (must be JSON-serializable).

webhook_url
string | null

Destination URL for outbound webhook notifications. When set, the agent will POST events to this URL via the webhook delivery queue.

Maximum string length: 2048

Response

Successful Response

Agent schema for API responses with nested relationships.

id
integer
required

Tuner's internal numeric ID for this agent.

integration_id
integer
required

ID of the voice provider integration this agent uses.

name
string
required

Display name of the agent.

call_direction
string
required

'inbound' for customer-initiated calls, 'outbound' for agent-initiated calls.

remote_identifier
string
required

Your voice provider's unique identifier for this agent.

created_at
string<date-time>
required

ISO 8601 timestamp when the agent was created.

updated_at
string<date-time>
required

ISO 8601 timestamp when the agent was last updated.

description
string | null

Brief description of what this agent does.

lang
string | null

BCP 47 language tag for the agent's primary language (e.g., 'en', 'es').

persona
AgentPersona · object | null

Nested language and accent for the agent. Null when the agent has no language configured.

prompt
string | null

System prompt or instructions given to the agent.

workflow
Workflow · object | null

Agent workflow configuration. Must be valid JSON.

webhook_url
string | null

Destination URL for outbound webhook notifications. Null if not configured.

integration_name
string | null

Name of the voice provider for this agent's integration.

deleted_at
string<date-time> | null

Timestamp when the agent was deleted. Null if the agent is active.

created_by
integer | null

ID of the user who created this agent.

updated_by
integer | null

ID of the user who last updated this agent.

integration
IntegrationWithProvider · object | null

Integration schema with nested provider object.