API Endpoints Reference
Complete reference for all Public API v1 endpoints. All endpoints require authentication via API key in the X-API-Key header.
Base URL: https://api.agoralia.app/api/v1
Authentication
All endpoints require an API key in the X-API-Key header:
curl -X GET "https://api.agoralia.app/api/v1/me" \
-H "X-API-Key: your-api-key-here"
See Authentication for details on creating and managing API keys.
Tenant Information
GET /me
Get information about your tenant and the scopes of your API key.
Required Scope: me:read
Response:
{
"tenant_id": 1234,
"workspace_name": "My Workspace",
"plan": "pro",
"rate_limits": {
"rpm": 120,
"rpd": 20000
},
"api_key_scopes": ["me:read", "agents:read", "agents:write"]
}
Example:
curl -X GET "https://api.agoralia.app/api/v1/me" \
-H "X-API-Key: your-api-key-here"
Agents
GET /agents
List all agents in your workspace.
Required Scope: agents:read
Query Parameters:
limit(optional, default: 20, max: 100): Number of agents to returncursor(optional): Pagination cursor (agent ID)
Response:
{
"items": [
{
"id": 1,
"name": "Sales Agent",
"lang": "it-IT",
"voice_engine": "vapi"
}
],
"next_cursor": 10
}
Example:
curl -X GET "https://api.agoralia.app/api/v1/agents?limit=50" \
-H "X-API-Key: your-api-key-here"
POST /agents
Create a new agent.
Required Scope: agents:write
Request Body:
{
"name": "Customer Support Agent",
"lang": "en-US",
"voice_engine": "vapi",
"voice_id": "voice-id-here",
"model": "gpt-4o-mini",
"general_tools": [],
"post_call_analysis_data": []
}
Request Fields:
name(required): Agent namelang(optional): Language code (e.g., "en-US", "it-IT")voice_engine(optional, default: "vapi"): Voice engine ("vapi" or "retell")voice_id(optional): Voice ID for the agentmodel(optional, default: "gpt-4o-mini"): LLM model to usegeneral_tools(optional): Array of tool objects for the LLMpost_call_analysis_data(optional): Array of post-call analysis configurations
Response:
{
"id": 15,
"name": "Customer Support Agent",
"lang": "en-US",
"voice_engine": "vapi"
}
Example:
curl -X POST "https://api.agoralia.app/api/v1/agents" \
-H "X-API-Key: your-api-key-here" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: unique-key-123" \
-d '{
"name": "Customer Support Agent",
"lang": "en-US",
"voice_engine": "vapi"
}'
Note:
- This endpoint supports idempotency. Include an
Idempotency-Keyheader to safely retry requests. - Advanced Configuration: This endpoint currently supports basic agent creation. For advanced settings (voice temperature, interruption sensitivity, webhooks, knowledge bases, etc.), use the web interface or check for future API updates.
Campaigns
GET /campaigns
List all campaigns in your workspace.
Required Scope: campaigns:read
Query Parameters:
limit(optional, default: 20, max: 100): Number of campaigns to returncursor(optional): Pagination cursor (campaign ID)
Response:
{
"items": [
{
"id": 1,
"name": "Q1 Sales Campaign",
"status": "active"
}
],
"next_cursor": 10
}
Example:
curl -X GET "https://api.agoralia.app/api/v1/campaigns" \
-H "X-API-Key: your-api-key-here"
POST /campaigns
Create a new campaign.
Required Scope: campaigns:write
Request Body:
{
"name": "Q1 Sales Campaign",
"purpose": "quote_request",
"agent_ref_id": 1,
"from_number_id": 123,
"call_language_mode": "auto",
"output_language": "same_as_call",
"extraction_schema": {
"type": "object",
"properties": {
"quote_amount": {
"type": "number",
"required": true
},
"availability": {
"type": "string",
"enum": ["yes", "no", "unknown"]
}
}
},
"display_columns": ["name", "phone", "quote_amount"],
"schedule": {
"timezone": "Europe/Rome",
"start_date": "2025-01-20T00:00:00Z",
"end_date": "2025-01-31T23:59:59Z"
}
}
Request Fields:
name(required): Campaign namepurpose(required): Campaign purpose -"quote_request","cold_calling","appointment","qualification", or"inbound"agent_ref_id(required): ID of the agent to use (from GET /agents)from_number_id(optional): Phone number ID to use for outbound callscall_language_mode(optional, default: "auto"):"auto"(auto-detect) or"fixed"(use agent language)output_language(optional, default: "same_as_call"):"same_as_call"or BCP-47 code like"en-US","it-IT"extraction_schema(required): JSON Schema defining what to extract from callsdisplay_columns(required): Array of column keys to display in resultsschedule(optional): Object withtimezone,start_date,end_date(ISO 8601 format)
Response:
{
"id": 5,
"name": "Q1 Sales Campaign",
"status": "draft"
}
Example:
curl -X POST "https://api.agoralia.app/api/v1/campaigns" \
-H "X-API-Key: your-api-key-here" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: unique-key-456" \
-d '{
"name": "Q1 Sales Campaign",
"purpose": "quote_request",
"agent_ref_id": 1,
"extraction_schema": {
"type": "object",
"properties": {
"quote_amount": {"type": "number"}
}
},
"display_columns": ["quote_amount"]
}'
Note:
- This endpoint supports idempotency.
- Advanced Configuration: This endpoint currently supports basic campaign creation. For advanced settings (quiet hours, call limits, budget limits, knowledge base assignment, etc.), use the web interface or check for future API updates.
POST /campaigns/{campaign_id}/start
Start a campaign. Returns a proposal ID that requires confirmation (double opt-in pattern).
Required Scope: campaigns:start
Path Parameters:
campaign_id(required): Campaign ID to start
Response:
{
"proposal_id": "pc_abc12345",
"requires_confirmation": true
}
Example:
curl -X POST "https://api.agoralia.app/api/v1/campaigns/5/start" \
-H "X-API-Key: your-api-key-here"
GET /campaigns/{campaign_id}/results
Get results from a campaign.
Required Scope: results:read
Path Parameters:
campaign_id(required): Campaign ID
Response:
{
"display_columns": [
{"name": "name", "label": "Name"},
{"name": "phone", "label": "Phone"},
{"name": "quote_amount", "label": "Quote Amount"}
],
"rows": [
{
"name": "John Doe",
"phone": "+393401234567",
"quote_amount": 1500
}
]
}
Example:
curl -X GET "https://api.agoralia.app/api/v1/campaigns/5/results" \
-H "X-API-Key: your-api-key-here"
Leads
POST /leads:upsert
Create or update leads for a campaign. Uses external_id to determine if a lead already exists.
Required Scope: leads:write
Request Body:
{
"campaign_id": 5,
"items": [
{
"external_id": "lead-123",
"phone": "+393401234567",
"name": "John Doe",
"data": {
"company": "Acme Corp",
"email": "john@acme.com"
}
},
{
"external_id": "lead-124",
"phone": "+393401234568",
"name": "Jane Smith",
"data": {
"company": "Tech Inc",
"email": "jane@tech.com"
}
}
]
}
Response:
{
"created": 1,
"updated": 1,
"failed": 0
}
Example:
curl -X POST "https://api.agoralia.app/api/v1/leads:upsert" \
-H "X-API-Key: your-api-key-here" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: unique-key-789" \
-d '{
"campaign_id": 5,
"items": [
{
"external_id": "lead-123",
"phone": "+393401234567",
"name": "John Doe"
}
]
}'
Note:
- If a lead with the same
external_idexists, it will be updated - If not, a new lead will be created
- This endpoint supports idempotency
Phone Numbers
Note: Phone number management endpoints are currently available only through the web interface. API endpoints for listing, adding, and managing phone numbers will be available in a future release.
To use a phone number in a campaign, you need to:
- Add the phone number via the web interface (Settings → Telephony → Phone Numbers)
- Get the
from_number_idfrom the campaign creation response or web interface - Use that
from_number_idwhen creating campaigns via the API
Calls
GET /calls
List call records.
Required Scope: calls:read
Query Parameters:
campaign_id(optional): Filter by campaign IDlimit(optional, default: 20, max: 100): Number of calls to returncursor(optional): Pagination cursor (call ID)
Response:
{
"items": [
{
"id": 100,
"status": "completed",
"to_number": "+393401234567",
"detected_language": "it-IT"
}
],
"next_cursor": 90
}
Example:
curl -X GET "https://api.agoralia.app/api/v1/calls?campaign_id=5&limit=50" \
-H "X-API-Key: your-api-key-here"
Pagination
Most list endpoints support cursor-based pagination:
- Make initial request without
cursor - If
next_cursoris present in response, use it for the next page - Continue until
next_cursorisnull
Example:
# First page
curl -X GET "https://api.agoralia.app/api/v1/agents?limit=20" \
-H "X-API-Key: your-api-key-here"
# Response: {"items": [...], "next_cursor": 15}
# Next page
curl -X GET "https://api.agoralia.app/api/v1/agents?limit=20&cursor=15" \
-H "X-API-Key: your-api-key-here"
Error Responses
All endpoints return standard HTTP status codes. See Error Handling for details.
Common errors:
401 Unauthorized: Invalid or missing API key403 Forbidden: API key missing required scope404 Not Found: Resource not found422 Validation Error: Invalid request body or parameters
Next Steps
- Authentication - Learn about API keys and scopes
- Idempotency - Ensure safe retries
- Rate Limits - Understand API quotas
- Error Handling - Handle API errors gracefully