# Get Call Details Source: https://docs.vaanivoice.ai/api-reference/call-details GET /api/call_details/{call_id} Get detailed call information including transcript, entities, and evaluation ## Get Call Details Get detailed call information including transcript, extracted entities, conversation evaluation, and AI-generated summary. The `user_id` and `client_name` are automatically resolved from your API key - you only need to provide the `call_id`. ## Parameters **call\_id** `string` *required* The unique call ID (e.g., `outbound-1776774443-863aa698`) ## Request Example ```bash cURL theme={null} # CALL_ID=your_call_id # API_KEY=your_api_key curl -H "X-API-Key:$API_KEY" "https://api.vaanivoice.ai/api/call_details/$CALL_ID" ``` ```javascript JavaScript theme={null} const CALL_ID = "outbound-1776774443-863aa698"; const API_KEY = "your_api_key"; const response = await fetch( `https://api.vaanivoice.ai/api/call_details/${CALL_ID}`, { method: "GET", headers: { "X-API-Key": API_KEY, }, } ); const data = await response.json(); console.log(data); ``` ```python Python theme={null} import requests CALL_ID = "outbound-1776774443-863aa698" API_KEY = "your_api_key" headers = { "X-API-Key": API_KEY } response = requests.get( f"https://api.vaanivoice.ai/api/call_details/{CALL_ID}", headers=headers ) print(response.json()) ``` ## Response ### Success Response (200) ```json theme={null} { "transcription": "AGENT: Hi! You've reached our customer service. I am your assistant, how can I help you today?\n\n USER: Hello. What are you offering?\n\n AGENT: Namaste! We provide a platform where you can start any business...", "entity": { "Call_back": "No", "Callback_time": null, "issue_raised_unresolved_bool": "NO", "issue_type_extraction": "N/A" }, "conversation_eval": {}, "summary": "The agent opened the call with a friendly greeting and introduced themselves as the customer's assistant. The customer asked what was being offered. The agent explained the platform's business services.", "call_eval_tag": "not enough data" } ``` **transcription** `string` Full conversation transcript with speaker labels (`AGENT:` / `USER:`) **entity** `object` Extracted entities from the call **Entity Properties** The fields vary based on your agent's configuration. Common fields include: **Call\_back** `string` Whether a callback was requested - `"Yes"` or `"No"` **Callback\_time** `string | null` Requested callback time, or `null` if none **issue\_raised\_unresolved\_bool** `string` Whether an unresolved issue was raised - `"YES"` or `"NO"` **issue\_type\_extraction** `string` Type of issue extracted, or `"N/A"` **conversation\_eval** `object` Conversation evaluation metrics (structure varies by agent configuration) **summary** `string` AI-generated summary of the call conversation **call\_eval\_tag** `string | null` Evaluation tag assigned to the call (e.g., `"vkyc_completed_already"`, `"not enough data"`) ### Not Yet Processed If the call has not been post-processed yet, the response fields will indicate unavailability: ```json theme={null} { "transcription": "Transcript is not available for further evaluations.", "entity": "Transcript is not available for further evaluations.", "conversation_eval": "Transcript is not available for further evaluations.", "summary": "Transcript is not available for further evaluations.", "call_eval_tag": null } ``` ### Validation Error (422) ```json theme={null} { "detail": [ { "loc": ["path", "call_id"], "msg": "field required", "type": "value_error.missing" } ] } ``` # Get Call History Source: https://docs.vaanivoice.ai/api-reference/call-history GET /api/call-history Get call history for a client ## Get Call History Get call history for a client. Shows all calls for the client if the user belongs to that client. ## Parameters * **Query** * `page` (integer, optional, default: `1`): Page number (1-indexed) * `page_size` (integer, optional, default: `50`, max: `200`): Number of records per page ## Request Example ```bash cURL theme={null} # API_KEY=your_api_key curl -H "X-API-Key:$API_KEY" "https://api.vaanivoice.ai/api/call-history?page=1&page_size=50" ``` ```javascript JavaScript theme={null} // const API_KEY = "your_api_key"; const response = await fetch( "https://api.vaanivoice.ai/api/call-history?page=1&page_size=50", { method: "GET", headers: { "X-API-Key": API_KEY, }, } ); const data = await response.json(); console.log(data); ``` ```python Python theme={null} # API_KEY = "your_api_key" import requests headers = { "X-API-Key": API_KEY, } response = requests.get( "https://api.vaanivoice.ai/api/call-history", headers=headers, params={"page": 1, "page_size": 50}, ) print(response.json()) ``` ## Response ### Success Response (200) ```json theme={null} { "data": [ { "call_id": "outbound-1776774443-863aa698", "call_type": "Outbound", "call_status": "User disconnected", "direction": "Outbound", "agent_name": "vaani321talha", "agent_id": "7ec4155e-0e62-440a-b983-5974f7697854", "client_name": "vaani321", "client_id": "9abf5eff-e978-4e87-954d-7ff6ba570796", "from_number": "+918037565218", "to_number": "+917893209830", "Start_time": "2026-04-21T12:27:23.335803", "End_time": "2026-04-21T12:27:57.453173", "duration_ms": 742.269, "call_cost": 2.3, "call_summary": "The agent opened the call with a friendly greeting...", "call_entity": {}, "call_eval_tag": "not enough data", "call_conversation_quality": {}, "post_processing_status": "completed", "call_dialing_at": "2026-04-21T12:27:41.474651", "call_ringing_at": "2026-04-21T12:27:43.395994", "user_picked_up_at": "2026-04-21T12:27:53.431057", "recording_api": "https://api.vaanivoice.ai/api/stream/outbound-1776774443-863aa698", "call_transcription": "https://api.vaanivoice.ai/api/transcript/outbound-1776774443-863aa698", "call_metadata": { "name": "John", "phone": "+917893209830", "agent_name": "vaani321talha", "agent_id": "7ec4155e-0e62-440a-b983-5974f7697854", "client_id": "9abf5eff-e978-4e87-954d-7ff6ba570796" }, "chat_history": [], "callback_requested": false, "callback_id": null, "callback_status": null } ], "pagination": { "page": 1, "page_size": 50, "total_count": 1028, "total_pages": 21, "has_next": true, "has_previous": false } } ``` **data** `array` Array of call objects **Call Object Properties** **call\_id** `string` Unique call identifier (e.g., `outbound-1776774443-863aa698`) **call\_type** `string` Type of call - `Outbound` or `Inbound` **call\_status** `string` Final call status (e.g., `User disconnected`, `completed`, `error`) **direction** `string` Call direction - `Outbound` or `Incoming` **agent\_name** `string` Name of the agent that handled the call **agent\_id** `string` UUID of the agent **from\_number** `string` Caller number (E.164 format) **to\_number** `string` Destination number (E.164 format) **Start\_time** `string` Call start timestamp (ISO 8601) **End\_time** `string` Call end timestamp (ISO 8601) **duration\_ms** `number` Call duration in milliseconds **call\_cost** `number` Call cost in credits **call\_summary** `string | null` AI-generated summary of the call **call\_eval\_tag** `string | null` Evaluation tag assigned to the call **post\_processing\_status** `string` Post-processing status - `completed`, `not_processed`, or `processing` **recording\_api** `string` URL to stream the call recording **call\_transcription** `string` URL to fetch the call transcript **call\_metadata** `object` Metadata passed when triggering the call **chat\_history** `array` Structured chat history of the call **callback\_requested** `boolean` Whether a callback was requested during the call **pagination** `object` Pagination metadata **Pagination Properties** **page** `integer` Current page number **page\_size** `integer` Number of records per page **total\_count** `integer` Total number of records **total\_pages** `integer` Total number of pages **has\_next** `boolean` Whether there is a next page **has\_previous** `boolean` Whether there is a previous page ### Validation Error (422) ```json theme={null} { "detail": [ { "loc": ["query", "page"], "msg": "value is not a valid integer", "type": "type_error.integer" } ] } ``` # Cancel Campaign Source: https://docs.vaanivoice.ai/api-reference/campaigns/cancel POST /api/campaigns/{campaign_id}/cancel Immediately cancel a campaign (hard stop) ## Cancel Campaign Immediately terminate a campaign. Ongoing calls are completed, but no new calls are initiated. *** ## Path Parameters **campaign\_id** `string` *required* UUID of the campaign to cancel *** ## Example Request ```bash theme={null} curl -X POST "https://api.vaanivoice.ai/api/campaigns/abc-123-xyz/cancel" \ -H "X-API-Key: vaani_abc123..." ``` *** ## Response `200 OK` ```json theme={null} { "id": "e8632ffe-ce38-4ae9-8185-72ef708aaa51", "client_id": "e3e5b338-937e-4672-a700-1a1f5817a385", "agent_id": "26356732-d0f3-449a-9fe7-6339ae157687", "campaign_name": "campaing api ", "excel_blob_url": "https://vaani-uat-storage.s3.ap-south-1.amazonaws.com/campaigns/e3e5b338-937e-4672-a700-1a1f5817a385/d3c4c1dd-e52d-4b4e-92d1-fccf63b55dad_Untitled spreadsheet - Sheet1 (2) (1).csv", "results_excel_blob_url": null, "last_result_generated_at": null, "campaign_status": "cancelled", "contact_source_type": "csv", "gsheet_config": null, "days_of_week": "tuesday", "post_processing_status": "pending_excel", "time_range_from": "08:30:00Z", "time_range_to": "14:29:00Z", "max_retries": 1, "retry_after_mins": 5, "call_concurrency": 1, "start_date": "2026-08-25T08:30:00", "end_date": "2026-08-25T10:33:52.232273", "created_at": "2026-08-25T10:26:31.403625", "updated_at": "2026-08-25T10:33:52.232273", "notification_emails": null, "webhook_url": null, "per_call_webhook_url": null, "webhook_id": null, "perform_dnd_check": false } ``` *** ## Behavior * Immediately stops initiating new calls * Ongoing calls complete normally * Status transitions to `cancelled` * **Cannot be resumed after cancellation** *** ## Comparison: Stop vs Cancel | Action | Timing | Can Resume? | Use Case | | - | - | - | - | | **Stop** | End of day | ❌ No | Graceful completion | | **Cancel** | Immediate | ❌ No | Emergency termination | | **Pause** | Immediate | ✅ Yes | Temporary suspension | > [!WARNING] > > Cancellation is permanent. Use `/pause` if you need to temporarily suspend the campaign. # Create Campaign Source: https://docs.vaanivoice.ai/api-reference/campaigns/create POST /api/campaigns/create Create a new outbound calling campaign with CSV contacts ## Create Campaign Create a new outbound calling campaign by uploading a CSV file with contacts and configuring campaign parameters. This is a **multipart/form-data** endpoint - send the CSV file and all configuration fields together in a single request. *** ## Request Parameters **csv\_file** `file` *required* CSV file with contact data. Required columns: `name`, `phone_number` **campaign\_name** `string` *required* Human-readable name for the campaign (max 255 characters) **agent\_id** `string` *required* UUID of the agent that will handle calls **concurrency** `integer` *required* Simultaneous calls (≥ 1, ≤ organization max) **from\_date** `string` *required* Campaign start date - `YYYY-MM-DD` **to\_date** `string` *required* Campaign end date - `YYYY-MM-DD` (≥ `from_date`) **start\_time** `string` *required* Daily call window open - UTC `HH:MM` 24-hour format (e.g. `02:30`) **end\_time** `string` *required* Daily call window close - UTC `HH:MM` 24-hour format (e.g. `14:00`) **days\_of\_week** `string` *required* Comma-separated weekdays, e.g. `monday,tuesday,friday` **perform\_dnd\_check** `boolean` (default: false) Run DND check on contacts before dialing **max\_retries** `integer` (default: 3) Max dial attempts per contact (1–10) **retry\_delay\_mins** `integer` (default: 30) Minutes between retry attempts (0–1440) **notification\_emails** `string` Comma-separated email addresses for completion notifications (max 5) **campaign\_webhook\_url** `string` HTTP/HTTPS URL to receive campaign status-change events **per\_call\_webhook\_url** `string` HTTP/HTTPS URL to receive per-call post-processing events *** ## Time Window Reference All times must be in **24-hour HH:MM format in UTC only**. | Allowed UTC range | Equivalent IST range | | - | - | | `02:30` – `14:29` | `08:00` – `19:59` | > TRAI compliance window is 08:00–19:59 IST. Submit the UTC equivalent.\ > To convert: IST − 5:30 = UTC (e.g. 13:00 IST = 07:30 UTC) *** ## Example Request ```bash theme={null} curl -X POST https://api.vaanivoice.ai/api/campaigns/create \ -H "X-API-Key: vaani_abc123..." \ -F "csv_file=@contacts.csv" \ -F "campaign_name=Summer Promo 2024" \ -F "agent_id=5e737076-fea2-4157-8343-a8e49e5f0990" \ -F "concurrency=3" \ -F "from_date=2026-07-10" \ -F "to_date=2026-07-31" \ -F "start_time=07:30" \ -F "end_time=13:30" \ -F "days_of_week=monday,tuesday,wednesday,thursday,friday" \ -F "notification_emails=ops@company.com" ``` *** ## Response `201 Created` ```json theme={null} { "id": "57fbcf93-a809-4038-8ea9-d676cf7d7fd4", "client_id": "1b9e0250-d265-4a67-bb03-c40c98978c76", "agent_id": "5e737076-fea2-4157-8343-a8e49e5f0990", "campaign_name": "Summer Promo 2024", "excel_blob_url": "https://vaani-dev-storage.s3.ap-south-1.amazonaws.com/campaigns/...", "campaign_status": "active", "contact_source_type": "csv", "days_of_week": "monday,tuesday,wednesday,thursday,friday", "time_range_from": "07:30:00Z", "time_range_to": "13:30:00Z", "max_retries": 3, "retry_after_mins": 30, "call_concurrency": 3, "start_date": "2026-07-10T02:00:00", "end_date": "2026-07-31T04:00:00", "notification_emails": ["ops@company.com"], "webhook_url": null, "perform_dnd_check": false, "created_at": "2026-07-01T08:59:33.063483", "updated_at": "2026-07-01T08:59:33.063487" } ``` *** ## CSV File Requirements ### Required Columns | Column | Aliases accepted | | - | - | | `name` | `contact_name`, `customer_name`, `full_name` | | `phone_number` | `phone`, `mobile`, `contact`, `contact_number`, `mobile_number` | ### Optional Columns Any extra columns are treated as **dynamic variables** passed to the agent. Column names must exactly match (case-sensitive) the variable names configured on the agent. ### File Limits | Property | Limit | | - | - | | Formats | `.csv`, `.xlsx`, `.xls` | | Encoding | UTF-8 | | Max rows | 10,000 contacts | | Min rows | 1 contact | ### Phone Number Formats Accepted * `+91XXXXXXXXXX` (E.164 with country code) * `91XXXXXXXXXX` (country code without `+`) * `0XXXXXXXXXX` (leading zero, Indian trunk prefix) * `XXXXXXXXXX` (bare 10-digit number) *** ## Error Responses **status\_code** `number` HTTP status code **error** `string` Error name **message** `string` Human-readable error message **code** `string` Machine-readable error code ### Common Error Codes | Code | Description | | - | - | | `INVALID_TIME_WINDOW` | Time outside 02:30-14:29 UTC (TRAI compliance) | | `CONCURRENCY_EXCEEDED` | Concurrency exceeds organization maximum | | `INVALID_DATE_RANGE` | from\_date > to\_date | | `NO_DAYS_SELECTED` | days\_of\_week is empty | | `INVALID_RETRY_CONFIG` | max\_retries or retry\_delay\_mins out of range | | `TOO_MANY_EMAILS` | More than 5 notification\_emails | ### Example Error Response ```json theme={null} { "status_code": 400, "error": "Bad Request", "message": "concurrency 50 exceeds your organisation's maximum of 10.", "code": "CONCURRENCY_EXCEEDED", "path": "/api/campaigns/create", "timestamp": "2026-07-01T08:51:11.245139Z", "request_id": "unknown" } ``` # Get Campaign Results Source: https://docs.vaanivoice.ai/api-reference/campaigns/get-results GET /api/campaigns/{campaign_id}/results Get pre-signed download URL for campaign results CSV ## Get Campaign Results Return a pre-signed download URL for the campaign results file. Available only after post-processing completes. *** ## Path Parameters **campaign\_id** `string` *required* UUID of the campaign *** ## Example Request ```bash theme={null} curl "https://api.vaanivoice.ai/api/campaigns/abc-123-xyz/results" \ -H "X-API-Key: vaani_abc123..." ``` *** ## Response `200 OK` ```json theme={null} { "success": true, "download_url": "https://vaani-uat-storage.s3.amazonaws.com/campaigns/ebf4700b-603f-47d4-8e3a-d27b2a85a921/7bf64a21-27ca-40a8-aea9-89d56e08ccd9/test_camp_2026-08-25.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&..." } ``` *** ## Response Fields **success** `boolean` Whether the results URL was successfully generated **download\_url** `string` Pre-signed S3 URL for downloading the results CSV *** ## Results CSV Format The results CSV contains all campaign contacts with call outcomes: | Column | Description | | - | - | | `name` | Contact name | | `phone_number` | Contact phone number | | `call_status` | `completed`, `failed`, `no_answer`, `busy`, `cancelled` | | `call_duration` | Call duration in seconds | | `call_transcript` | Full conversation transcript | | `call_summary` | AI-generated call summary | | `call_tags` | Comma-separated outcome tags | | `attempts` | Number of dial attempts | | `last_attempt_at` | Timestamp of last attempt | *** ## Error Response `404 Not Found` ```json theme={null} { "status_code": 404, "error": "Not Found", "message": "Campaign results not yet available. Post-processing status: processing", "code": "RESULTS_NOT_READY" } ``` # Get Campaign Status Source: https://docs.vaanivoice.ai/api-reference/campaigns/get-status GET /api/campaigns/{campaign_id}/status Get current status and progress for a campaign ## Get Campaign Status Return the current status and progress counters for a campaign. *** ## Path Parameters **campaign\_id** `string` *required* UUID of the campaign *** ## Example Request ```bash theme={null} curl "https://api.vaanivoice.ai/api/campaigns/abc-123-xyz/status" \ -H "X-API-Key: vaani_abc123..." ``` *** ## Response `200 OK` ```json theme={null} { "id": "e8632ffe-ce38-4ae9-8185-72ef708aaa51", "campaign_name": "campaing api ", "client_id": "e3e5b338-937e-4672-a700-1a1f5817a385", "client_name": "Nitish Mishra", "agent_name": "nitishmishraragcheck-21-08", "agent_display_name": "rag check - 21-08", "agent_disposition": { "enabled": true, "prompt_based": [ { "name": "Final Outcome", "type": "string", "prompt": "Evaluate the complete call transcript to determine the final resolution state based on the agent's Call Flow and Guardrails. Assign the single most accurate outcome that reflects how the call ended.", "list_of_tags": { "Successfully Resolved - Status Provided": "The user authenticated (via ID or Smart Fallback), received their status/delivery date in Step 3, agreed to the timing (Step 4, Path A), and the call concluded gracefully without requiring a ticket.", "Escalated - Modification or Delay": "The user requested changes to the order, asked for a refund, or expressed dissatisfaction with a delay (Step 4, Path B), resulting in the agent verbally simulating a priority ticket for a senior specialist callback.", "Escalated - Delivery Dispute": "The user claimed the package was marked delivered but not received, or demanded an urgent expedite for a gift, triggering an investigation ticket via the Objection Handling pivots.", "Escalated - Authentication Failure": "The user provided the wrong Order ID, rejected the Smart Fallback suggestion, and the agent logged a ticket for a callback to locate the correct account.", "Dropped - User Busy / Refused": "In Step 1, the user indicated they were busy, confused, or answered \"No\" to continuing the call, and the agent ended the call.", "Dropped - Connection / Dead Air": "The call was terminated by the agent due to prolonged user silence or consistently garbled audio/ASR failure that could not be recovered.", "Dropped - Hostile Caller": "The user became excessively angry or abusive, prompting the agent to trigger the Hostile/Angry guardrail, promise a logistics manager escalation, and immediately end the call.\n\n\n\n\nDefault End Conversation Phrase \n\n\nThanks so much for reaching out, really appreciate it. Have a great rest of your day!\n\n\n\n\nDescription:\n\nSanjay is an Order Support Assistant designed to sound warm, empathetic, and professionally casual. The objective is to assist inbound e-commerce customers with order status inquiries by securely verifying details, providing delivery updates, and escalating complex requests." } } ] }, "agent_data_collection": { "enabled": true, "data_points": [ { "name": "Caller Intent", "prompt": "Analyze the user's statements in Step 1 and throughout the call to determine their primary reason for engaging with the agent. Output ONLY the exact value.", "nullable": false, "choices": [ "Status Check", "Order Modification", "Refund Request", "Lost/Missing Package", "Expedite Request", "Other" ] }, { "name": "Spoken Order ID", "prompt": "Extract the exact alphanumeric Order ID spoken by the customer during Step 2 of the flow. Output ONLY the exact alphanumeric string without conversational filler. If they did not provide one, output null.", "nullable": true, "choices": null }, { "name": "Authentication Path", "prompt": "Identify how the agent successfully authenticated or attempted to authenticate the user's order in Step 2. Output ONLY the exact value.", "nullable": false, "choices": [ "ID Match", "Smart Fallback Accepted", "Authentication Failed" ] }, { "name": "Delivery Window Acceptance", "prompt": "Evaluate the user's response in Step 3 when presented with the delivery date/timing. Did the timing work for them? Output ONLY the exact value.", "nullable": true, "choices": [ "Accepted", "Rejected/Needs Change" ] }, { "name": "Escalation Reason", "prompt": "If the agent verbally simulated logging a ticket for a callback, extract the core reason requested by the user (e.g., address change, gift urgency, marked delivered but missing). Output a concise 2-4 word summary.", "nullable": true, "choices": null }, { "name": "Confirmed Callback Number", "prompt": "If the Smart Fallback failed or a ticket was generated, and the agent asked if the current number was the best way to reach them, extract the phone number if spoken, or output \"Caller ID Confirmed\" if they simply agreed. Output ONLY the exact value.", "nullable": true, "choices": null }, { "name": "Customer Sentiment", "prompt": "Analyze the customer's tone, pacing, and word choice throughout the transcript to determine their overall emotional state. Output ONLY the exact value.", "nullable": false, "choices": [ "Positive", "Neutral", "Frustrated", "Hostile" ] } ] }, "agent_outbound_numbers": [ "+918065481305" ], "excel_blob_url": "https://vaani-uat-storage.s3.ap-south-1.amazonaws.com/campaigns/e3e5b338-937e-4672-a700-1a1f5817a385/d3c4c1dd-e52d-4b4e-92d1-fccf63b55dad_Untitled spreadsheet - Sheet1 (2) (1).csv", "results_excel_blob_url": null, "last_result_generated_at": null, "campaign_status": "active", "contact_source_type": "csv", "gsheet_config": null, "days_of_week": "tuesday", "post_processing_status": "not_processed", "time_range_from": "08:30:00Z", "time_range_to": "14:29:00Z", "max_retries": 1, "retry_after_mins": 5, "call_concurrency": 1, "start_date": "2026-08-25T08:30:00", "end_date": "2026-08-26T14:29:00", "campaign_statistics": { "total_calls": 1, "total_ceiled_call_duration_seconds": 9, "total_ceiled_call_duration_minutes": 1, "call_eval_tag_counts": {}, "source": "calls.campaign_id", "computed_at": "2026-08-25T10:27:42.949087" }, "created_at": "2026-08-25T10:26:31.403625", "updated_at": "2026-08-25T10:26:31.403634", "stats": { "total_calls": 2, "completed": 0, "pending": 1, "in_progress": 1, "failed": 0 }, "notification_emails": null, "webhook_url": null, "per_call_webhook_url": null, "webhook_id": null, "perform_dnd_check": false, "orchestrator": "python" } ``` *** ## Response Fields **campaign\_status** `string` Current status: `scheduled`, `active`, `paused`, `paused_out_of_range`, `completed`, `cancelled` **time\_range\_from** `string` Daily calling window start time (UTC with Z suffix) **time\_range\_to** `string` Daily calling window end time (UTC with Z suffix) **stats** `object` Real-time call statistics for the campaign # List Campaigns Source: https://docs.vaanivoice.ai/api-reference/campaigns/list GET /api/campaigns/ Get a paginated list of campaigns for your organization ## List Campaigns Return a paginated list of campaigns for the authenticated organization. *** ## Query Parameters **page** `integer` (default: 1) Page number (1-indexed) **page\_size** `integer` (default: 20) Items per page (max 100) **status** `string` Filter by status: `active`, `paused`, `completed`, `cancelled`, `scheduled` *** ## Example Request ```bash theme={null} curl "https://api.vaanivoice.ai/api/campaigns/?page=1&page_size=20&status=active" \ -H "X-API-Key: vaani_abc123..." ``` *** ## Response `200 OK` ```json theme={null} [ { "id": "7817f2fd-3380-450e-80ac-8e5249633312", "campaign_created_at": "2026-08-25T10:40:26.128721", "agent_display_name": "rag check - 21-08", "agent_id": "26356732-d0f3-449a-9fe7-6339ae157687", "client_id": "e3e5b338-937e-4672-a700-1a1f5817a385", "campaign_name": "update name", "agent_name": "nitishmishraragcheck-21-08", "client_name": "Nitish Mishra", "campaign_started_at": "2026-08-25T04:30:00", "campaign_ended_at": "2026-08-26T12:30:00", "total_calls_dialed": 1, "total_calls_completed": 0, "total_calls_in_campaign": 2, "stats": { "total_calls": 2, "completed": 0, "pending": 1, "in_progress": 1, "failed": 0 }, "campaign_status": "active", "contact_source_type": "csv" }, { "id": "1814385d-6a49-470c-817f-5f3ec95cc0be", "campaign_created_at": "2026-08-25T10:38:04.416156", "agent_display_name": "rag check - 21-08", "agent_id": "26356732-d0f3-449a-9fe7-6339ae157687", "client_id": "e3e5b338-937e-4672-a700-1a1f5817a385", "campaign_name": "Webhook Test Campaign new", "agent_name": "nitishmishraragcheck-21-08", "client_name": "Nitish Mishra", "campaign_started_at": "2026-08-25T04:30:00", "campaign_ended_at": "2026-08-26T12:30:00", "total_calls_dialed": 1, "total_calls_completed": 0, "total_calls_in_campaign": 2, "stats": { "total_calls": 2, "completed": 0, "pending": 1, "in_progress": 1, "failed": 0 }, "campaign_status": "active", "contact_source_type": "csv" }, { "id": "e8632ffe-ce38-4ae9-8185-72ef708aaa51", "campaign_created_at": "2026-08-25T10:26:31.403625", "agent_display_name": "rag check - 21-08", "agent_id": "26356732-d0f3-449a-9fe7-6339ae157687", "client_id": "e3e5b338-937e-4672-a700-1a1f5817a385", "campaign_name": "campaing api ", "agent_name": "nitishmishraragcheck-21-08", "client_name": "Nitish Mishra", "campaign_started_at": "2026-08-25T08:30:00", "campaign_ended_at": "2026-08-25T10:33:52.232273", "total_calls_dialed": 0, "total_calls_completed": 0, "total_calls_in_campaign": 2, "stats": { "total_calls": 2, "completed": 0, "pending": 2, "in_progress": 0, "failed": 0 }, "campaign_status": "cancelled", "contact_source_type": "csv" }, { "id": "bc762422-003b-4214-9068-32bcad61e0bc", "campaign_created_at": "2026-08-21T12:54:15.980517", "agent_display_name": "rag check - 21-08", "agent_id": "26356732-d0f3-449a-9fe7-6339ae157687", "client_id": "e3e5b338-937e-4672-a700-1a1f5817a385", "campaign_name": "new camp", "agent_name": "nitishmishraragcheck-21-08", "client_name": "Nitish Mishra", "campaign_started_at": "2026-08-21T02:30:00", "campaign_ended_at": "2026-08-21T12:54:48.478988", "total_calls_dialed": 2, "total_calls_completed": 2, "total_calls_in_campaign": 2, "stats": { "total_calls": 2, "completed": 2, "pending": 0, "in_progress": 0, "failed": 0 }, "campaign_status": "completed", "contact_source_type": "csv" } ] ``` *** ## Campaign Status Values | Status | Description | | - | - | | `scheduled` | Campaign created, not yet started | | `active` | Campaign is running, dialling contacts | | `paused` | Campaign temporarily paused | | `paused_out_of_range` | Campaign paused (outside calling window) | | `completed` | Campaign finished all contacts | | `cancelled` | Campaign permanently cancelled | # Pause Campaign Source: https://docs.vaanivoice.ai/api-reference/campaigns/pause POST /api/campaigns/{campaign_id}/pause Temporarily pause an active campaign ## Pause Campaign Temporarily pause a running campaign. Can be resumed later with `/resume`. *** ## Path Parameters **campaign\_id** `string` *required* UUID of the campaign to pause *** ## Example Request ```bash theme={null} curl -X POST "https://api.vaanivoice.ai/api/campaigns/abc-123-xyz/pause" \ -H "X-API-Key: vaani_abc123..." ``` *** ## Response `200 OK` ```json theme={null} { "id": "7edae6d7-2f23-41e3-9c34-061cc3171e8a", "client_id": "e3e5b338-937e-4672-a700-1a1f5817a385", "agent_id": "d665d65d-f1f1-4c23-aee2-0675bd3ec06f", "campaign_name": "campaing api test", "excel_blob_url": "https://vaani-uat-storage.s3.ap-south-1.amazonaws.com/campaigns/e3e5b338-937e-4672-a700-1a1f5817a385/16e07bf0-d971-4b7c-980a-094913f50768_Untitled spreadsheet - Sheet1 (5).csv", "results_excel_blob_url": null, "last_result_generated_at": null, "campaign_status": "paused", "contact_source_type": "csv", "gsheet_config": null, "days_of_week": "tuesday,thursday", "post_processing_status": "pending_excel", "time_range_from": "04:30:00Z", "time_range_to": "14:29:00Z", "max_retries": 1, "retry_after_mins": 5, "call_concurrency": 1, "start_date": "2026-09-22T04:30:00", "end_date": "2026-09-23T14:29:00", "created_at": "2026-09-22T05:16:39.393250", "updated_at": "2026-09-22T05:17:53.129961", "notification_emails": null, "webhook_url": null, "per_call_webhook_url": null, "webhook_id": null, "perform_dnd_check": false } ``` *** ## Behavior * Ongoing calls complete normally * No new calls are initiated * Campaign can be resumed with `/resume` * All progress is preserved # Resume Campaign Source: https://docs.vaanivoice.ai/api-reference/campaigns/resume POST /api/campaigns/{campaign_id}/resume Resume a paused campaign ## Resume Campaign Resume a paused campaign and return it to `active` status. *** ## Path Parameters **campaign\_id** `string` *required* UUID of the campaign to resume *** ## Example Request ```bash theme={null} curl -X POST "https://api.vaanivoice.ai/api/campaigns/abc-123-xyz/resume" \ -H "X-API-Key: vaani_abc123..." ``` *** ## Response `200 OK` ```json theme={null} { "id": "23231adb-0d59-4af5-995f-fd0aab9aea5e", "client_id": "e3e5b338-937e-4672-a700-1a1f5817a385", "agent_id": "44723264-61b6-453b-94ea-3e51d13beb12", "campaign_name": "campaing api test", "excel_blob_url": "https://vaani-uat-storage.s3.ap-south-1.amazonaws.com/campaigns/e3e5b338-937e-4672-a700-1a1f5817a385/7dcaad3b-ea56-4a94-bf4b-43d142497186_Untitled spreadsheet - Sheet1 (5).csv", "results_excel_blob_url": "https://vaani-uat-storage.s3.ap-south-1.amazonaws.com/campaigns/e3e5b338-937e-4672-a700-1a1f5817a385/86aae727-ac0c-4dbd-84f9-889552e6ea98/campaing_api_test_2026-09-17.csv", "last_result_generated_at": "2026-09-17T07:28:09.422181", "campaign_status": "active", "contact_source_type": "csv", "gsheet_config": null, "days_of_week": "thursday", "post_processing_status": "completed", "time_range_from": "05:30:00Z", "time_range_to": "14:29:00Z", "max_retries": 1, "retry_after_mins": 5, "call_concurrency": 1, "start_date": "2026-09-17T05:30:00", "end_date": "2026-09-18T14:29:00", "created_at": "2026-09-17T07:25:25.168627", "updated_at": "2026-09-17T07:28:06.325874", "notification_emails": null, "webhook_url": null, "per_call_webhook_url": null, "webhook_id": null, "perform_dnd_check": false } ``` *** ## Use Cases * Resume after manual pause * Resume after editing campaign configuration * Resume after temporary business hours closure * Resume after resolving an issue > [!NOTE] > > After updating a campaign via `PUT /campaigns/{id}`, you must call `/resume` to restart it. # Start Campaign Source: https://docs.vaanivoice.ai/api-reference/campaigns/start POST /api/campaigns/{campaign_id}/start Start a scheduled campaign ## Start Campaign Transition a campaign from `scheduled` or `paused` to `active`. *** ## Path Parameters **campaign\_id** `string` *required* UUID of the campaign to start *** ## Example Request ```bash theme={null} curl -X POST "https://api.vaanivoice.ai/api/campaigns/abc-123-xyz/start" \ -H "X-API-Key: vaani_abc123..." ``` *** ## Response `200 OK` ```json theme={null} { "id": "abc-123-xyz", "campaign_name": "Summer Promo 2024", "campaign_status": "active", "updated_at": "2026-07-01T14:30:00Z" } ``` *** ## Valid State Transitions | From Status | Can Start? | | - | - | | `scheduled` | ✅ Yes | | `paused` | ✅ Yes | | `active` | ❌ Already active | | `completed` | ❌ Cannot restart | | `cancelled` | ❌ Cannot restart | # Stop Campaign Source: https://docs.vaanivoice.ai/api-reference/campaigns/stop POST /api/campaigns/{campaign_id}/stop Stop campaign at end of current day (soft stop) ## Stop Campaign Gracefully stop a campaign at the end of the current day's calling window. *** ## Path Parameters **campaign\_id** `string` *required* UUID of the campaign to stop *** ## Example Request ```bash theme={null} curl -X POST "https://api.vaanivoice.ai/api/campaigns/abc-123-xyz/stop" \ -H "X-API-Key: vaani_abc123..." ``` *** ## Response `200 OK` ```json theme={null} { "id": "e8632ffe-ce38-4ae9-8185-72ef708aaa51", "client_id": "e3e5b338-937e-4672-a700-1a1f5817a385", "agent_id": "26356732-d0f3-449a-9fe7-6339ae157687", "campaign_name": "campaing api ", "excel_blob_url": "https://vaani-uat-storage.s3.ap-south-1.amazonaws.com/campaigns/e3e5b338-937e-4672-a700-1a1f5817a385/d3c4c1dd-e52d-4b4e-92d1-fccf63b55dad_Untitled spreadsheet - Sheet1 (2) (1).csv", "results_excel_blob_url": null, "last_result_generated_at": null, "campaign_status": "completed", "contact_source_type": "csv", "gsheet_config": null, "days_of_week": "tuesday", "post_processing_status": "pending_excel", "time_range_from": "08:30:00Z", "time_range_to": "14:29:00Z", "max_retries": 1, "retry_after_mins": 5, "call_concurrency": 1, "start_date": "2026-08-25T08:30:00", "end_date": "2026-08-25T10:32:22.597597", "created_at": "2026-08-25T10:26:31.403625", "updated_at": "2026-08-25T10:32:22.597597", "notification_emails": null, "webhook_url": null, "per_call_webhook_url": null, "webhook_id": null, "perform_dnd_check": false } ``` *** ## Behavior * Campaign continues until end of current day's window * All pending calls for today are completed * Status transitions to `completed` * Cannot be resumed after stopping > [!NOTE] > > Use `/pause` if you need to temporarily stop and resume later. > Use `/stop` for graceful completion. > Use `/cancel` for immediate termination. # Update Campaign Source: https://docs.vaanivoice.ai/api-reference/campaigns/update PUT /api/campaigns/{campaign_id} Update campaign configuration (auto-pauses campaign) ## Update Campaign Update campaign configuration. **Important:** Campaign is automatically paused before any changes are applied. You must manually resume it after updating via `POST /campaigns/{id}/resume`. *** ## Path Parameters **campaign\_id** `string` *required* UUID of the campaign to update *** ## Request Parameters All fields are optional. Only provide the fields you want to update. **campaign\_name** `string` Updated campaign name **concurrency** `integer` Updated concurrency (≤ org max) **max\_retries** `integer` Updated max retries (1-10) **retry\_delay\_mins** `integer` Updated retry delay (0-1440 minutes) **start\_time** `string` Updated start time - UTC HH:MM (e.g. `05:00`) **end\_time** `string` Updated end time - UTC HH:MM (e.g. `12:00`) **days\_of\_week** `string` Comma-separated weekdays **from\_date** `string` Updated from\_date YYYY-MM-DD **to\_date** `string` Updated to\_date YYYY-MM-DD **notification\_emails** `string` Comma-separated emails (max 5) **campaign\_webhook\_url** `string` Updated campaign webhook URL **per\_call\_webhook\_url** `string` Updated per-call webhook URL *** ## Example Request ```bash theme={null} curl -X PUT "https://api.vaanivoice.ai/api/campaigns/abc-123-xyz" \ -H "X-API-Key: vaani_abc123..." \ -F "campaign_name=Updated Campaign" \ -F "concurrency=10" \ -F "start_time=05:00" \ -F "end_time=12:00" \ -F "days_of_week=monday,wednesday,friday" ``` *** ## Response `200 OK` ```json theme={null} { "id": "7817f2fd-3380-450e-80ac-8e5249633312", "client_id": "e3e5b338-937e-4672-a700-1a1f5817a385", "agent_id": "26356732-d0f3-449a-9fe7-6339ae157687", "campaign_name": "update name", "excel_blob_url": "https://vaani-uat-storage.s3.ap-south-1.amazonaws.com/campaigns/e3e5b338-937e-4672-a700-1a1f5817a385/36fb6df6-f08c-4899-9d7a-292334c5e84b_Untitled spreadsheet - Sheet1 (2) (1).csv", "results_excel_blob_url": null, "last_result_generated_at": null, "campaign_status": "paused", "contact_source_type": "csv", "gsheet_config": null, "days_of_week": "tuesday", "post_processing_status": "pending_excel", "time_range_from": "04:30:00Z", "time_range_to": "12:30:00Z", "max_retries": 3, "retry_after_mins": 30, "call_concurrency": 1, "start_date": "2026-08-25T04:30:00", "end_date": "2026-08-26T12:30:00", "created_at": "2026-08-25T10:40:26.128721", "updated_at": "2026-08-25T10:42:05.109356", "notification_emails": null, "webhook_url": "https://polite-dolphin-73.webhook.cool", "per_call_webhook_url": null, "webhook_id": null, "perform_dnd_check": false } ``` *** ## Important Notes > [!WARNING] > > Campaign is automatically paused when edited. You must call `POST /campaigns/{id}/resume` to restart. 1. **Auto-Pause:** Campaign is paused before any changes 2. **Partial Updates:** Only provided fields are updated 3. **Validation:** Same constraints as create endpoint apply 4. **Time Format:** UTC 24-hour HH:MM (02:30–14:29) *** ## Error Response ```json theme={null} { "detail": { "code": "NO_FIELDS_TO_UPDATE", "message": "No fields provided to update" } } ``` # Campaign Webhooks Source: https://docs.vaanivoice.ai/api-reference/campaigns/webhooks Real-time notifications for campaign events and call completions ## Overview Vaani provides two types of webhooks for campaign monitoring: 1. **Campaign-Level Webhooks** - Triggered on campaign status changes 2. **Per-Call Webhooks** - Triggered after each call completes post-processing *** ## Campaign-Level Webhooks Notifies you when campaign status changes (`active`, `paused`, `completed`, `cancelled`). ### Configuration Provide `campaign_webhook_url` when creating or updating a campaign: ```bash theme={null} curl -X POST "https://api.vaanivoice.ai/api/campaigns/create" \ -H "X-API-Key: vaani_abc123..." \ -F "campaign_webhook_url=https://your-domain.com/webhooks/campaign" ``` ### Payload ```json theme={null} { "event": "campaign.status_changed", "campaign_id": "abc-123-xyz", "campaign_name": "Summer Promo 2024", "old_status": "active", "new_status": "paused", "timestamp": "2026-07-01T14:30:00Z", "stats": { "total_calls": 523, "completed": 498, "pending": 477, "in_progress": 3, "failed": 12 } } ``` *** ## Per-Call Webhooks Notifies you after each call completes and transcript/summary are generated. ### Configuration Provide `per_call_webhook_url` when creating or updating a campaign: ```bash theme={null} curl -X POST "https://api.vaanivoice.ai/api/campaigns/create" \ -H "X-API-Key: vaani_abc123..." \ -F "per_call_webhook_url=https://your-domain.com/webhooks/call" ``` ### Payload ```json theme={null} { "event": "call_postprocessing", "call_id": "outbound-1785148654-d915171f", "campaign_id": "d079211d-7519-4441-988c-368ed9c90812", "campaign_name": "Test Campaign", "timestamp": "2026-07-27T10:38:36.588135+00:00", "data": { "room_name": "outbound-1785148654-d915171f", "call_id": "outbound-1785148654-d915171f", "call_duration": 21651.399, "end_reason": "Call ended", "summary": "The agent greeted the customer and offered assistance after detecting inactivity. The customer did not respond, so no issue was identified or addressed. No next steps were established due to lack of engagement.", "entities": null, "dispositions": null, "recording_url": "https://mohammad-bk.vaaniresearch.com/api/stream/outbound-1785148654-d915171f", "transcript": "[10:37:59] AGENT: Hi! you have reached our customer service, I am your assistant, how can I help you today?\n\n[10:38:08] AGENT: Hello, you have been inactive for a while, Please let me know if you need help," } } ``` *** ## Webhook Retry Logic If your webhook endpoint is unreachable or returns a non-2xx status, Vaani automatically retries with exponential backoff: | Attempt | Delay | | - | - | | 1 | Immediate | | 2 | 5 seconds | | 3 | 25 seconds | | 4 | 125 seconds (\~2 min) | | 5 | 625 seconds (\~10 min) | After 5 failed attempts, the webhook is marked as failed and no further retries occur. *** ## Webhook Security ### Verify Webhook Signature Vaani signs all webhook payloads with HMAC-SHA256. Verify the signature before processing: **Request Headers:** ``` X-Vaani-Signature: sha256=abc123... X-Vaani-Timestamp: 1719842400 ``` **Python Verification Example:** ```python theme={null} import hmac import hashlib def verify_webhook(payload: bytes, signature: str, secret: str, timestamp: str): # Prevent replay attacks (check timestamp is within 5 minutes) if abs(int(time.time()) - int(timestamp)) > 300: return False # Compute expected signature expected = hmac.new( secret.encode(), f"{timestamp}.{payload.decode()}".encode(), hashlib.sha256 ).hexdigest() # Compare signatures securely return hmac.compare_digest(f"sha256={expected}", signature) ``` > [!WARNING] > > Always verify webhook signatures in production to prevent spoofing attacks. *** ## Webhook Endpoint Requirements Your webhook endpoint must: 1. **Respond quickly** (\< 5 seconds) to avoid timeouts 2. **Return 2xx status** to acknowledge receipt 3. **Be publicly accessible** over HTTPS 4. **Handle duplicate events** (use event IDs for idempotency) ### Example Flask Endpoint ```python theme={null} from flask import Flask, request, jsonify app = Flask(__name__) @app.route('/webhooks/campaign', methods=['POST']) def campaign_webhook(): payload = request.get_json() # Verify signature (recommended) signature = request.headers.get('X-Vaani-Signature') timestamp = request.headers.get('X-Vaani-Timestamp') if not verify_webhook(request.data, signature, YOUR_SECRET, timestamp): return jsonify({"error": "Invalid signature"}), 401 # Process event if payload['event'] == 'campaign.status_changed': campaign_id = payload['campaign_id'] new_status = payload['new_status'] print(f"Campaign {campaign_id} changed to {new_status}") return jsonify({"status": "received"}), 200 ``` *** ## Event Types Reference ### Campaign Events | Event | Description | | - | - | | `campaign.status_changed` | Campaign status changed | | `campaign.completed` | All calls finished | | `campaign.cancelled` | Campaign was cancelled | ### Call Events | Event | Description | | - | - | | `call.completed` | Call finished and processed | | `call.failed` | Call attempt failed | | `call.no_answer` | Recipient didn't answer | *** ## Testing Webhooks Use tools like [webhook.site](https://webhook.site) or [ngrok](https://ngrok.com) to test webhooks locally: ```bash theme={null} # 1. Start ngrok tunnel ngrok http 5000 # 2. Use the ngrok URL in your campaign curl -X POST "https://api.vaanivoice.ai/api/campaigns/create" \ -F "campaign_webhook_url=https://abc123.ngrok.io/webhooks/campaign" ``` *** ## Common Issues > **Webhook not receiving events** > > * Ensure URL is publicly accessible over HTTPS > * Check firewall/security group rules > * Verify endpoint returns 2xx status > * Check Vaani logs for delivery attempts > **Receiving duplicate events** > > * Implement idempotency using event IDs > * Store processed event IDs in database > * Return 200 for duplicate events > **Webhook timing out** > > * Process events asynchronously (queue-based) > * Respond with 200 immediately, then process > * Keep endpoint response time \< 5 seconds # Create Agent Source: https://docs.vaanivoice.ai/api-reference/create-agent POST /api/create-agent Create a new agent and associate it with your account ## Create Agent Create a new agent and associate it with the authenticated user's client. The `client_id` is automatically extracted from your API key - you don't need to supply it. *** ## Parameters **agent\_display\_name** `string` *required* Human-readable name for the agent (e.g. `"support-bot"`) **config** `object` (default: \{}) Optional initial configuration for the agent. You can pass any subset of the agent config sections here or leave it empty and configure them later via the section PATCH endpoints. **config structure** **persona** `object` Persona section - identity, senses/capabilities, actions, memories. **training** `object` Training section - knowledge base (RAG), FAQ, guardrails. **experience** `object` Experience section - conversational feel, call settings. **analysis** `object` Analysis section - dispositions, data extraction. **deployment\_config** `object` Deployment section - phone call-type routing. *** ## Request Example ```bash cURL theme={null} curl -X POST https://api.vaanivoice.ai/api/create-agent \ -H "X-API-Key: vaani_" \ -H "Content-Type: application/json" \ -d '{ "agent_display_name": "support-bot", "config": { "persona": { "identity": { "system_prompt": "You are a helpful customer support agent." } } } }' ``` ```javascript JavaScript theme={null} const response = await fetch("https://api.vaanivoice.ai/api/create-agent", { method: "POST", headers: { "X-API-Key": "vaani_", "Content-Type": "application/json", }, body: JSON.stringify({ agent_display_name: "support-bot", config: { persona: { identity: { system_prompt: "You are a helpful customer support agent.", }, }, }, }), }); const data = await response.json(); console.log(data); ``` ```python Python theme={null} import requests response = requests.post( "https://api.vaanivoice.ai/api/create-agent", headers={ "X-API-Key": "vaani_", "Content-Type": "application/json", }, json={ "agent_display_name": "support-bot", "config": { "persona": { "identity": { "system_prompt": "You are a helpful customer support agent." } } }, }, ) print(response.json()) ``` *** ## Response ```json Success (200) theme={null} { "success": true, "agent_id": "7ec4155e-0e62-440a-b983-5974f7697854", "agent_name": "support-bot", "client_id": "9abf5eff-e978-4e87-954d-7ff6ba570796" } ``` **success** `boolean` `true` when the agent was created successfully. **agent\_id** `string` UUID of the newly created agent. Use this in subsequent PATCH calls and when triggering calls. **agent\_name** `string` Display name of the new agent. **client\_id** `string` Client UUID the agent was associated with (resolved from your API key). ## Video Walkthrough [https://www.loom.com/embed/63ef773a48fd43e4840458066bbd0232](https://www.loom.com/embed/63ef773a48fd43e4840458066bbd0232) *** # Delete Agent Source: https://docs.vaanivoice.ai/api-reference/delete-agent DELETE /api/agents/{agent_id} Permanently delete an agent from your account ## Delete Agent Permanently delete an agent by UUID or name. This action stops any active agent instances, cleans up configurations, and unassigns related resources. > [!WARNING] > > Deletion is permanent. Once an agent is deleted, its configuration and assigned prompts cannot be recovered. *** ## Path Parameters **agent\_id** `string` *required* The unique identifier (UUID) or system name of the agent to delete. *** ## Request Example ```bash cURL theme={null} curl -X DELETE "https://api.vaanivoice.ai/api/agents/7ec4155e-0e62-440a-b983-5974f7697854" \ -H "X-API-Key: vaani_" ``` ```javascript JavaScript theme={null} const response = await fetch("https://api.vaanivoice.ai/api/agents/7ec4155e-0e62-440a-b983-5974f7697854", { method: "DELETE", headers: { "X-API-Key": "vaani_", }, }); const data = await response.json(); console.log(data); ``` ```python Python (Requests) theme={null} import requests response = requests.delete( "https://api.vaanivoice.ai/api/agents/7ec4155e-0e62-440a-b983-5974f7697854", headers={ "X-API-Key": "vaani_", }, ) print(response.json()) ``` ```python Python SDK theme={null} from vaani_sdk import VaaniClient with VaaniClient(api_key="vaani_") as client: # Delete by UUID or name result = client.agents.delete("7ec4155e-0e62-440a-b983-5974f7697854") print(result["message"]) # "Agent deleted successfully" ``` *** ## Response ```json Success (200 OK) theme={null} { "message": "Agent deleted successfully" } ``` ```json Error (404 Not Found) theme={null} { "detail": "Agent not found" } ``` ```json Error (403 Forbidden) theme={null} { "detail": "Access denied" } ``` **message** `string` Confirmation message indicating the agent was successfully deleted. # API Reference Source: https://docs.vaanivoice.ai/api-reference/introduction Vaani Backend API - Agent Builder, Call Management, and WebRTC ## Overview The Vaani Backend API provides endpoints for building and configuring voice agents, triggering and managing calls, and connecting in-browser sessions via WebRTC. All endpoints require API key authentication via the `X-API-Key` header. ## Authentication All endpoints require API key authentication. Include your API key in the request header: ``` X-API-Key: vaani_ ``` > [!NOTE] > > Keep your API key secure and never expose it in client-side code or public repositories. ## Base URL All endpoints are prefixed with `/api/`. The base URL is: ``` https://api.vaanivoice.ai ``` ## API Version Current API version: **2.0.0** *** ## Agent Builder Use these endpoints to programmatically create and configure agents via the API. | Method | Endpoint | Description | | - | - | - | | `POST` | `/api/create-agent` | Create a new agent | | `PATCH` | `/api/agent/{agent_id}/persona` | Update identity, AI providers | | `PATCH` | `/api/agent/{agent_id}/training` | Update knowledge base, FAQ, guardrails | | `PATCH` | `/api/agent/{agent_id}/experience` | Update conversational feel and call settings | | `PATCH` | `/api/agent/{agent_id}/analysis` | Update post-call evaluation and data extraction | | `PATCH` | `/api/agent/{agent_id}/deployment` | Update phone number routing | All PATCH endpoints perform a **partial merge** - only the fields you send are updated. *** ## Call Management | Method | Endpoint | Description | | - | - | - | | `POST` | `/api/trigger-call/` | Trigger an outbound call | | `POST` | `/api/webrtc/token` | Generate a LiveKit WebRTC token | | `GET` | `/api/call-history` | Paginated call history | | `GET` | `/api/transcript/{call_id}` | Get call transcript | | `GET` | `/api/call_details/{call_id}` | Get call details, summary, and extractions | | `GET` | `/api/stream/{call_id}` | Stream audio recording | # List Agents Source: https://docs.vaanivoice.ai/api-reference/list-agents GET /api/agents List all agents associated with your organization ## List Agents Retrieve all agents associated with the authenticated user's organization. Supports optional search filtering by display name or agent name, as well as pagination. *** ## Query Parameters **search** `string` Filter agents by display name or agent slug. **page** `integer` Page number for pagination (1-indexed). When omitted, returns all agents as a list. **page\_size** `integer` (default: 10) Number of agents per page (max 200). **published\_only** `boolean` (default: false) Filter to only return published agents. *** ## Request Example ```bash cURL theme={null} curl -X GET "https://api.vaanivoice.ai/api/agents?search=support&page=1&page_size=10" \ -H "X-API-Key: vaani_" ``` ```javascript JavaScript theme={null} const response = await fetch("https://api.vaanivoice.ai/api/agents?search=support&page=1&page_size=10", { method: "GET", headers: { "X-API-Key": "vaani_", }, }); const data = await response.json(); console.log(data); ``` ```python Python (Requests) theme={null} import requests response = requests.get( "https://api.vaanivoice.ai/api/agents", headers={ "X-API-Key": "vaani_", }, params={ "search": "support", "page": 1, "page_size": 10, }, ) print(response.json()) ``` ```python Python SDK theme={null} from vaani_sdk import VaaniClient with VaaniClient(api_key="vaani_") as client: # List all agents agents = client.agents.list() for agent in agents: print(agent.id, agent.display_name, agent.agent_name) # Search with pagination filtered = client.agents.list(search="support", page=1, page_size=10) ``` *** ## Response ```json Paginated (200 OK) theme={null} { "data": [ { "id": "7ec4155e-0e62-440a-b983-5974f7697854", "agent_name": "clientnamesupportbot", "display_name": "Support Bot", "client_id": "9abf5eff-e978-4e87-954d-7ff6ba570796", "client_name": "Acme Corp", "published": true, "published_at": "2026-09-01T12:00:00Z", "last_edited_at": "2026-09-25T10:00:00Z", "deployment_config": {}, "status": "running", "gsheet_config": null, "archived": false } ], "pagination": { "page": 1, "page_size": 10, "total_count": 1, "total_pages": 1, "has_next": false, "has_previous": false } } ``` ```json Non-Paginated (200 OK) theme={null} [ { "id": "7ec4155e-0e62-440a-b983-5974f7697854", "agent_name": "clientnamesupportbot", "display_name": "Support Bot", "client_id": "9abf5eff-e978-4e87-954d-7ff6ba570796", "client_name": "Acme Corp", "published": true, "published_at": "2026-09-01T12:00:00Z", "last_edited_at": "2026-09-25T10:00:00Z", "deployment_config": {}, "status": "running", "gsheet_config": null, "archived": false } ] ``` **data** `array` List of agent objects. **agent properties** **id** `string` Unique identifier (UUID) of the agent. **agent\_name** `string` Internal system slug identifier of the agent. **display\_name** `string` Human-readable display name of the agent. **client\_id** `string` UUID of the organization owning the agent. **client\_name** `string` Name of the organization. **published** `boolean` Whether the agent has been published for active use. **published\_at** `string` ISO timestamp when the agent was published. **last\_edited\_at** `string` ISO timestamp when the agent was last edited. **status** `string` Current agent status (e.g. `running`, `stopped`, `initialized`). **archived** `boolean` Whether the agent is archived. **pagination** `object` Pagination metadata included when `page` parameter is provided. **pagination properties** **page** `integer` Current page number. **page\_size** `integer` Number of items per page. **total\_count** `integer` Total matching agents. **total\_pages** `integer` Total number of pages. **has\_next** `boolean` Whether more pages exist. **has\_previous** `boolean` Whether a prior page exists. # Stream Audio Source: https://docs.vaanivoice.ai/api-reference/stream GET /api/stream/{call_id} Stream the audio recording of a call ## Stream Audio Stream the audio recording of a call. Returns a binary audio file (`audio/ogg` or `audio/mpeg`). ## Parameters **call\_id** `string` *required* The unique call ID (e.g., `outbound-1776774443-863aa698`) ## Request Example ```bash cURL theme={null} # CALL_ID=your_call_id # API_KEY=your_api_key # Download the audio file curl -H "X-API-Key:$API_KEY" "https://api.vaanivoice.ai/api/stream/$CALL_ID" -o recording.ogg # Check headers only (no download) curl -sI -H "X-API-Key:$API_KEY" "https://api.vaanivoice.ai/api/stream/$CALL_ID" ``` ```javascript JavaScript theme={null} const CALL_ID = "outbound-1776774443-863aa698"; const API_KEY = "your_api_key"; const response = await fetch( `https://api.vaanivoice.ai/api/stream/${CALL_ID}`, { method: "GET", headers: { "X-API-Key": API_KEY, }, } ); // Use as audio source const blob = await response.blob(); const url = URL.createObjectURL(blob); const audio = new Audio(url); audio.play(); ``` ```python Python theme={null} import requests CALL_ID = "outbound-1776774443-863aa698" API_KEY = "your_api_key" headers = { "X-API-Key": API_KEY } response = requests.get( f"https://api.vaanivoice.ai/api/stream/{CALL_ID}", headers=headers, stream=True ) with open("recording.ogg", "wb") as f: for chunk in response.iter_content(chunk_size=8192): f.write(chunk) ``` ## Response ### Success Response (200) Returns a binary audio stream. The response is **not JSON** - it is the raw audio file. ```bash Response Headers theme={null} HTTP/1.1 200 OK content-type: audio/ogg content-length: 1083518 ``` **Content-Type** `string` Audio format - typically `audio/ogg` or `audio/mpeg` **Content-Length** `integer` Size of the audio file in bytes > [!NOTE] > > The response is a binary audio stream, not JSON. Use the `-o` flag with curl to save it to a file, or use the URL directly in an HTML `