Create a new agent with complete configuration including voice settings, language, models, tools, and more.
curl -X POST "https://api.zudu.ai/api/agents/create" \
-H "X-API-KEY: sk_Abc123Def456Ghi789Jkl012Mno345Pqr678Stu901Vwx234Yz" \
-H "X-API-SECRET: s3cr3t_Xyz789Abc123Def456Ghi789Jkl012Mno345Pqr678Stu901Vwx234" \
-d '{
"agent_name": "Customer Support Agent",
"language": "en",
"voice": {
"provider": "openai",
"voice_id": "alloy"
},
"first_message": "Hello! How can I help you today?",
"model": "gpt-4",
"transcription_model": "whisper-1"
}'
{
"message": "Agent created successfully",
"status": "success",
"error": null,
"data": {
"agent_id": "agent_abc123def456...",
"agent_name": "Customer Support Agent",
"organization_id": "org_1234567890",
"language": "en",
"voice": {
"provider": "openai",
"voice_id": "alloy"
},
"first_message": "Hello! How can I help you today?",
"model": "gpt-4",
"transcription_model": "whisper-1",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
Your API key (format: sk_...)
Your API secret (format: s3cr3t_...)
Request Body
The name of the agent
- Maximum length: 50 characters
- Cannot be empty or whitespace only
- Will be trimmed automatically
Example: "Customer Support Agent"
Language code for the agent (ISO 639-1)Examples: en, es, fr, de, jaExample: "en"
Voice configuration for the agent
provider: Voice provider (e.g., openai, elevenlabs, playht)
voice_id: Specific voice ID from the provider
Example:{
"provider": "openai",
"voice_id": "alloy"
}
The initial message the agent will say when a call startsExample: "Hello! How can I help you today?"
LLM model to use (e.g., gpt-4, gpt-3.5-turbo)If not provided, will be auto-selected based on language configuration
Transcription model to use (e.g., whisper-1)If not provided, will be auto-selected based on language configuration
Array of knowledge base IDs to attach to the agent for RAG (Retrieval-Augmented Generation)Example: ["kb_123", "kb_456"]
RAG configuration for knowledge base retrieval
chunks_to_retrieve: Number of chunks to retrieve (default: 10)
similarity_threshold: Similarity threshold for retrieval (default: 0.2)
Example:{
"chunks_to_retrieve": 10,
"similarity_threshold": 0.2
}
Widget configuration for the agentIf not provided, default widget config will be initialized
Response Fields
The unique identifier for the newly created agent
The organization ID the agent belongs to
ISO 8601 timestamp when the agent was created
ISO 8601 timestamp when the agent was last updated
Error Responses
Bad Request - Validation error or invalid agent data{
"message": "Validation error",
"status": "error",
"error": "Agent name cannot be empty"
}
Unauthorized - Missing or invalid API key/secret
Internal Server Error - Failed to create agent{
"message": "Failed to create agent",
"status": "error",
"error": "Database connection failed"
}
Notes
- The agent will be automatically assigned to your organization based on the API key (organization ID is automatically extracted)
- Models will be auto-selected based on language if not explicitly provided
- Default RAG config will be initialized if knowledge bases are provided but RAG config is not
- Default widget config will be initialized if not provided
- The response returns a frontend-safe version of the agent data (hides internal model/provider details)