{
  "info": {
    "name": "KokilCloud Public API",
    "description": "Voice OTP API. Set your own recipient and API key before sending. POST creates a real, potentially billable call. Use a fresh idempotencyKey per new verification; keep it for retries. voiceId is optional: omit for the system default (initially Bangla), or use 1001 / 1002. IDs are listed in Dashboard > Voices > OTP voices.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://api.kokilcloud.com/v1"
    },
    {
      "key": "apiKey",
      "value": "YOUR_API_KEY"
    },
    {
      "key": "phone",
      "value": "YOUR_RECIPIENT_NUMBER"
    },
    {
      "key": "otp",
      "value": "482913"
    },
    {
      "key": "idempotencyKey",
      "value": "YOUR_UNIQUE_VERIFICATION_ID"
    },
    {
      "key": "callId",
      "value": "YOUR_CALL_ID"
    }
  ],
  "auth": {
    "type": "apikey",
    "apikey": [
      {
        "key": "key",
        "value": "X-API-Key",
        "type": "string"
      },
      {
        "key": "value",
        "value": "{{apiKey}}",
        "type": "string"
      },
      {
        "key": "in",
        "value": "header",
        "type": "string"
      }
    ]
  },
  "item": [
    {
      "name": "Send an OTP Call",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          },
          {
            "key": "Idempotency-Key",
            "value": "{{idempotencyKey}}"
          }
        ],
        "url": "{{baseUrl}}/otp-call",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"phone\": \"{{phone}}\",\n  \"otp\": \"{{otp}}\",\n  \"repeatCount\": 2\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      },
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "if (pm.response.code === 202) {",
              "  const result = pm.response.json();",
              "  if (result.callId) pm.collectionVariables.set(\"callId\", result.callId);",
              "}"
            ]
          }
        }
      ]
    },
    {
      "name": "Get Call Status",
      "request": {
        "method": "GET",
        "header": [],
        "url": "{{baseUrl}}/calls/{{callId}}"
      }
    }
  ]
}
