Skip to main content
The create agent endpoint provisions a new voice agent and returns its agent_id. You pass the agent ID to start conversations, assign phone numbers, or launch batch calls.

Endpoint

POST https://api.xuna.ai/v1/convai/agents

Request parameters

name
string
required
A human-readable label for the agent. Shown in the dashboard and in list responses.
tags
string[]
Optional tags for organising agents. Useful for filtering in the dashboard.
conversation_config
object
Agent behaviour and voice settings.

Example request

from xuna_ai.client import XunaAI

client = XunaAI(api_key="YOUR_API_KEY")

response = client.conversational_ai.agents.create(
    name="My voice agent",
    tags=["test"],
    conversation_config={
        "tts": {
            "voice_id": "aMSt68OGf4xUZAnLpTU8",
            "model_id": "eleven_flash_v2",
        },
        "agent": {
            "first_message": "Hi, how can I help you today?",
            "prompt": {
                "prompt": "You are a helpful assistant.",
            },
        },
    },
)

print("Agent ID:", response.agent_id)

Response

{
  "agent_id": "agent_7101k5zvyjhmfg983brhmhkd98n6"
}
agent_id
string
required
The unique identifier for the newly created agent. Store this value — you need it to start conversations, update the agent, or assign a phone number.
After creating an agent you can update any part of its configuration at any time using the PATCH endpoint.