{
  "openapi": "3.0.3",
  "info": {
    "title": "IVR Solutions API",
    "description": "# IVR Solutions API — Voice Automation for Developers\n\nBuild voice into your product in minutes. The IVR Solutions REST API lets you **connect agents and customers with click-to-call**, **run outbound auto-dialer campaigns**, **manage agents and DID (virtual) numbers**, and **pull detailed call logs** — all over simple, predictable HTTPS endpoints that return JSON.\n\nThis reference is **interactive**: pick any endpoint, hit **Try it**, and the request runs live. Ready-to-paste code samples (cURL, JavaScript, Python, PHP and more) are generated for every call.\n\n---\n\n## Base URL\n\n```\nhttps://api.ivrsolutions.in\n```\n\nAll endpoints are relative to this URL and **must be called over HTTPS**.\n\n## Authentication\n\nEvery request must be authenticated with your **API token**. Get it from your **IVR Solutions dashboard → Settings → API**.\n\nYou can pass the token two ways:\n\n**1. Bearer header (recommended)**\n\n```bash\ncurl https://api.ivrsolutions.in/api/call_logs \\\n  -H \"Authorization: Bearer YOUR_API_TOKEN\"\n```\n\n**2. `token` query parameter** (handy for quick GET tests and webhooks)\n\n```bash\ncurl \"https://api.ivrsolutions.in/api/c2c_get?token=YOUR_API_TOKEN&did=...&customer=...&agent=...\"\n```\n\n> Keep your token secret. Never expose it in client-side/browser code or public repositories. Rotate it from the dashboard if it leaks.\n\n## Quick start — your first call in 30 seconds\n\nConnect an agent to a customer with one request:\n\n```bash\ncurl -X POST https://api.ivrsolutions.in/api/c2c_post \\\n  -H \"Authorization: Bearer YOUR_API_TOKEN\" \\\n  -F \"did=+911143104567\" \\\n  -F \"ext_no=2101\" \\\n  -F \"phone=09876543210\"\n```\n\n`did` is your virtual number, `ext_no` is the agent's extension and `phone` is the customer's number. The platform rings the agent first, then dials the customer and bridges the call. Use the returned `logid` to track status with **Get Call Status**.\n\n## Response format\n\nAll responses are JSON. A successful call looks like:\n\n```json\n{\n  \"status\": 200,\n  \"message\": \"Call connecting. Please wait...\",\n  \"logid\": 123456\n}\n```\n\nList endpoints return the records under a `data` array. The exact fields for each endpoint are documented in its **Responses** section below.\n\n## Error handling\n\nErrors use standard HTTP status codes and return a readable `message`:\n\n```json\n{\n  \"status\": false,\n  \"message\": \"Invalid or missing API token\"\n}\n```\n\n| Status | Meaning | What to do |\n|--------|---------|------------|\n| `200` | Success | Request accepted/processed. |\n| `400` | Bad request | A required parameter is missing or malformed — check the message. |\n| `401` | Unauthorized | Token missing, invalid or expired — re-check your API token. |\n| `404` | Not found | The resource/record does not exist. |\n| `429` | Too many requests | You hit the rate limit — back off and retry. |\n| `500` | Server error | Transient issue on our side — retry with backoff, then contact support. |\n\nAlways check `status`/`message` before assuming success, and log the `logid` for traceability.\n\n## Phone number format\n\n- Include a **leading `0`** for domestic numbers (e.g. `09876543210`) **or** the full **country code** (e.g. `+919876543210`).\n- DID numbers are passed in full international form (e.g. `+911143104567`).\n- Strip spaces, dashes and brackets before sending.\n\n## Scheduling & timezones\n\nWhen scheduling future calls or campaigns, pass an IANA timezone such as `Asia/Kolkata` so calls fire at the intended local time.\n\n## Rate limits\n\nThe API is rate limited to protect platform quality. If you receive `429 Too Many Requests`, pause and retry with exponential backoff. For high-volume dialing, use the **bulk** auto-dialer endpoints instead of looping single calls. Need a higher limit? Contact support.\n\n## A common end-to-end flow — COD order confirmation\n\n1. Call **Dial by Text** (`/api/dial_by_text`) with a template like *“Press 1 to confirm your order, 2 to cancel.”*\n2. Capture the customer's DTMF keypress inside your call flow.\n3. Route to an agent or update the order automatically based on the input.\n4. Reconcile results later via **Dialer Logs** (`/api/dialer_logs`).\n\n## Tools & SDKs\n\n- **Postman collection** — import and start calling endpoints immediately: [IVR Solutions Public APIs](https://www.postman.com/founderscart/founderscart-public-apis/collection/3008j58/ivr-solutions-voice-calls-automation)\n- **OpenAPI spec** — machine-readable spec powering this page (great for generating client SDKs).\n\n## Support\n\n- **Email:** [support@ivrsolutions.in](mailto:support@ivrsolutions.in)\n- **Website:** [www.ivrsolutions.in](https://www.ivrsolutions.in)\n\nWe typically respond within one business day.\n\n## API versions\n\nMost endpoints are also available under a **`/v1`** namespace (e.g. `/v1/call_logs`) with the same parameters — handy if you've standardised on versioned URLs. A few capabilities are `/v1`-only, such as `/v1/all_call_logs` (incremental log sync) and `/v1/agent_login_token` (embed an agent softphone).\n\n## Voice bots over WebSocket (WSS Telephony Bridge)\n\nAI voice bots connect to live calls through the **WSS Telephony Bridge** — one call becomes one WebSocket session with bidirectional audio. Start an outbound bot call with `dial_by_aivoicebot` (or `dial_by_voicebot`) and point it at your WebSocket server via `wss_url` / `wss_header`; the bridge streams audio to and from your bot.\n\n**Key fields**\n- `wss_url` — your WebSocket Secure endpoint (e.g. `wss://your-bot.example.com/voice`)\n- `wss_header` — header sent on connect (e.g. `Authorization: Bearer ...`)\n- `system_msg` — system prompt for the AI agent\n- `sttlanguage_code` — speech-to-text language (e.g. `en-IN`)\n- `ai_agent_ext` / `sip_url` — agent extension or SIP target for hybrid routing\n- `text` — optional opening line to speak\n- `connect_ws_after_answer` — connect the socket only after the call is answered (`0|1`)\n\n**Events your bot receives** (IVR → bot): `connected`, `start`, `media` (base64 PCM, 8 kHz, 16-bit mono), `dtmf`, `mark`, `clear`, `stop`.\n\n**Messages your bot sends** (bot → IVR):\n- `{ \"type\": \"response.audio.delta\", \"delta\": \"<base64-audio>\" }` — stream audio back\n- `{ \"type\": \"session.dtmf\", \"dtmf\": \"123#\" }` — send DTMF\n- `{ \"type\": \"audio.clear\" }` — flush queued audio (barge-in)\n- `{ \"type\": \"session.hangup\" }` — end the call\n\n**In-call transfers** (bot → IVR): `session.transfer` (a number or list, optional `\"strategy\":\"sequential\"`), `session.transfer_ws` (to another bot), `session.flow_transfer` (to an IVR flow), `session.transfer_extension` (to a SIP extension).\n\nFull protocol, event payloads and a reference implementation are on GitHub: [Founders-Cart/IVR-Solutions-WSS-Telephony-Bridge](https://github.com/Founders-Cart/IVR-Solutions-WSS-Telephony-Bridge).",
    "version": "1.0.0",
    "contact": {
      "name": "IVR Solutions Support",
      "email": "support@ivrsolutions.in",
      "url": "https://www.ivrsolutions.in"
    },
    "summary": "REST API to automate voice calls, click-to-call, auto-dialer campaigns, agents, call logs and DID numbers.",
    "termsOfService": "https://www.ivrsolutions.in/terms-&-conditions"
  },
  "servers": [
    {
      "url": "https://api.ivrsolutions.in",
      "description": "Production Server"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Click to Call",
      "description": "Instantly bridge an agent and a customer. The platform calls the agent first, then the customer, and connects them — ideal for support callbacks, sales follow-ups and \"call me\" buttons. Available as GET (query params) or POST (JSON)."
    },
    {
      "name": "Number Masking",
      "description": "Connect two people through your DID so neither party ever sees the other's real phone number — the privacy layer behind Uber/Ola-style \"contact the driver\" calling. Both legs ring from your DID, the platform bridges them, and you can update or cancel a live session and pull per-session logs. Use it for marketplaces, ride-hailing, deliveries, classifieds, real-estate and healthcare, where buyers and sellers must talk without exchanging personal numbers."
    },
    {
      "name": "Auto Dialer",
      "description": "Run outbound voice campaigns at scale. Schedule and send calls from text-to-speech templates or pre-built IVR call flows, add numbers (single or bulk) to a campaign, and start/stop dialers on the fly."
    },
    {
      "name": "Agents",
      "description": "Manage who can take and make calls. Enable or disable agent extensions, add new agents, and assign DID numbers to agents."
    },
    {
      "name": "Call Logs",
      "description": "Audit and reconcile every interaction. Fetch complete call history — click-to-call, auto-dialer and inbound — filter by number or type, check live call status and attach notes to records."
    },
    {
      "name": "DID",
      "description": "Manage your virtual (DID) numbers. List the numbers you own, search availability by region, and purchase new DID numbers programmatically."
    },
    {
      "name": "Voice Bots",
      "description": "Place outbound calls answered by AI / WSS voice bots. Calls bridge to your WebSocket server for real-time, bidirectional audio via the WSS Telephony Bridge.",
      "externalDocs": {
        "description": "WSS Telephony Bridge — protocol & reference implementation",
        "url": "https://github.com/Founders-Cart/IVR-Solutions-WSS-Telephony-Bridge"
      }
    },
    {
      "name": "Text Templates",
      "description": "Create and manage text-to-speech templates for dialers."
    },
    {
      "name": "Contacts",
      "description": "Save and look up contacts, and list call variables."
    },
    {
      "name": "Webhooks",
      "description": "Register webhook URLs to receive real-time call events."
    },
    {
      "name": "Integrations",
      "description": "Helper endpoints for CRM and lead integrations."
    }
  ],
  "paths": {
    "/api/c2c_get": {
      "get": {
        "tags": [
          "Click to Call"
        ],
        "summary": "Click To Call (GET)",
        "description": "Bridge an agent and a customer with a single GET request — ideal for links and webhooks that can only fire a URL.\n\n**How it works:** Pass your `token`, the `did` to show as caller ID, the agent's `ext_no` and the customer's `phone` as query parameters. The platform rings the agent first, then dials the customer and bridges both legs.\n\n**Use it for** click-to-call links, no-code tools and webhook actions that can only call a URL.",
        "operationId": "clickToCallGet",
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "description": "Bearer token for authentication",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "did",
            "in": "query",
            "required": true,
            "description": "DID number (your virtual number)",
            "schema": {
              "type": "string"
            },
            "example": "+911143104567"
          },
          {
            "name": "ext_no",
            "in": "query",
            "required": true,
            "description": "Agent extension number",
            "schema": {
              "type": "string"
            },
            "example": "2101"
          },
          {
            "name": "phone",
            "in": "query",
            "required": true,
            "description": "Customer phone number to call",
            "schema": {
              "type": "string"
            },
            "example": "09876543210"
          }
        ],
        "responses": {
          "200": {
            "description": "Call initiated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClickToCallResponse"
                },
                "example": {
                  "status": 200,
                  "message": "Call connecting. Please wait...",
                  "logid": 123456
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid token",
            "content": {
              "application/json": {
                "example": {
                  "status": 401,
                  "message": "Token Invalid"
                }
              }
            }
          },
          "404": {
            "description": "Agent not found",
            "content": {
              "application/json": {
                "example": {
                  "status": 404,
                  "message": "Agent Number not found."
                }
              }
            }
          },
          "405": {
            "description": "Configuration error",
            "content": {
              "application/json": {
                "example": {
                  "status": 405,
                  "message": "Click to call DID Number not defined."
                }
              }
            }
          }
        }
      }
    },
    "/api/c2c_post": {
      "post": {
        "tags": [
          "Click to Call"
        ],
        "summary": "Click To Call (POST)",
        "description": "Bridge an agent and a customer with a POST request — the standard way to trigger click-to-call from your backend.\n\n**How it works:** Send the `did` (caller ID), the agent `ext_no` and the customer `phone`. The platform calls the agent, then the customer, and connects the two legs in about a second.\n\n**Use it for** “call me” buttons, CRM click-to-dial, support callbacks and sales follow-ups.",
        "operationId": "clickToCallPost",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "did",
                  "ext_no",
                  "phone"
                ],
                "properties": {
                  "did": {
                    "type": "string",
                    "description": "DID number (your virtual number)",
                    "example": "+911143104567"
                  },
                  "ext_no": {
                    "type": "string",
                    "description": "Agent extension number",
                    "example": "2101"
                  },
                  "phone": {
                    "type": "string",
                    "description": "Customer phone number to call",
                    "example": "09876543210"
                  }
                }
              },
              "example": {
                "did": "+911143104567",
                "ext_no": "2101",
                "phone": "09876543210"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Call initiated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClickToCallResponse"
                },
                "example": {
                  "status": 200,
                  "message": "Call connecting. Please wait...",
                  "logid": 123456
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "example": {
                  "status": 401,
                  "message": "empty data field"
                }
              }
            }
          },
          "405": {
            "description": "Agent not registered",
            "content": {
              "application/json": {
                "example": {
                  "status": 405,
                  "message": "Agent email not registered with ivrsolutions."
                }
              }
            }
          }
        }
      }
    },
    "/api/click_connect": {
      "post": {
        "tags": [
          "Number Masking"
        ],
        "summary": "Start a masked call (Click-Connect)",
        "description": "Bridge two people through your DID without revealing either party's real phone number — the same call-masking pattern Uber and Ola use to connect riders and drivers.\n\n**How it works:** you pass both real numbers and a `did`. The platform calls the first party, then the second, and connects the two legs. Each party sees only your DID on their handset — never the other person's number. The mapping lives only inside the session, so once the call (or job) is over the link is gone and the numbers can never be harvested.\n\n**Use it for** marketplaces, ride-hailing and deliveries, classifieds, real estate and healthcare — anywhere a buyer and seller must talk while keeping personal numbers private. Manage a live session with `/api/click_connect_update` (e.g. cancel it) and pull per-session records with `/api/click_connect_logs`.",
        "operationId": "clickConnect",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "first_phone",
                  "second_phone",
                  "did"
                ],
                "properties": {
                  "first_phone": {
                    "type": "string",
                    "description": "First party's phone number",
                    "example": "+919876543210"
                  },
                  "second_phone": {
                    "type": "string",
                    "description": "Second party's phone number",
                    "example": "+919123456789"
                  },
                  "did": {
                    "type": "string",
                    "description": "DID number to use as caller ID",
                    "example": "+911143104567"
                  }
                }
              },
              "example": {
                "first_phone": "+919876543210",
                "second_phone": "+919123456789",
                "did": "+911143104567"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Call connection initiated",
            "content": {
              "application/json": {
                "example": {
                  "status": 200,
                  "message": "Call connecting. Please wait...",
                  "logid": 123457
                }
              }
            }
          }
        }
      }
    },
    "/api/get_callflow": {
      "get": {
        "tags": [
          "Auto Dialer"
        ],
        "summary": "Get Call Flows",
        "description": "List every call flow (IVR) configured in your account, with its ID and name.\n\n**How it works:** Send your `token`; the API returns all saved call flows so you can pick a `flow_id` to play on outbound calls.\n\n**Use it for** populating a flow picker, or looking up a `flow_id` before calling `dial_by_flow`.",
        "operationId": "getCallFlows",
        "responses": {
          "200": {
            "description": "List of call flows",
            "content": {
              "application/json": {
                "example": {
                  "status": 200,
                  "data": [
                    {
                      "id": 1001,
                      "name": "Welcome IVR",
                      "description": "Main welcome menu"
                    },
                    {
                      "id": 1002,
                      "name": "Order Confirmation",
                      "description": "COD order confirmation flow"
                    },
                    {
                      "id": 1003,
                      "name": "Feedback Survey",
                      "description": "Post-call feedback collection"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/dial_by_flow": {
      "post": {
        "tags": [
          "Auto Dialer"
        ],
        "summary": "Dial and Play Flow ID",
        "description": "Place an outbound call and play a pre-built IVR call flow to the customer.\n\n**How it works:** Pass the `did_no`, the `flow_id` to play and the `customer_no`. The platform dials the customer and runs the flow, capturing the keypresses defined in it; add `schedule_datetime` and `timezone` to send it later.\n\n**Use it for** order confirmations, reminders, surveys and any menu-driven outbound call.",
        "operationId": "dialByFlow",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "did_no",
                  "flow_id",
                  "customer_no"
                ],
                "properties": {
                  "did_no": {
                    "type": "string",
                    "description": "Your DID Number",
                    "example": "+911143104567"
                  },
                  "flow_id": {
                    "type": "string",
                    "description": "Your Call Flow ID",
                    "example": "1001"
                  },
                  "customer_no": {
                    "type": "string",
                    "description": "Phone number to call (with 0 prefix)",
                    "example": "09871234567"
                  },
                  "schedule_datetime": {
                    "type": "string",
                    "description": "Schedule call for later (format: YYYY-MM-DD HH:mm:ss)",
                    "example": "2024-12-31 13:00:00"
                  },
                  "timezone": {
                    "type": "string",
                    "description": "Timezone for scheduled call",
                    "example": "Asia/Kolkata"
                  }
                }
              },
              "example": {
                "did_no": "+911143104567",
                "flow_id": "1001",
                "customer_no": "09871234567",
                "schedule_datetime": "2024-12-31 13:00:00",
                "timezone": "Asia/Kolkata"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Call initiated or scheduled",
            "content": {
              "application/json": {
                "examples": {
                  "immediate": {
                    "summary": "Immediate call",
                    "value": {
                      "status": 200,
                      "message": "Call initiated successfully",
                      "call_id": "call_abc123xyz"
                    }
                  },
                  "scheduled": {
                    "summary": "Scheduled call",
                    "value": {
                      "status": 200,
                      "message": "Call scheduled successfully",
                      "scheduled_time": "2024-12-31 13:00:00",
                      "timezone": "Asia/Kolkata"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/dial_by_text": {
      "post": {
        "tags": [
          "Auto Dialer"
        ],
        "summary": "Dial and Play Text",
        "description": "Place an outbound call that speaks a text-to-speech message built from a template.\n\n**How it works:** Pass the `did_no`, `customer_no` and a `template_name`, filling any `Variable` placeholders. The platform dials the customer and reads out the rendered message; schedule it with `schedule_datetime`.\n\n**Use it for** OTP and voice alerts, personalized reminders and confirmations without recording audio.",
        "operationId": "dialByText",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "did_no",
                  "customer_no",
                  "template_name"
                ],
                "properties": {
                  "did_no": {
                    "type": "string",
                    "description": "Your DID Number",
                    "example": "+911143104567"
                  },
                  "flow_id": {
                    "type": "string",
                    "description": "Call Flow ID for context and options (optional)",
                    "example": "1701"
                  },
                  "customer_no": {
                    "type": "string",
                    "description": "Phone number to call (with 0 prefix)",
                    "example": "09354123456"
                  },
                  "template_name": {
                    "type": "string",
                    "description": "Name of the text template",
                    "example": "api_order_confirm"
                  },
                  "Variable": {
                    "type": "string",
                    "description": "Variables as per text template (comma-separated)",
                    "example": "John,ORD12345,1500"
                  },
                  "schedule_datetime": {
                    "type": "string",
                    "description": "Schedule call for later (format: YYYY-MM-DD HH:mm:ss)",
                    "example": "2024-12-31 13:00:00"
                  },
                  "timezone": {
                    "type": "string",
                    "description": "Timezone for scheduled call",
                    "example": "Asia/Kolkata"
                  }
                }
              },
              "example": {
                "did_no": "+911143104567",
                "flow_id": "1701",
                "customer_no": "09354123456",
                "template_name": "api_order_confirm",
                "Variable": "John,ORD12345,1500",
                "schedule_datetime": "2024-12-31 13:00:00",
                "timezone": "Asia/Kolkata"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Call initiated or scheduled",
            "content": {
              "application/json": {
                "example": {
                  "status": 200,
                  "message": "Call initiated successfully",
                  "call_id": "call_txt_abc123"
                }
              }
            }
          }
        }
      }
    },
    "/api/get_dialers_list": {
      "get": {
        "tags": [
          "Auto Dialer"
        ],
        "summary": "Get Auto Dialer List",
        "description": "List your auto-dialer campaigns with their IDs and status.\n\n**How it works:** Send your `token` to get every dialer you've created, so you can pick a `dialerid` to load numbers into or start and stop.\n\n**Use it for** showing a campaign dashboard, or looking up a `dialerid` before adding numbers.",
        "operationId": "getDialersList",
        "responses": {
          "200": {
            "description": "List of dialers",
            "content": {
              "application/json": {
                "example": {
                  "status": 200,
                  "data": [
                    {
                      "id": 101,
                      "name": "Order Confirmation Campaign",
                      "did_no": "+911143104567",
                      "status": "on",
                      "start_time": "09:00",
                      "end_time": "18:00",
                      "no_of_calls": 5,
                      "total_numbers": 1250,
                      "completed": 890,
                      "pending": 360
                    },
                    {
                      "id": 102,
                      "name": "Feedback Survey",
                      "did_no": "+911143104568",
                      "status": "off",
                      "start_time": "10:00",
                      "end_time": "17:00",
                      "no_of_calls": 3,
                      "total_numbers": 500,
                      "completed": 500,
                      "pending": 0
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/add_to_ivrdialer": {
      "post": {
        "tags": [
          "Auto Dialer"
        ],
        "summary": "Add Number to Dialer",
        "description": "Add a single contact to an existing auto-dialer campaign.\n\n**How it works:** Pass the `dialerid` with the `number` (and optional `name` / `order_id`). The contact joins the campaign's queue and is called when the dialer runs.\n\n**Use it for** dripping new leads or COD orders into a running campaign one at a time.",
        "operationId": "addToDialer",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "dialerid",
                  "number"
                ],
                "properties": {
                  "dialerid": {
                    "type": "integer",
                    "description": "Dialer ID",
                    "example": 101
                  },
                  "number": {
                    "type": "string",
                    "description": "Phone number to add",
                    "example": "09876543210"
                  },
                  "name": {
                    "type": "string",
                    "description": "Customer name (variable)",
                    "example": "John Doe"
                  },
                  "order_id": {
                    "type": "string",
                    "description": "Order ID (variable)",
                    "example": "ORD12345"
                  }
                }
              },
              "example": {
                "dialerid": 101,
                "number": "09876543210",
                "name": "John Doe",
                "order_id": "ORD12345"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Number added to dialer",
            "content": {
              "application/json": {
                "example": {
                  "status": true,
                  "message": "Number added to dialer successfully"
                }
              }
            }
          }
        }
      }
    },
    "/api/add_to_ivrdialerbulk": {
      "post": {
        "tags": [
          "Auto Dialer"
        ],
        "summary": "Add Numbers to Dialer (Bulk)",
        "description": "Add many contacts to an auto-dialer campaign in one request.\n\n**How it works:** Pass the `dialerid` and an array of `numbers`; all are queued for the campaign at once.\n\n**Use it for** loading a full contact list or daily batch before starting a campaign.",
        "operationId": "addToDialerBulk",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "dialerid",
                  "numbers"
                ],
                "properties": {
                  "dialerid": {
                    "type": "integer",
                    "description": "Dialer ID",
                    "example": 101
                  },
                  "numbers": {
                    "type": "array",
                    "maxItems": 100,
                    "description": "Array of numbers with variables (max 100)",
                    "items": {
                      "type": "object",
                      "properties": {
                        "number": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "order_id": {
                          "type": "string"
                        }
                      }
                    },
                    "example": [
                      {
                        "number": "09876543210",
                        "name": "John Doe",
                        "order_id": "ORD001"
                      },
                      {
                        "number": "09876543211",
                        "name": "Jane Smith",
                        "order_id": "ORD002"
                      },
                      {
                        "number": "09876543212",
                        "name": "Bob Wilson",
                        "order_id": "ORD003"
                      }
                    ]
                  }
                }
              },
              "example": {
                "dialerid": 101,
                "numbers": [
                  {
                    "number": "09876543210",
                    "name": "John Doe",
                    "order_id": "ORD001"
                  },
                  {
                    "number": "09876543211",
                    "name": "Jane Smith",
                    "order_id": "ORD002"
                  },
                  {
                    "number": "09876543212",
                    "name": "Bob Wilson",
                    "order_id": "ORD003"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Numbers added to dialer",
            "content": {
              "application/json": {
                "example": {
                  "status": true,
                  "message": "3 numbers added to dialer successfully"
                }
              }
            }
          }
        }
      }
    },
    "/api/change_dialer_status": {
      "post": {
        "tags": [
          "Auto Dialer"
        ],
        "summary": "Change Dialer Status",
        "description": "Start, pause or stop an auto-dialer campaign.\n\n**How it works:** Pass the `dialerid` and the new `status`; the platform begins or halts dialing immediately.\n\n**Use it for** launching a campaign, pausing during off-hours or stopping once a target is met.",
        "operationId": "changeDialerStatus",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "dialerid",
                  "status"
                ],
                "properties": {
                  "dialerid": {
                    "type": "integer",
                    "description": "Dialer ID",
                    "example": 101
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "on",
                      "off"
                    ],
                    "description": "Status to set",
                    "example": "on"
                  }
                }
              },
              "example": {
                "dialerid": 101,
                "status": "on"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dialer status updated",
            "content": {
              "application/json": {
                "example": {
                  "status": true,
                  "message": "Dialer status changed to on"
                }
              }
            }
          }
        }
      }
    },
    "/api/customerlist": {
      "get": {
        "tags": [
          "Auto Dialer"
        ],
        "summary": "Get Customer Lists",
        "description": "List the saved customer/contact lists in your account.\n\n**How it works:** Send your `token` to retrieve every contact list with its name and ID.\n\n**Use it for** choosing an audience when building a campaign.",
        "operationId": "getCustomerLists",
        "responses": {
          "200": {
            "description": "List of customer lists",
            "content": {
              "application/json": {
                "example": {
                  "status": 200,
                  "data": [
                    {
                      "id": 1,
                      "name": "December Leads",
                      "count": 1500,
                      "created_at": "2024-12-01 10:00:00"
                    },
                    {
                      "id": 2,
                      "name": "Premium Customers",
                      "count": 350,
                      "created_at": "2024-11-15 14:30:00"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/create_customerlist": {
      "post": {
        "tags": [
          "Auto Dialer"
        ],
        "summary": "Create Customer List",
        "description": "Create a new named customer list to group contacts.\n\n**How it works:** Pass a `listname`; the API creates an empty list you can then fill with contacts.\n\n**Use it for** segmenting audiences — by city, product or campaign — before dialing.",
        "operationId": "createCustomerList",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "listname"
                ],
                "properties": {
                  "listname": {
                    "type": "string",
                    "description": "Name for the customer list",
                    "example": "January Campaign 2025"
                  }
                }
              },
              "example": {
                "listname": "January Campaign 2025"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Customer list created",
            "content": {
              "application/json": {
                "example": {
                  "status": true,
                  "message": "Customer list created successfully",
                  "list_id": 15
                }
              }
            }
          }
        }
      }
    },
    "/api/create_text_dialer": {
      "post": {
        "tags": [
          "Auto Dialer"
        ],
        "summary": "Create Text Dialer",
        "description": "Create an outbound text-to-speech dialer campaign.\n\n**How it works:** Define the `name`, `did_no`, calls-per-attempt (`no_of_call`), calling window (`start_time`/`end_time`) and the `text_template_id` to speak. The campaign is created ready for numbers.\n\n**Use it for** setting up recurring TTS broadcasts — reminders, offers or alerts.",
        "operationId": "createTextDialer",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "did_no",
                  "no_of_call",
                  "start_time",
                  "end_time",
                  "text_template_id"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Dialer campaign name",
                    "example": "Order Confirmation Dialer"
                  },
                  "did_no": {
                    "type": "string",
                    "description": "DID number to use",
                    "example": "+911143104567"
                  },
                  "no_of_call": {
                    "type": "integer",
                    "description": "Number of concurrent calls",
                    "example": 5
                  },
                  "start_time": {
                    "type": "string",
                    "description": "Start time (24Hr format HH:mm)",
                    "example": "09:00"
                  },
                  "end_time": {
                    "type": "string",
                    "description": "End time (24Hr format HH:mm)",
                    "example": "18:00"
                  },
                  "text_template_id": {
                    "type": "integer",
                    "description": "Text template ID to use",
                    "example": 101
                  },
                  "send_call_flow_id": {
                    "type": "integer",
                    "description": "Call flow ID for language (Kannada: 5421, Tamil: 5422, English: 102, Telugu: 5423)",
                    "example": 102
                  }
                }
              },
              "example": {
                "name": "Order Confirmation Dialer",
                "did_no": "+911143104567",
                "no_of_call": 5,
                "start_time": "09:00",
                "end_time": "18:00",
                "text_template_id": 101,
                "send_call_flow_id": 102
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Text dialer created",
            "content": {
              "application/json": {
                "example": {
                  "status": true,
                  "message": "Text dialer created successfully",
                  "dialer_id": 105
                }
              }
            }
          }
        }
      }
    },
    "/api/edit_text_dialer": {
      "post": {
        "tags": [
          "Auto Dialer"
        ],
        "summary": "Edit Text Dialer",
        "description": "Update the settings of an existing text-to-speech dialer.\n\n**How it works:** Pass the dialer `id` with any fields to change — `name`, `did_no`, calling window or `text_template_id`.\n\n**Use it for** retuning a campaign's hours, message or pace without recreating it.",
        "operationId": "editTextDialer",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id"
                ],
                "properties": {
                  "id": {
                    "type": "integer",
                    "description": "Dialer ID to edit",
                    "example": 105
                  },
                  "name": {
                    "type": "string",
                    "description": "Dialer campaign name"
                  },
                  "did_no": {
                    "type": "string",
                    "description": "DID number to use"
                  },
                  "no_of_call": {
                    "type": "integer",
                    "description": "Number of concurrent calls"
                  },
                  "start_time": {
                    "type": "string",
                    "description": "Start time (24Hr format HH:mm)"
                  },
                  "end_time": {
                    "type": "string",
                    "description": "End time (24Hr format HH:mm)"
                  },
                  "text_template_id": {
                    "type": "integer",
                    "description": "Text template ID to use"
                  }
                }
              },
              "example": {
                "id": 105,
                "name": null,
                "did_no": null,
                "no_of_call": null,
                "start_time": null,
                "end_time": null,
                "text_template_id": null
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Text dialer updated",
            "content": {
              "application/json": {
                "example": {
                  "status": true,
                  "message": "Dialer updated successfully"
                }
              }
            }
          }
        }
      }
    },
    "/api/enable_disable_users": {
      "post": {
        "tags": [
          "Agents"
        ],
        "summary": "Activate / Deactivate Agents",
        "description": "Turn an agent extension on or off.\n\n**How it works:** Pass the `ext_no` and the desired `status`; a disabled agent can't make or receive calls until re-enabled.\n\n**Use it for** suspending agents who've left a shift, are offboarding or are temporarily blocked.",
        "operationId": "enableDisableUsers",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "ext_no",
                  "status"
                ],
                "properties": {
                  "ext_no": {
                    "type": "string",
                    "description": "Agent extension number",
                    "example": "2101"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "0",
                      "1"
                    ],
                    "description": "0 for disable, 1 for enable",
                    "example": "1"
                  }
                }
              },
              "example": {
                "ext_no": "2101",
                "status": "1"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Agent status updated",
            "content": {
              "application/json": {
                "examples": {
                  "enabled": {
                    "summary": "Agent enabled",
                    "value": {
                      "status": true,
                      "message": "Agent enabled successfully"
                    }
                  },
                  "disabled": {
                    "summary": "Agent disabled",
                    "value": {
                      "status": true,
                      "message": "Agent disabled successfully"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/ivrappv2/addagent": {
      "post": {
        "tags": [
          "Agents"
        ],
        "summary": "Add Agent",
        "description": "Create a new agent with a login and extension.\n\n**How it works:** Pass `name`, `email`, `phonenumber` and `password`; the agent is provisioned and can sign in to take calls.\n\n**Use it for** onboarding new team members programmatically from your HR or admin tool.",
        "operationId": "addAgent",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "email",
                  "phonenumber",
                  "password"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Agent's full name",
                    "example": "John Doe"
                  },
                  "email": {
                    "type": "string",
                    "format": "email",
                    "description": "Agent's email address",
                    "example": "john.doe@company.com"
                  },
                  "phonenumber": {
                    "type": "string",
                    "description": "Agent's phone number (10 digits)",
                    "example": "9876543210"
                  },
                  "password": {
                    "type": "string",
                    "description": "Agent's login password (must contain uppercase, lowercase, number, special char)",
                    "example": "SecurePass@123"
                  }
                }
              },
              "example": {
                "name": "John Doe",
                "email": "john.doe@company.com",
                "phonenumber": "9876543210",
                "password": "SecurePass@123"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Agent created successfully",
            "content": {
              "application/json": {
                "example": {
                  "status": true,
                  "message": "Agent added successfully",
                  "data": {
                    "agent_id": 456,
                    "ext_no": "2105",
                    "name": "John Doe",
                    "email": "john.doe@company.com"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "examples": {
                  "weak_password": {
                    "summary": "Weak password",
                    "value": {
                      "status": false,
                      "message": "Password must have one uppercase, one lowercase, one number and one special character"
                    }
                  },
                  "duplicate_phone": {
                    "summary": "Duplicate phone",
                    "value": {
                      "status": false,
                      "message": "Phone number already exits."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/ivrappv2/update_agent_did": {
      "post": {
        "tags": [
          "Agents"
        ],
        "summary": "Update Agent DID",
        "description": "Assign or change the DID number tied to an agent.\n\n**How it works:** Pass the `agent_ext` and the `did_num`; outbound calls from that agent then show the new DID.\n\n**Use it for** giving agents local caller IDs or moving numbers between team members.",
        "operationId": "updateAgentDid",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "agent_ext",
                  "did_num"
                ],
                "properties": {
                  "agent_ext": {
                    "type": "string",
                    "description": "Agent extension number",
                    "example": "2101"
                  },
                  "did_num": {
                    "type": "string",
                    "description": "DID number to assign",
                    "example": "+911143104567"
                  }
                }
              },
              "example": {
                "agent_ext": "2101",
                "did_num": "+911143104567"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Agent DID updated",
            "content": {
              "application/json": {
                "example": {
                  "status": true,
                  "message": "Agent DID updated successfully"
                }
              }
            }
          }
        }
      }
    },
    "/api/call_logs": {
      "post": {
        "tags": [
          "Call Logs"
        ],
        "summary": "Get Call Logs",
        "description": "Fetch your full call history for a date range.\n\n**How it works:** Pass `from_date` and `to_date`; the API returns calls across click-to-call, dialer and inbound with status and timing.\n\n**Use it for** reporting, reconciliation and syncing call activity into your CRM.",
        "operationId": "getCallLogs",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "from_date": {
                    "type": "string",
                    "format": "date",
                    "description": "Start date (YYYY-MM-DD)",
                    "example": "2024-12-01"
                  },
                  "to_date": {
                    "type": "string",
                    "format": "date",
                    "description": "End date (YYYY-MM-DD)",
                    "example": "2024-12-31"
                  }
                }
              },
              "example": {
                "from_date": "2024-12-01",
                "to_date": "2024-12-31"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Call logs retrieved",
            "content": {
              "application/json": {
                "example": {
                  "status": 200,
                  "data": [
                    {
                      "recordid": 12345,
                      "did_no": "+911143104567",
                      "client_no": "9876543210",
                      "agent_no": "9123456789",
                      "attended_by": "John Doe",
                      "ext_no": "2101",
                      "call_time": "2024-12-15 10:30:45",
                      "call_duration": 185,
                      "call_status": "answered",
                      "call_type": "inbound",
                      "recording_url": "https://calls.ivrsolutions.in/monitor/2024/12/15/rec_12345.mp3",
                      "dtmf_input": "1"
                    },
                    {
                      "recordid": 12346,
                      "did_no": "+911143104567",
                      "client_no": "9876543211",
                      "agent_no": "9123456788",
                      "attended_by": "Jane Smith",
                      "ext_no": "2102",
                      "call_time": "2024-12-15 11:15:22",
                      "call_duration": 92,
                      "call_status": "answered",
                      "call_type": "inbound",
                      "recording_url": "https://calls.ivrsolutions.in/monitor/2024/12/15/rec_12346.mp3",
                      "dtmf_input": ""
                    }
                  ]
                }
              }
            }
          },
          "405": {
            "description": "No records found",
            "content": {
              "application/json": {
                "example": {
                  "status": 405,
                  "message": "No records found"
                }
              }
            }
          }
        }
      }
    },
    "/api/calllog_by_number": {
      "get": {
        "tags": [
          "Call Logs"
        ],
        "summary": "Get Call Logs by Number",
        "description": "Look up all calls involving a specific phone number.\n\n**How it works:** Pass your `token` and the `phone`; the API returns every log entry for that number.\n\n**Use it for** showing a contact's call history on their profile screen.",
        "operationId": "getCallLogByNumber",
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "phone",
            "in": "query",
            "required": true,
            "description": "Phone number to search",
            "schema": {
              "type": "string"
            },
            "example": "9876543210"
          }
        ],
        "responses": {
          "200": {
            "description": "Call logs for the number",
            "content": {
              "application/json": {
                "example": {
                  "status": 200,
                  "data": [
                    {
                      "recordid": 12345,
                      "did_no": "+911143104567",
                      "client_no": "9876543210",
                      "attended_by": "John Doe",
                      "call_time": "2024-12-15 10:30:45",
                      "call_duration": 185,
                      "call_type": "inbound",
                      "recording_url": "https://calls.ivrsolutions.in/monitor/2024/12/15/rec_12345.mp3"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Caller not found",
            "content": {
              "application/json": {
                "example": {
                  "status": 404,
                  "message": "caller Not Found"
                }
              }
            }
          }
        }
      }
    },
    "/api/click_to_call_log": {
      "post": {
        "tags": [
          "Call Logs"
        ],
        "summary": "Get Click-to-Call Logs",
        "description": "Fetch logs specific to click-to-call (agent↔customer bridge) calls.\n\n**How it works:** Call the endpoint to get click-to-call records with connection status and duration.\n\n**Use it for** measuring callback success and agent response on click-to-call.",
        "operationId": "getC2CLogs",
        "responses": {
          "200": {
            "description": "Click-to-call logs retrieved",
            "content": {
              "application/json": {
                "example": {
                  "status": 200,
                  "data": [
                    {
                      "recordid": 56789,
                      "did_no": "+911143104567",
                      "agent_no": "9123456789",
                      "client_no": "9876543210",
                      "agent_name": "John Doe",
                      "call_time": "2024-12-15 14:22:10",
                      "call_duration": 245,
                      "call_status": "answered",
                      "recording_url": "https://calls.ivrsolutions.in/monitor/c2c/2024/12/15/c2c_56789.mp3"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/c2clog_by_number": {
      "get": {
        "tags": [
          "Call Logs"
        ],
        "summary": "Get Click-to-Call Logs by Number",
        "description": "Look up click-to-call records for one phone number.\n\n**How it works:** Pass your `token` and the `phone` to get that number's click-to-call history.\n\n**Use it for** tracing a specific customer's callback attempts.",
        "operationId": "getC2CLogByNumber",
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "phone",
            "in": "query",
            "required": true,
            "description": "Phone number to search",
            "schema": {
              "type": "string"
            },
            "example": "9876543210"
          }
        ],
        "responses": {
          "200": {
            "description": "Click-to-call logs for the number",
            "content": {
              "application/json": {
                "example": {
                  "status": 200,
                  "data": [
                    {
                      "recordid": 56789,
                      "did_no": "+911143104567",
                      "agent_no": "9123456789",
                      "client_no": "9876543210",
                      "call_time": "2024-12-15 14:22:10",
                      "call_duration": 245,
                      "recording_url": "https://calls.ivrsolutions.in/monitor/c2c/2024/12/15/c2c_56789.mp3"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/dialer_logs": {
      "post": {
        "tags": [
          "Call Logs"
        ],
        "summary": "Get Dialer Logs",
        "description": "Fetch the results of an auto-dialer campaign.\n\n**How it works:** Pass the `dialerid` to get every attempted call with answer status, keypresses and outcome.\n\n**Use it for** reconciling campaign delivery and acting on customer responses.",
        "operationId": "getDialerLogs",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "dialerid": {
                    "type": "integer",
                    "description": "Filter by specific dialer ID (optional)",
                    "example": 101
                  }
                }
              },
              "example": {
                "dialerid": 101
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dialer logs retrieved",
            "content": {
              "application/json": {
                "example": {
                  "status": 200,
                  "data": [
                    {
                      "id": 78901,
                      "dialer_id": 101,
                      "dialer_name": "Order Confirmation Campaign",
                      "customer_no": "9876543210",
                      "call_time": "2024-12-15 10:05:30",
                      "call_duration": 45,
                      "call_status": "answered",
                      "dtmf_input": "1",
                      "attempts": 1
                    },
                    {
                      "id": 78902,
                      "dialer_id": 101,
                      "dialer_name": "Order Confirmation Campaign",
                      "customer_no": "9876543211",
                      "call_time": "2024-12-15 10:06:15",
                      "call_duration": 0,
                      "call_status": "no_answer",
                      "dtmf_input": "",
                      "attempts": 2
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/get_call_status": {
      "get": {
        "tags": [
          "Call Logs"
        ],
        "summary": "Get Call Status Options",
        "description": "Get the list of call status values you can filter by or set on records.\n\n**How it works:** Send your `token` to retrieve the supported status labels (e.g. answered, missed, busy).\n\n**Use it for** building status filters and dropdowns in your dashboard.",
        "operationId": "getCallStatus",
        "responses": {
          "200": {
            "description": "List of call status options",
            "content": {
              "application/json": {
                "example": {
                  "status": true,
                  "data": [
                    {
                      "id": 1,
                      "name": "Interested"
                    },
                    {
                      "id": 2,
                      "name": "Not Interested"
                    },
                    {
                      "id": 3,
                      "name": "Call Back Later"
                    },
                    {
                      "id": 4,
                      "name": "Wrong Number"
                    },
                    {
                      "id": 5,
                      "name": "DND"
                    },
                    {
                      "id": 6,
                      "name": "Converted"
                    },
                    {
                      "id": 7,
                      "name": "Follow Up Required"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/update_call_note": {
      "post": {
        "tags": [
          "Call Logs"
        ],
        "summary": "Update Call Remark",
        "description": "Attach a status and note to a call record.\n\n**How it works:** Pass the `record_id` with `call_status`, `call_type` and `call_remark`; the record is updated for reporting.\n\n**Use it for** logging dispositions — interested, callback, wrong number — against each call.",
        "operationId": "updateCallNote",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "record_id",
                  "call_status",
                  "call_type"
                ],
                "properties": {
                  "record_id": {
                    "type": "string",
                    "description": "Record ID from call_log API or webhook",
                    "example": "12345"
                  },
                  "call_status": {
                    "type": "integer",
                    "description": "Status ID from get_call_status API",
                    "example": 1
                  },
                  "call_type": {
                    "type": "string",
                    "enum": [
                      "incoming",
                      "outgoing",
                      "c2c",
                      "dialer"
                    ],
                    "description": "Type of call",
                    "example": "incoming"
                  },
                  "call_remark": {
                    "type": "string",
                    "description": "Remark or note for the call (optional)",
                    "example": "Customer interested in premium plan. Follow up next week."
                  }
                }
              },
              "example": {
                "record_id": "12345",
                "call_status": 1,
                "call_type": "incoming",
                "call_remark": "Customer interested in premium plan. Follow up next week."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Call remark updated",
            "content": {
              "application/json": {
                "example": {
                  "status": true,
                  "message": "Call note updated successfully"
                }
              }
            }
          }
        }
      }
    },
    "/ivrappv2/get_dids": {
      "post": {
        "tags": [
          "DID"
        ],
        "summary": "Get Linked DIDs",
        "description": "List the DID (virtual) numbers linked to your account.\n\n**How it works:** Call the endpoint to retrieve every DID you own with its details.\n\n**Use it for** populating caller-ID pickers and auditing your number inventory.",
        "operationId": "getLinkedDids",
        "responses": {
          "200": {
            "description": "List of linked DIDs",
            "content": {
              "application/json": {
                "example": {
                  "status": true,
                  "data": [
                    {
                      "did_number": "+911143104567",
                      "region": "Delhi",
                      "status": "active",
                      "type": "landline"
                    },
                    {
                      "did_number": "+918043104568",
                      "region": "Bangalore",
                      "status": "active",
                      "type": "landline"
                    },
                    {
                      "did_number": "+911onal60123",
                      "region": "Toll-Free",
                      "status": "active",
                      "type": "tollfree"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/ivrappv2/get_did_region": {
      "get": {
        "tags": [
          "DID"
        ],
        "summary": "Get DID Regions",
        "description": "List the regions where DID numbers are available to buy.\n\n**How it works:** Send your `token` to get the regions you can search and purchase numbers in.\n\n**Use it for** driving a region selector before searching for a number.",
        "operationId": "getDidRegions",
        "responses": {
          "200": {
            "description": "List of available regions",
            "content": {
              "application/json": {
                "example": {
                  "status": true,
                  "message": "Region found successfully",
                  "data": [
                    {
                      "id": 1,
                      "name": "Delhi",
                      "code": "011"
                    },
                    {
                      "id": 2,
                      "name": "Bangalore",
                      "code": "080"
                    },
                    {
                      "id": 3,
                      "name": "Mumbai",
                      "code": "022"
                    },
                    {
                      "id": 4,
                      "name": "Chennai",
                      "code": "044"
                    },
                    {
                      "id": 5,
                      "name": "Hyderabad",
                      "code": "040"
                    },
                    {
                      "id": 6,
                      "name": "Faridabad",
                      "code": "0129"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/ivrappv2/search_dids": {
      "post": {
        "tags": [
          "DID"
        ],
        "summary": "Search Available DIDs",
        "description": "Search for DID numbers available to purchase.\n\n**How it works:** Pass `country_code`, `region` and an optional `search_pattern`; the API returns matching available numbers.\n\n**Use it for** letting customers pick a local or vanity number to buy.",
        "operationId": "searchDids",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "country_code",
                  "region"
                ],
                "properties": {
                  "country_code": {
                    "type": "string",
                    "description": "Country code",
                    "example": "IN"
                  },
                  "region": {
                    "type": "string",
                    "description": "Region ID (1: Delhi, 2: Bangalore, 6: Faridabad)",
                    "example": "1"
                  },
                  "search_pattern": {
                    "type": "string",
                    "enum": [
                      "startswith",
                      "contains",
                      "endswith"
                    ],
                    "description": "Search pattern type (optional)"
                  },
                  "pattern": {
                    "type": "string",
                    "description": "Pattern to search (optional)",
                    "example": "4310"
                  }
                }
              },
              "example": {
                "country_code": "IN",
                "region": "1",
                "search_pattern": null,
                "pattern": "4310"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Available DIDs matching criteria",
            "content": {
              "application/json": {
                "example": {
                  "status": true,
                  "message": "Numbers found",
                  "cost": "500",
                  "currency": "INR",
                  "data": [
                    "+911143104501",
                    "+911143104502",
                    "+911143104503",
                    "+911143104504",
                    "+911143104505"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "No numbers found",
            "content": {
              "application/json": {
                "example": {
                  "status": false,
                  "message": "No numbers found"
                }
              }
            }
          }
        }
      }
    },
    "/ivrappv2/buy_did": {
      "post": {
        "tags": [
          "DID"
        ],
        "summary": "Buy DID",
        "description": "Purchase a DID number and add it to your account.\n\n**How it works:** Pass the `country` and the chosen `number`; the platform provisions it and links it to you.\n\n**Use it for** self-serving new local presence or campaign numbers.",
        "operationId": "buyDid",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "country",
                  "number"
                ],
                "properties": {
                  "country": {
                    "type": "string",
                    "description": "Country code",
                    "example": "IN"
                  },
                  "number": {
                    "type": "string",
                    "description": "DID number to purchase",
                    "example": "+911143104501"
                  }
                }
              },
              "example": {
                "country": "IN",
                "number": "+911143104501"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "DID purchased successfully",
            "content": {
              "application/json": {
                "example": {
                  "status": true,
                  "message": "Did added to your account",
                  "data": "+911143104501"
                }
              }
            }
          },
          "400": {
            "description": "Insufficient balance",
            "content": {
              "application/json": {
                "example": {
                  "status": false,
                  "message": "Insufficient balance"
                }
              }
            }
          }
        }
      }
    },
    "/api/click_to_call": {
      "post": {
        "tags": [
          "Click to Call"
        ],
        "x-internal": true,
        "x-scalar-ignore": true,
        "summary": "Click To Call (legacy)",
        "operationId": "click_to_call",
        "description": "Click To Call (legacy)",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "agent_email": {
                    "type": "string",
                    "example": "agent@company.com"
                  },
                  "agent_no": {
                    "type": "string",
                    "example": "09123456789"
                  },
                  "client_no": {
                    "type": "string",
                    "example": "09876543210"
                  },
                  "country_code": {
                    "type": "string",
                    "example": "+91"
                  },
                  "record_id": {
                    "type": "string",
                    "example": "12345"
                  },
                  "record_type": {
                    "type": "string",
                    "example": "lead"
                  }
                }
              },
              "example": {
                "agent_email": "agent@company.com",
                "agent_no": "09123456789",
                "client_no": "09876543210",
                "country_code": "+91",
                "record_id": "12345",
                "record_type": "lead"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/api/c2c_advance": {
      "post": {
        "tags": [
          "Click to Call"
        ],
        "summary": "Click To Call (advanced)",
        "operationId": "c2c_advance",
        "description": "Bridge two numbers with extra control — a spoken intro, scheduling and explicit first/second legs.\n\n**How it works:** Pass the `did`, `first_phone` and `second_phone` (and optional `body` message, `schedule_datetime`/`timezone`). The platform calls the first leg, optionally plays the message, then dials and bridges the second.\n\n**Use it for** scheduled callbacks, whisper announcements before connect and custom two-party bridges.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "body": {
                    "type": "string",
                    "example": "Hello, connecting your call"
                  },
                  "did": {
                    "type": "string",
                    "example": "+911143104567"
                  },
                  "first_phone": {
                    "type": "string",
                    "example": "+919876543210"
                  },
                  "schedule_datetime": {
                    "type": "string",
                    "example": "2025-12-31 13:00:00"
                  },
                  "second_phone": {
                    "type": "string",
                    "example": "+919123456789"
                  },
                  "timezone": {
                    "type": "string",
                    "example": "Asia/Kolkata"
                  }
                },
                "required": [
                  "did",
                  "first_phone",
                  "second_phone"
                ]
              },
              "example": {
                "body": "Hello, connecting your call",
                "did": "+911143104567",
                "first_phone": "+919876543210",
                "schedule_datetime": "2025-12-31 13:00:00",
                "second_phone": "+919123456789",
                "timezone": "Asia/Kolkata"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/api/click_connect_update": {
      "post": {
        "tags": [
          "Number Masking"
        ],
        "summary": "Manage a masked-call session",
        "operationId": "click_connect_update",
        "description": "Update or cancel a live number-masking (Click-Connect) session.\n\n**How it works:** Identify the session with `did` and `first_number`, then pass an `action` (e.g. `cancel`) and optional `body` message to change or drop the connection.\n\n**Use it for** ending a masked call early or adjusting a session in flight.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "example": "cancel"
                  },
                  "body": {
                    "type": "string",
                    "example": "Hello, connecting your call"
                  },
                  "did": {
                    "type": "string",
                    "example": "+911143104567"
                  },
                  "first_number": {
                    "type": "string",
                    "example": "+919876543210"
                  }
                },
                "required": [
                  "action",
                  "did",
                  "first_number"
                ]
              },
              "example": {
                "action": "cancel",
                "body": "Hello, connecting your call",
                "did": "+911143104567",
                "first_number": "+919876543210"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/api/click_connect_logs": {
      "post": {
        "tags": [
          "Number Masking"
        ],
        "summary": "Masked-call logs",
        "operationId": "click_connect_logs",
        "description": "Fetch logs for your number-masking (Click-Connect) sessions.\n\n**How it works:** Pass an optional `did` and `from_date`/`to_date` range; the API returns who connected, when and for how long.\n\n**Use it for** auditing privacy-masked conversations and reconciling marketplace calls.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "did": {
                    "type": "string",
                    "example": "+911143104567"
                  },
                  "from_date": {
                    "type": "string",
                    "example": "2025-08-01"
                  },
                  "orderby": {
                    "type": "string",
                    "example": "desc"
                  },
                  "to_date": {
                    "type": "string",
                    "example": "2025-08-31"
                  }
                }
              },
              "example": {
                "did": "+911143104567",
                "from_date": "2025-08-01",
                "orderby": "desc",
                "to_date": "2025-08-31"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/api/get_voicebot": {
      "post": {
        "tags": [
          "Voice Bots"
        ],
        "summary": "List voice bots",
        "operationId": "get_voicebot",
        "description": "List the AI voice bots configured in your account.\n\n**How it works:** Call the endpoint to get each bot with its ID, so you can reference one when placing AI calls.\n\n**Use it for** populating a bot selector before dialing with an AI agent.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        },
        "externalDocs": {
          "description": "WSS Telephony Bridge guide",
          "url": "https://github.com/Founders-Cart/IVR-Solutions-WSS-Telephony-Bridge"
        }
      }
    },
    "/api/dial_by_aivoicebot": {
      "post": {
        "tags": [
          "Voice Bots"
        ],
        "summary": "Dial by AI voice bot",
        "operationId": "dial_by_aivoicebot",
        "description": "Place an outbound call answered by an AI voice bot over your WebSocket bridge.\n\n**How it works:** Pass the `customer_no` and a `wss_url` (plus optional `system_msg`, `sttlanguage_code` and `wss_header`). The call connects to your WebSocket for real-time, two-way audio — speech-to-text in, audio out, with in-call transfers and DTMF.\n\n**Use it for** AI receptionists, lead qualification calls and conversational reminders.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "Voicechat_id": {
                    "type": "string",
                    "example": "4821",
                    "description": "ID of the configured voice bot to use"
                  },
                  "ai_agent_ext": {
                    "type": "string",
                    "example": "2101",
                    "description": "Agent extension to bridge for hybrid (bot + human) routing"
                  },
                  "connect_ws_after_answer": {
                    "type": "string",
                    "description": "Connect the WebSocket only after the call is answered (\"0\" or \"1\")",
                    "example": "1"
                  },
                  "customer_no": {
                    "type": "string",
                    "example": "09876543210",
                    "description": "Customer phone number to call (prefix 0 or use country code)"
                  },
                  "schedule_datetime": {
                    "type": "string",
                    "example": "2025-12-31 13:00:00",
                    "description": "Optional schedule time, format \"YYYY-mm-dd H:i:s\""
                  },
                  "sip_url": {
                    "type": "string",
                    "example": "sip:bot@example.com",
                    "description": "SIP target the bot can transfer/bridge to"
                  },
                  "sttlanguage_code": {
                    "type": "string",
                    "example": "en-IN",
                    "description": "Speech-to-text language code, e.g. en-IN, hi-IN"
                  },
                  "system_msg": {
                    "type": "string",
                    "example": "You are a helpful assistant.",
                    "description": "System prompt that defines the AI agent’s behaviour"
                  },
                  "text": {
                    "type": "string",
                    "example": "Hi, this is an automated call.",
                    "description": "Optional opening line the bot speaks when the call connects"
                  },
                  "timezone": {
                    "type": "string",
                    "example": "Asia/Kolkata",
                    "description": "Timezone for scheduling, e.g. Asia/Kolkata"
                  },
                  "wss_header": {
                    "type": "string",
                    "example": "Authorization: Bearer xyz",
                    "description": "Header sent when the bridge connects to your WSS endpoint, e.g. \"Authorization: Bearer YOUR_TOKEN\""
                  },
                  "wss_url": {
                    "type": "string",
                    "example": "wss://example.com/stream",
                    "description": "Your WebSocket Secure (WSS) endpoint the call audio streams to/from, e.g. wss://your-bot.example.com/voice"
                  }
                }
              },
              "example": {
                "Voicechat_id": "4821",
                "ai_agent_ext": "2101",
                "connect_ws_after_answer": "1",
                "customer_no": "09876543210",
                "schedule_datetime": "2025-12-31 13:00:00",
                "sip_url": "sip:bot@example.com",
                "sttlanguage_code": "en-IN",
                "system_msg": "You are a helpful assistant.",
                "text": "Hi, this is an automated call.",
                "timezone": "Asia/Kolkata",
                "wss_header": "Authorization: Bearer xyz",
                "wss_url": "wss://example.com/stream"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        },
        "externalDocs": {
          "description": "WSS Telephony Bridge guide",
          "url": "https://github.com/Founders-Cart/IVR-Solutions-WSS-Telephony-Bridge"
        }
      }
    },
    "/api/dial_by_voicebot": {
      "post": {
        "tags": [
          "Voice Bots"
        ],
        "summary": "Dial by voice bot",
        "operationId": "dial_by_voicebot",
        "description": "Place an outbound call handled by a pre-built voice bot.\n\n**How it works:** Pass the `customer_no`, `did_num` and the `Voicechat_id` (with optional `system_msg`/`text`). The platform dials and runs the chosen bot.\n\n**Use it for** running a saved conversational bot without wiring up your own WebSocket.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "Voicechat_id": {
                    "type": "string",
                    "example": "4821",
                    "description": "ID of the configured voice bot to use"
                  },
                  "customer_no": {
                    "type": "string",
                    "example": "09876543210",
                    "description": "Customer phone number to call (prefix 0 or use country code)"
                  },
                  "did_num": {
                    "type": "string",
                    "example": "+911143104567",
                    "description": "Your DID number to place the call from"
                  },
                  "schedule_datetime": {
                    "type": "string",
                    "example": "2025-12-31 13:00:00",
                    "description": "Optional schedule time, format \"YYYY-mm-dd H:i:s\""
                  },
                  "system_msg": {
                    "type": "string",
                    "example": "You are a helpful assistant.",
                    "description": "System prompt that defines the AI agent’s behaviour"
                  },
                  "text": {
                    "type": "string",
                    "example": "Hi, this is an automated call.",
                    "description": "Optional opening line the bot speaks when the call connects"
                  },
                  "timezone": {
                    "type": "string",
                    "example": "Asia/Kolkata",
                    "description": "Timezone for scheduling, e.g. Asia/Kolkata"
                  }
                }
              },
              "example": {
                "Voicechat_id": "4821",
                "customer_no": "09876543210",
                "did_num": "+911143104567",
                "schedule_datetime": "2025-12-31 13:00:00",
                "system_msg": "You are a helpful assistant.",
                "text": "Hi, this is an automated call.",
                "timezone": "Asia/Kolkata"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        },
        "externalDocs": {
          "description": "WSS Telephony Bridge guide",
          "url": "https://github.com/Founders-Cart/IVR-Solutions-WSS-Telephony-Bridge"
        }
      }
    },
    "/api/create_text_template": {
      "post": {
        "tags": [
          "Text Templates"
        ],
        "summary": "Create text template",
        "operationId": "create_text_template",
        "description": "Create a reusable text-to-speech template.\n\n**How it works:** Pass a `template_name` and the `text_content` (with variable placeholders); it's saved for use by TTS dialers.\n\n**Use it for** standardizing OTP, reminder and alert scripts across campaigns.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "template_name": {
                    "type": "string",
                    "example": "api_order_confirm"
                  },
                  "text_content": {
                    "type": "string",
                    "example": "Press 1 to confirm your order."
                  }
                }
              },
              "example": {
                "template_name": "api_order_confirm",
                "text_content": "Press 1 to confirm your order."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/api/check_text_template_status": {
      "post": {
        "tags": [
          "Text Templates"
        ],
        "summary": "Check text template status",
        "operationId": "check_text_template_status",
        "description": "Check whether a text template is approved and ready to use.\n\n**How it works:** Pass the `template_name` to get its current status.\n\n**Use it for** confirming a template is live before launching a dependent campaign.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "template_name": {
                    "type": "string",
                    "example": "api_order_confirm"
                  }
                }
              },
              "example": {
                "template_name": "api_order_confirm"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/api/get_text_template_list": {
      "get": {
        "tags": [
          "Text Templates"
        ],
        "summary": "List text templates",
        "operationId": "get_text_template_list",
        "description": "List your text-to-speech templates.\n\n**How it works:** Send your `token` to retrieve every template with its name and status.\n\n**Use it for** showing a template picker when building TTS dialers.",
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": false,
            "description": "API token (alternative to Bearer header)",
            "schema": {
              "type": "string"
            },
            "example": "YOUR_API_TOKEN"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/api/add_contact": {
      "post": {
        "tags": [
          "Contacts"
        ],
        "summary": "Add contact",
        "operationId": "add_contact",
        "description": "Save a contact to your address book.\n\n**How it works:** Pass `name`, `number` and `country_code`; the contact is stored for lookups and screen-pops.\n\n**Use it for** syncing CRM contacts so agents see names on incoming calls.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "country_code": {
                    "type": "string",
                    "example": "+91"
                  },
                  "name": {
                    "type": "string",
                    "example": "John Doe"
                  },
                  "number": {
                    "type": "string",
                    "example": "09876543210"
                  }
                }
              },
              "example": {
                "country_code": "+91",
                "name": "John Doe",
                "number": "09876543210"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/api/get_contact_info": {
      "post": {
        "tags": [
          "Contacts"
        ],
        "summary": "Get contact info by number",
        "operationId": "get_contact_info",
        "description": "Look up a saved contact by phone number.\n\n**How it works:** Pass the `phone` to get the matching contact's stored details.\n\n**Use it for** caller-ID screen-pops and click-to-dial lookups.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "phone": {
                    "type": "string",
                    "example": "09876543210"
                  }
                }
              },
              "example": {
                "phone": "09876543210"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/api/get_contact_info_agent": {
      "post": {
        "tags": [
          "Contacts"
        ],
        "summary": "Get contact info (agent context)",
        "operationId": "get_contact_info_agent",
        "description": "Look up a contact in the calling agent's context.\n\n**How it works:** Pass the `phone` to resolve the contact as visible to the agent handling the call.\n\n**Use it for** powering agent screen-pops scoped to their own contacts.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "phone": {
                    "type": "string",
                    "example": "09876543210"
                  }
                }
              },
              "example": {
                "phone": "09876543210"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/api/get_variables": {
      "get": {
        "tags": [
          "Contacts"
        ],
        "summary": "List call/template variables",
        "operationId": "get_variables",
        "description": "List the variables available for call flows and text templates.\n\n**How it works:** Send your `token` to get the variable keys you can insert into messages and flows.\n\n**Use it for** showing available merge fields when authoring templates.",
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": false,
            "description": "API token (alternative to Bearer header)",
            "schema": {
              "type": "string"
            },
            "example": "YOUR_API_TOKEN"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/api/get_agents": {
      "get": {
        "tags": [
          "Agents"
        ],
        "summary": "List agents",
        "operationId": "get_agents",
        "description": "List the agents in your account.\n\n**How it works:** Send your `token` to retrieve all agents with their extensions and status.\n\n**Use it for** team dashboards and looking up an extension before assigning calls.",
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": false,
            "description": "API token (alternative to Bearer header)",
            "schema": {
              "type": "string"
            },
            "example": "YOUR_API_TOKEN"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/api/get_extension": {
      "post": {
        "tags": [
          "Agents"
        ],
        "summary": "List extensions",
        "operationId": "get_extension",
        "description": "List all extensions configured in your account.\n\n**How it works:** Call the endpoint to get every extension with its owner and state.\n\n**Use it for** mapping extensions to agents and building routing UIs.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/api/get_extension_details": {
      "post": {
        "tags": [
          "Agents"
        ],
        "summary": "Get extension details",
        "operationId": "get_extension_details",
        "description": "Get the full configuration of a single extension.\n\n**How it works:** Pass the `ext_no` to retrieve its settings, owner and assigned DID.\n\n**Use it for** showing or editing one extension's setup.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ext_no": {
                    "type": "string",
                    "example": "2101"
                  }
                }
              },
              "example": {
                "ext_no": "2101"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/api/deactivate_group_user": {
      "post": {
        "tags": [
          "Agents"
        ],
        "summary": "Deactivate extension user",
        "operationId": "deactivate_group_user",
        "description": "Deactivate the user on a group extension.\n\n**How it works:** Pass the `ext_no`; that user can no longer use the extension until reactivated.\n\n**Use it for** revoking access when someone leaves a shared line or team.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ext_no": {
                    "type": "string",
                    "example": "2101"
                  }
                }
              },
              "example": {
                "ext_no": "2101"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/api/set_expiry": {
      "post": {
        "tags": [
          "Agents"
        ],
        "summary": "Set extension expiry",
        "operationId": "set_expiry",
        "description": "Set an expiry date on an extension.\n\n**How it works:** Pass the `ext_no` and `expiry_date`; the extension auto-disables after that date.\n\n**Use it for** temporary agents, trials and contractor access.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expiry_date": {
                    "type": "string",
                    "example": "2025-12-31"
                  },
                  "ext_no": {
                    "type": "string",
                    "example": "2101"
                  }
                }
              },
              "example": {
                "expiry_date": "2025-12-31",
                "ext_no": "2101"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/api/add_group_user": {
      "post": {
        "tags": [
          "Agents"
        ],
        "summary": "Add group user / extension",
        "operationId": "add_group_user",
        "description": "Create a new group extension with its user and call settings.\n\n**How it works:** Pass `name`, `extn_no`, `password` and options like `did_no`, `call_forwarding`, `expiry_date` and `kyc_required`; the extension is provisioned ready to take calls.\n\n**Use it for** onboarding team members onto shared DIDs with the right routing.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "call_forwarding": {
                    "type": "string",
                    "description": "Flag: \"0\" or \"1\"",
                    "example": "1"
                  },
                  "connection": {
                    "type": "string",
                    "description": "Flag: \"0\" or \"1\"",
                    "example": "1"
                  },
                  "did_no": {
                    "type": "string",
                    "example": "+911143104567"
                  },
                  "email": {
                    "type": "string",
                    "example": "user@company.com"
                  },
                  "expiry_date": {
                    "type": "string",
                    "example": "2025-12-31"
                  },
                  "extn_no": {
                    "type": "string",
                    "example": "2101"
                  },
                  "kyc_required": {
                    "type": "string",
                    "description": "Flag: \"0\" or \"1\"",
                    "example": "0"
                  },
                  "name": {
                    "type": "string",
                    "example": "John Doe"
                  },
                  "password": {
                    "type": "string",
                    "example": "SecurePass@123"
                  },
                  "phone": {
                    "type": "string",
                    "example": "09876543210"
                  },
                  "recording_id": {
                    "type": "string",
                    "example": "2207"
                  }
                },
                "required": [
                  "call_forwarding",
                  "connection",
                  "did_no",
                  "password",
                  "recording_id"
                ]
              },
              "example": {
                "call_forwarding": "1",
                "connection": "1",
                "did_no": "+911143104567",
                "email": "user@company.com",
                "expiry_date": "2025-12-31",
                "extn_no": "2101",
                "kyc_required": "0",
                "name": "John Doe",
                "password": "SecurePass@123",
                "phone": "09876543210",
                "recording_id": "2207"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/api/get_dids": {
      "post": {
        "tags": [
          "DID"
        ],
        "summary": "List linked DIDs",
        "operationId": "get_dids",
        "description": "List the DID numbers linked to your account.\n\n**How it works:** Call the endpoint to retrieve every DID with its status and assignment.\n\n**Use it for** auditing numbers and choosing caller IDs.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/api/get_available_dids": {
      "post": {
        "tags": [
          "DID"
        ],
        "summary": "Search available DIDs",
        "operationId": "get_available_dids",
        "description": "Search for purchasable DID numbers by region and pattern.\n\n**How it works:** Pass `did_region`, `availabilty_level`, `pattern_last_digits` and `size` to get matching available numbers.\n\n**Use it for** offering customers a choice of local or memorable numbers.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "availabilty_level": {
                    "type": "string",
                    "example": "1"
                  },
                  "did_region": {
                    "type": "string",
                    "example": "1"
                  },
                  "pattern_last_digits": {
                    "type": "string",
                    "example": "4310"
                  },
                  "size": {
                    "type": "string",
                    "example": "20"
                  }
                }
              },
              "example": {
                "availabilty_level": "1",
                "did_region": "1",
                "pattern_last_digits": "4310",
                "size": "20"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/api/add_manage_did": {
      "post": {
        "tags": [
          "DID"
        ],
        "summary": "Provision & manage DID",
        "operationId": "add_manage_did",
        "description": "Provision and configure a DID — routing, owner and options — in one call.\n\n**How it works:** Pass `did_no` with settings like `extn_no`, `call_forwarding`, `connection`, `expiry_date` and `kyc_required` to set up or update the number.\n\n**Use it for** fully automating number onboarding and routing changes.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "call_forwarding": {
                    "type": "string",
                    "description": "Flag: \"0\" or \"1\"",
                    "example": "1"
                  },
                  "connection": {
                    "type": "string",
                    "description": "Flag: \"0\" or \"1\"",
                    "example": "1"
                  },
                  "did_no": {
                    "type": "string",
                    "example": "+911143104567"
                  },
                  "email": {
                    "type": "string",
                    "example": "user@company.com"
                  },
                  "expiry_date": {
                    "type": "string",
                    "example": "2025-12-31"
                  },
                  "extn_no": {
                    "type": "string",
                    "example": "2101"
                  },
                  "kyc_required": {
                    "type": "string",
                    "description": "Flag: \"0\" or \"1\"",
                    "example": "0"
                  },
                  "name": {
                    "type": "string",
                    "example": "John Doe"
                  },
                  "password": {
                    "type": "string",
                    "example": "SecurePass@123"
                  },
                  "phone": {
                    "type": "string",
                    "example": "09876543210"
                  },
                  "recording_id": {
                    "type": "string",
                    "example": "2207"
                  }
                },
                "required": [
                  "call_forwarding",
                  "connection",
                  "password",
                  "recording_id"
                ]
              },
              "example": {
                "call_forwarding": "1",
                "connection": "1",
                "did_no": "+911143104567",
                "email": "user@company.com",
                "expiry_date": "2025-12-31",
                "extn_no": "2101",
                "kyc_required": "0",
                "name": "John Doe",
                "password": "SecurePass@123",
                "phone": "09876543210",
                "recording_id": "2207"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/api/manage_group_did": {
      "post": {
        "tags": [
          "DID"
        ],
        "summary": "Manage group DID",
        "operationId": "manage_group_did",
        "description": "Configure a DID shared by a group or team.\n\n**How it works:** Pass `did_no` with the group's settings — `call_forwarding`, `connection`, `expiry_date` and `kyc_required` — to manage the shared number.\n\n**Use it for** running a team hotline or department line by API.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "call_forwarding": {
                    "type": "string",
                    "description": "Flag: \"0\" or \"1\"",
                    "example": "1"
                  },
                  "connection": {
                    "type": "string",
                    "description": "Flag: \"0\" or \"1\"",
                    "example": "1"
                  },
                  "did_no": {
                    "type": "string",
                    "example": "+911143104567"
                  },
                  "expiry_date": {
                    "type": "string",
                    "example": "2025-12-31"
                  },
                  "extn_no": {
                    "type": "string",
                    "example": "2101"
                  },
                  "kyc_required": {
                    "type": "string",
                    "description": "Flag: \"0\" or \"1\"",
                    "example": "0"
                  },
                  "name": {
                    "type": "string",
                    "example": "John Doe"
                  },
                  "password": {
                    "type": "string",
                    "example": "SecurePass@123"
                  },
                  "recording_id": {
                    "type": "string",
                    "example": "2207"
                  }
                },
                "required": [
                  "call_forwarding",
                  "connection",
                  "kyc_required",
                  "password",
                  "recording_id"
                ]
              },
              "example": {
                "call_forwarding": "1",
                "connection": "1",
                "did_no": "+911143104567",
                "expiry_date": "2025-12-31",
                "extn_no": "2101",
                "kyc_required": "0",
                "name": "John Doe",
                "password": "SecurePass@123",
                "recording_id": "2207"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/api/manage_group_did_as_sipuser": {
      "post": {
        "tags": [
          "DID"
        ],
        "summary": "Manage group DID (SIP user)",
        "operationId": "manage_group_did_as_sipuser",
        "description": "Configure a group DID for a SIP / softphone user.\n\n**How it works:** Pass `did_no` with the SIP user's details (`email`, `phone`) and routing options to provision them on the shared number.\n\n**Use it for** putting softphone or WebRTC agents on a shared DID.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "call_forwarding": {
                    "type": "string",
                    "description": "Flag: \"0\" or \"1\"",
                    "example": "1"
                  },
                  "connection": {
                    "type": "string",
                    "description": "Flag: \"0\" or \"1\"",
                    "example": "1"
                  },
                  "did_no": {
                    "type": "string",
                    "example": "+911143104567"
                  },
                  "email": {
                    "type": "string",
                    "example": "user@company.com"
                  },
                  "expiry_date": {
                    "type": "string",
                    "example": "2025-12-31"
                  },
                  "extn_no": {
                    "type": "string",
                    "example": "2101"
                  },
                  "kyc_required": {
                    "type": "string",
                    "description": "Flag: \"0\" or \"1\"",
                    "example": "0"
                  },
                  "name": {
                    "type": "string",
                    "example": "John Doe"
                  },
                  "password": {
                    "type": "string",
                    "example": "SecurePass@123"
                  },
                  "phone": {
                    "type": "string",
                    "example": "09876543210"
                  },
                  "recording_id": {
                    "type": "string",
                    "example": "2207"
                  }
                },
                "required": [
                  "call_forwarding",
                  "connection",
                  "kyc_required",
                  "password",
                  "recording_id"
                ]
              },
              "example": {
                "call_forwarding": "1",
                "connection": "1",
                "did_no": "+911143104567",
                "email": "user@company.com",
                "expiry_date": "2025-12-31",
                "extn_no": "2101",
                "kyc_required": "0",
                "name": "John Doe",
                "password": "SecurePass@123",
                "phone": "09876543210",
                "recording_id": "2207"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/api/get_live_did": {
      "post": {
        "tags": [
          "DID"
        ],
        "summary": "Get live DID status",
        "operationId": "get_live_did",
        "description": "Check the live status of your DID numbers.\n\n**How it works:** Send your `token` to see which DIDs are active and reachable right now.\n\n**Use it for** uptime dashboards and routing health checks.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "token": {
                    "type": "string",
                    "description": "API token (alternative to the Bearer header)",
                    "example": "YOUR_API_TOKEN"
                  }
                }
              },
              "example": {
                "token": "YOUR_API_TOKEN"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/api/get_live_did_agent": {
      "post": {
        "tags": [
          "DID"
        ],
        "summary": "Get live DID status (agent)",
        "operationId": "get_live_did_agent",
        "description": "Check live DID status in the agent's context.\n\n**How it works:** Send your `token` to get the agent's DIDs and their current state.\n\n**Use it for** showing agents whether their lines are live.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "token": {
                    "type": "string",
                    "description": "API token (alternative to the Bearer header)",
                    "example": "YOUR_API_TOKEN"
                  }
                }
              },
              "example": {
                "token": "YOUR_API_TOKEN"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/api/add_webhook_url": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Register webhook URL",
        "operationId": "add_webhook_url",
        "description": "Register a URL to receive real-time call events.\n\n**How it works:** Pass your `webhookurl` and a `secret_key`; the platform POSTs events — rings, answers, hangups, DTMF — to that URL, signed with your key.\n\n**Use it for** syncing call state into your app, triggering automations and verifying payloads.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "secret_key": {
                    "type": "string",
                    "example": "whsec_abc123"
                  },
                  "webhookurl": {
                    "type": "string",
                    "example": "https://yourapp.com/webhooks/ivr"
                  }
                }
              },
              "example": {
                "secret_key": "whsec_abc123",
                "webhookurl": "https://yourapp.com/webhooks/ivr"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/api/get_data_for_leadcrm": {
      "post": {
        "tags": [
          "Integrations"
        ],
        "summary": "Get Lead CRM data",
        "operationId": "get_data_for_leadcrm",
        "description": "Fetch lead data formatted for CRM integration.\n\n**How it works:** Call the endpoint to pull lead and call data ready to push into your CRM.\n\n**Use it for** feeding leads and call outcomes into your sales pipeline.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/api/add_to_dialer": {
      "post": {
        "tags": [
          "Auto Dialer"
        ],
        "summary": "Add records to dialer (bulk)",
        "operationId": "add_to_dialer",
        "description": "Add a batch of records to a dialer campaign.\n\n**How it works:** Pass a `recordList` array of contacts; all are queued for dialing in one call.\n\n**Use it for** bulk-loading leads from a form, sheet or nightly export.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "recordList": {
                    "type": "array",
                    "description": "List of records to dial",
                    "items": {
                      "type": "object"
                    },
                    "example": [
                      {
                        "number": "09876543210",
                        "name": "John Doe"
                      }
                    ]
                  }
                }
              },
              "example": {
                "recordList": [
                  {
                    "number": "09876543210",
                    "name": "John Doe"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/v1/all_call_logs": {
      "post": {
        "tags": [
          "Call Logs"
        ],
        "summary": "Fetch all call logs (incremental)",
        "operationId": "v1_all_call_logs",
        "description": "Pull new call logs since your last sync, across all call types.\n\n**How it works:** Pass the last seen IDs (`last_c2c_log_id`, `last_call_log_id`, `last_dialer_log_id`); the API returns only newer records so you never refetch.\n\n**Use it for** efficient incremental syncs into a data warehouse or CRM.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "last_c2c_log_id": {
                    "type": "string",
                    "description": "Last click-to-call log id you have",
                    "example": "0"
                  },
                  "last_call_log_id": {
                    "type": "string",
                    "description": "Last call log id you have",
                    "example": "0"
                  },
                  "last_dialer_log_id": {
                    "type": "string",
                    "description": "Last dialer log id you have",
                    "example": "0"
                  }
                }
              },
              "example": {
                "last_c2c_log_id": "0",
                "last_call_log_id": "0",
                "last_dialer_log_id": "0"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/v1/add_note": {
      "post": {
        "tags": [
          "Call Logs"
        ],
        "summary": "Add a note to a call",
        "operationId": "v1_add_note",
        "description": "Attach a note and status to a specific call.\n\n**How it works:** Pass the `sip_call_id` with the `note`, `call_type` and `status` to annotate that call.\n\n**Use it for** logging dispositions and context against individual calls.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sip_call_id": {
                    "type": "string",
                    "description": "SIP call id of the call",
                    "example": "abc123.45@sip"
                  },
                  "note": {
                    "type": "string",
                    "description": "Note text",
                    "example": "Customer requested a callback"
                  },
                  "call_type": {
                    "type": "string",
                    "description": "incoming | outgoing | c2c | dialer",
                    "example": "c2c"
                  },
                  "status": {
                    "type": "string",
                    "description": "Call status code",
                    "example": "1"
                  }
                },
                "required": [
                  "sip_call_id",
                  "note"
                ]
              },
              "example": {
                "sip_call_id": "abc123.45@sip",
                "note": "Customer requested a callback",
                "call_type": "c2c",
                "status": "1"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/v1/Caller_info": {
      "post": {
        "tags": [
          "Contacts"
        ],
        "summary": "Look up caller info",
        "operationId": "v1_Caller_info",
        "description": "Resolve details about an inbound caller.\n\n**How it works:** Pass the `caller_number` to get any stored contact and history for that caller.\n\n**Use it for** instant screen-pops the moment a call rings.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "caller_number": {
                    "type": "string",
                    "description": "Phone number to look up",
                    "example": "09876543210"
                  }
                },
                "required": [
                  "caller_number"
                ]
              },
              "example": {
                "caller_number": "09876543210"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/v1/click_to_call_record": {
      "post": {
        "tags": [
          "Click to Call"
        ],
        "summary": "Click-to-call recordings",
        "operationId": "v1_click_to_call_record",
        "description": "Retrieve recordings for click-to-call calls.\n\n**How it works:** Call the endpoint to get recording references for bridged click-to-call calls.\n\n**Use it for** QA, training and compliance review of callbacks.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/v1/get_voicebots": {
      "post": {
        "tags": [
          "Voice Bots"
        ],
        "summary": "List voice bots",
        "operationId": "v1_get_voicebots",
        "description": "List your AI voice bots.\n\n**How it works:** Call the endpoint to get each bot with its ID and metadata.\n\n**Use it for** choosing a bot when configuring AI calls.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/v1/get_voicebot_data": {
      "post": {
        "tags": [
          "Voice Bots"
        ],
        "summary": "Get voice bot data",
        "operationId": "v1_get_voicebot_data",
        "description": "Get a voice bot's configuration and training data.\n\n**How it works:** Pass the `voicebot_id` (and the `aitraingdata` flag) to retrieve its setup and knowledge.\n\n**Use it for** inspecting or syncing a bot's training before deploying it.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "voicebot_id": {
                    "type": "string",
                    "description": "Voice bot id",
                    "example": "4821"
                  },
                  "aitraingdata": {
                    "type": "string",
                    "description": "Include AI training data (0|1)",
                    "example": "1"
                  }
                },
                "required": [
                  "voicebot_id"
                ]
              },
              "example": {
                "voicebot_id": "4821",
                "aitraingdata": "1"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/v1/agent_login_token": {
      "post": {
        "tags": [
          "Agents"
        ],
        "x-internal": true,
        "x-scalar-ignore": true,
        "summary": "Generate agent login token",
        "operationId": "v1_agent_login_token",
        "description": "Generate a login token and SIP/WebRTC credentials for embedding an agent softphone in your app.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "token": {
                    "type": "string",
                    "description": "API token",
                    "example": "YOUR_API_TOKEN"
                  },
                  "username": {
                    "type": "string",
                    "description": "Agent username",
                    "example": "agent@company.com"
                  },
                  "password": {
                    "type": "string",
                    "description": "Agent password",
                    "example": "SecurePass@123"
                  },
                  "extention": {
                    "type": "string",
                    "description": "Agent extension",
                    "example": "2101"
                  },
                  "ip_address": {
                    "type": "string",
                    "description": "Caller IP (allow-listed)",
                    "example": "203.0.113.10"
                  }
                },
                "required": [
                  "token",
                  "username",
                  "password"
                ]
              },
              "example": {
                "token": "YOUR_API_TOKEN",
                "username": "agent@company.com",
                "password": "SecurePass@123",
                "extention": "2101",
                "ip_address": "203.0.113.10"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    },
    "/v1/dial_by_flow_get": {
      "post": {
        "tags": [
          "Auto Dialer"
        ],
        "summary": "Dial by flow (query style)",
        "operationId": "v1_dial_by_flow_get",
        "description": "Trigger a flow-based outbound call with simple query parameters.\n\n**How it works:** Pass your `token`, `did`, `flow` and `phone` (with optional `body`); the platform dials the number and plays the flow.\n\n**Use it for** webhook actions and links that can only send query parameters.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "token": {
                    "type": "string",
                    "description": "API token",
                    "example": "YOUR_API_TOKEN"
                  },
                  "did": {
                    "type": "string",
                    "description": "Your DID number",
                    "example": "+911143104567"
                  },
                  "flow": {
                    "type": "string",
                    "description": "Call flow id",
                    "example": "1001"
                  },
                  "phone": {
                    "type": "string",
                    "description": "Customer number",
                    "example": "09876543210"
                  },
                  "body": {
                    "type": "string",
                    "description": "Optional call body",
                    "example": ""
                  }
                },
                "required": [
                  "token",
                  "did",
                  "flow",
                  "phone"
                ]
              },
              "example": {
                "token": "YOUR_API_TOKEN",
                "did": "+911143104567",
                "flow": "1001",
                "phone": "09876543210",
                "body": ""
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing token"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Enter your API token. Get it from your IVR Solutions dashboard."
      },
      "QueryAuth": {
        "type": "apiKey",
        "in": "query",
        "name": "token",
        "description": "API token as query parameter (alternative to Bearer auth)"
      }
    },
    "schemas": {
      "ClickToCallResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "integer",
            "example": 200
          },
          "message": {
            "type": "string",
            "example": "Call connecting. Please wait..."
          },
          "logid": {
            "type": "integer",
            "description": "Log ID for tracking the call",
            "example": 123456
          }
        }
      },
      "SuccessResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "boolean",
            "example": true
          },
          "message": {
            "type": "string",
            "example": "Operation completed successfully"
          },
          "data": {
            "type": "object",
            "description": "Response data (varies by endpoint)"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "status": {
            "oneOf": [
              {
                "type": "boolean"
              },
              {
                "type": "integer"
              }
            ],
            "example": false
          },
          "message": {
            "type": "string",
            "example": "Error description"
          }
        }
      },
      "CallLog": {
        "type": "object",
        "properties": {
          "recordid": {
            "type": "integer",
            "description": "Unique call record ID",
            "example": 12345
          },
          "did_no": {
            "type": "string",
            "description": "DID number used",
            "example": "+911143104567"
          },
          "client_no": {
            "type": "string",
            "description": "Customer phone number",
            "example": "9876543210"
          },
          "agent_no": {
            "type": "string",
            "description": "Agent phone number",
            "example": "9123456789"
          },
          "attended_by": {
            "type": "string",
            "description": "Agent name who attended",
            "example": "John Doe"
          },
          "ext_no": {
            "type": "string",
            "description": "Agent extension number",
            "example": "2101"
          },
          "call_time": {
            "type": "string",
            "description": "Call timestamp",
            "example": "2024-12-15 10:30:45"
          },
          "call_duration": {
            "type": "integer",
            "description": "Duration in seconds",
            "example": 185
          },
          "call_status": {
            "type": "string",
            "description": "Call status",
            "enum": [
              "answered",
              "no_answer",
              "busy",
              "failed"
            ],
            "example": "answered"
          },
          "call_type": {
            "type": "string",
            "enum": [
              "inbound",
              "outbound",
              "c2c",
              "dialer"
            ],
            "example": "inbound"
          },
          "recording_url": {
            "type": "string",
            "description": "URL to call recording",
            "example": "https://calls.ivrsolutions.in/monitor/2024/12/15/rec_12345.mp3"
          },
          "dtmf_input": {
            "type": "string",
            "description": "DTMF keys pressed by caller",
            "example": "1"
          }
        }
      },
      "Dialer": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "example": 101
          },
          "name": {
            "type": "string",
            "example": "Order Confirmation Campaign"
          },
          "did_no": {
            "type": "string",
            "example": "+911143104567"
          },
          "status": {
            "type": "string",
            "enum": [
              "on",
              "off"
            ],
            "example": "on"
          },
          "start_time": {
            "type": "string",
            "example": "09:00"
          },
          "end_time": {
            "type": "string",
            "example": "18:00"
          },
          "no_of_calls": {
            "type": "integer",
            "description": "Concurrent calls",
            "example": 5
          },
          "total_numbers": {
            "type": "integer",
            "example": 1250
          },
          "completed": {
            "type": "integer",
            "example": 890
          },
          "pending": {
            "type": "integer",
            "example": 360
          }
        }
      },
      "Agent": {
        "type": "object",
        "properties": {
          "agent_id": {
            "type": "integer",
            "example": 456
          },
          "ext_no": {
            "type": "string",
            "example": "2101"
          },
          "name": {
            "type": "string",
            "example": "John Doe"
          },
          "email": {
            "type": "string",
            "example": "john.doe@company.com"
          },
          "phone": {
            "type": "string",
            "example": "9876543210"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "inactive"
            ],
            "example": "active"
          }
        }
      },
      "DID": {
        "type": "object",
        "properties": {
          "did_number": {
            "type": "string",
            "example": "+911143104567"
          },
          "region": {
            "type": "string",
            "example": "Delhi"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "inactive"
            ],
            "example": "active"
          },
          "type": {
            "type": "string",
            "enum": [
              "landline",
              "tollfree",
              "mobile"
            ],
            "example": "landline"
          }
        }
      }
    }
  },
  "externalDocs": {
    "description": "IVR Solutions — website & dashboard",
    "url": "https://www.ivrsolutions.in"
  }
}