{
  "openapi": "3.1.0",
  "info": {
    "title": "NaCaller API",
    "version": "1.2.0",
    "summary": "Phone verification (Miss OTP, Voice OTP) and AI calling (agents, calls, campaigns) for India.",
    "description": "Two surfaces share one host. /api/v1 is the developer API (calls, agents, campaigns, results). /api/verify is phone verification.\n\nKEYS. Create keys in the dashboard under Settings, Developers. All are server secrets: send as `Authorization: Bearer <key>`, never in browser code.\n- `nc_live_...` account key with scopes `otp`, `calls`, `campaigns`, `read` (read = GET only), `agents` (create and edit agents and keypad flows, always as drafts) and `billing_link` (ask for a top-up link a person opens to pay). Presets: OTP only, Calling, Read only, Full access (the only preset with `agents` and `billing_link`). A key made before scopes existed holds calls, campaigns and read, never otp, agents or billing_link.\n- `nc_test_...` test key: the same API, simulated. It validates exactly like a live key but never rings a phone, never uses credits or the wallet and stores nothing. Results carry `test: true`. The OTP code is always 123456.\n- `nck_live_...` site verification key for /api/verify only (one per site). Unchanged.\n\nERRORS. /api/v1 and nc_ keys on /api/verify answer `{ \"error\": { \"code\", \"message\" } }`. /api/verify with an nck_ key keeps `{ \"error\": \"message\" }` and adds top-level `code` and `message`.\n\nCalls go out 9 am to 9 pm India time. Do-not-call numbers are never dialled. Indian mobile numbers only.\n\nDRAFT-FIRST. An agent or keypad flow created or edited with a live key is saved as a draft (`status: \"draft\"`, `needs_activation: true`). A draft cannot place calls, run campaigns or answer a number: those answer `agent_draft` (409). Only a person can activate it, with the Activate button on the Agents page in the dashboard; there is no API call for that, and no delete.\n\nMONEY. No endpoint charges, debits or moves money. `POST /api/v1/balance/topup-link` only returns a link to the dashboard that a person opens, signed in, to review and pay.",
    "contact": {
      "name": "NaCaller",
      "url": "https://nacaller.com/docs/ai-agents"
    }
  },
  "servers": [
    {
      "url": "https://api.nacaller.com"
    }
  ],
  "tags": [
    {
      "name": "Agents"
    },
    {
      "name": "Agent builder"
    },
    {
      "name": "Calls"
    },
    {
      "name": "Campaigns"
    },
    {
      "name": "Verification"
    },
    {
      "name": "Balance"
    }
  ],
  "externalDocs": {
    "description": "Docs for people and AI agents",
    "url": "https://nacaller.com/docs/ai-agents"
  },
  "components": {
    "securitySchemes": {
      "accountKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "nc_live_ or nc_test_ key. Scope needed is listed on each operation."
      },
      "siteKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "nck_live_ site verification key (/api/verify only)."
      }
    },
    "schemas": {
      "V1Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "description": "Machine-readable code."
              },
              "message": {
                "type": "string",
                "description": "Human-readable."
              },
              "required_scope": {
                "type": "string",
                "description": "Present on insufficient_scope."
              },
              "key_scopes": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "min_inr": {
                "type": "integer",
                "description": "Present on a top-up amount error."
              },
              "max_inr": {
                "type": "integer",
                "description": "Present on a top-up amount error."
              }
            },
            "required": [
              "code",
              "message"
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "VerifyError": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string",
            "description": "The message (kept for older clients)."
          },
          "code": {
            "type": "string",
            "description": "invalid_phone, invalid_method, incorrect_code, invalid_api_key, insufficient_credits, not_found, code_expired, rate_limited, unavailable, upstream_error, internal_error"
          },
          "message": {
            "type": "string",
            "description": "Same text as error."
          },
          "verified": {
            "type": "boolean"
          },
          "attemptsLeft": {
            "type": "integer"
          },
          "test": {
            "type": "boolean"
          }
        },
        "required": [
          "error"
        ]
      },
      "Agent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "language": {
            "type": [
              "string",
              "null"
            ],
            "description": "Language capabilities of the agent."
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "paused",
              "draft"
            ],
            "description": "draft = saved through the API and waiting for a person to activate it."
          }
        },
        "required": [
          "id",
          "name"
        ]
      },
      "Variables": {
        "type": "object",
        "maxProperties": 20,
        "propertyNames": {
          "pattern": "^[a-z0-9_]{1,40}$"
        },
        "additionalProperties": {
          "type": [
            "string",
            "number"
          ]
        },
        "description": "Merge fields for the agent script, e.g. {\"fee_amount\":\"4500\"}."
      },
      "CallRequest": {
        "type": "object",
        "properties": {
          "agent_id": {
            "type": "string"
          },
          "phone": {
            "type": "string",
            "description": "Indian mobile, e.g. +919876543210."
          },
          "name": {
            "type": "string",
            "maxLength": 80
          },
          "variables": {
            "$ref": "#/components/schemas/Variables"
          },
          "language": {
            "type": "string",
            "description": "Language code or name."
          }
        },
        "required": [
          "agent_id",
          "phone"
        ]
      },
      "CallCreated": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "const": "initiated"
          },
          "agent_id": {
            "type": "string"
          },
          "to": {
            "type": "string"
          },
          "test": {
            "type": "boolean",
            "description": "true for a test key."
          }
        },
        "required": [
          "id",
          "status"
        ]
      },
      "Call": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "agent_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "campaign_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "direction": {
            "type": "string"
          },
          "to": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "outcome": {
            "type": [
              "string",
              "null"
            ]
          },
          "outcome_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "hangup_cause": {
            "type": [
              "string",
              "null"
            ]
          },
          "summary": {
            "type": [
              "string",
              "null"
            ]
          },
          "sentiment": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "label": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "score": {
                "type": [
                  "number",
                  "null"
                ]
              }
            }
          },
          "lead_score": {
            "type": [
              "number",
              "null"
            ]
          },
          "duration_seconds": {
            "type": "integer"
          },
          "captured": {
            "type": "object"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "answered_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "completed_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "test": {
            "type": "boolean"
          }
        },
        "required": [
          "id"
        ]
      },
      "CallDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Call"
          },
          {
            "type": "object",
            "properties": {
              "transcript": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "recording_url": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Signed link, valid 10 minutes."
              },
              "recording_url_expires_at": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": []
          }
        ]
      },
      "CallList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Call"
            }
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "data",
          "has_more"
        ]
      },
      "AgentList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Agent"
            }
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "data",
          "has_more"
        ]
      },
      "Contact": {
        "type": "object",
        "properties": {
          "phone": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "maxLength": 80
          },
          "variables": {
            "$ref": "#/components/schemas/Variables"
          }
        },
        "required": [
          "phone"
        ]
      },
      "CampaignRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 100
          },
          "agent_id": {
            "type": "string"
          },
          "contacts": {
            "type": "array",
            "minItems": 1,
            "maxItems": 10000,
            "items": {
              "$ref": "#/components/schemas/Contact"
            }
          },
          "language": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "agent_id",
          "contacts"
        ]
      },
      "CampaignCreated": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "agent_id": {
            "type": "string"
          },
          "contacts": {
            "type": "integer"
          },
          "skipped_opted_out": {
            "type": "integer"
          },
          "starts_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "test": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "name",
          "status"
        ]
      },
      "CampaignDryRun": {
        "type": "object",
        "properties": {
          "dry_run": {
            "type": "boolean",
            "const": true
          },
          "would_succeed": {
            "type": "boolean"
          },
          "blockers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "contacts": {
            "type": "object",
            "properties": {
              "received": {
                "type": "integer"
              },
              "valid": {
                "type": "integer"
              },
              "invalid": {
                "type": "integer"
              },
              "duplicates": {
                "type": "integer"
              },
              "opted_out": {
                "type": "integer"
              },
              "dialable": {
                "type": "integer"
              }
            },
            "required": []
          },
          "estimated_cost_inr": {
            "type": "object",
            "properties": {
              "low": {
                "type": "number"
              },
              "high": {
                "type": "number"
              },
              "rate_per_minute_inr": {
                "type": "number"
              },
              "assumptions": {
                "type": "object",
                "description": "answer_rate_low/high, billed_minutes_low/high and a note. Plan minutes are used first, so real cost can be lower."
              }
            },
            "required": []
          },
          "wallet": {
            "type": "object",
            "properties": {
              "covers_estimate": {
                "type": "boolean",
                "description": "Whether the wallet covers the HIGH estimate."
              },
              "shortfall_inr": {
                "type": "number"
              }
            },
            "required": []
          },
          "calling_hours": {
            "type": "object",
            "properties": {
              "window": {
                "type": "string"
              },
              "open_now": {
                "type": "boolean"
              },
              "next_open": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": []
          },
          "limits": {
            "type": "object",
            "properties": {
              "key_calls_remaining_today": {
                "type": "integer"
              },
              "key_daily_call_limit": {
                "type": "integer"
              },
              "max_attempts_per_contact_per_day": {
                "type": "integer"
              }
            },
            "required": []
          },
          "test": {
            "type": "boolean"
          }
        },
        "required": [
          "dry_run",
          "would_succeed",
          "contacts",
          "estimated_cost_inr",
          "wallet"
        ]
      },
      "CampaignResults": {
        "type": "object",
        "properties": {
          "campaign": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "language": {
                "type": "string"
              },
              "agent": {},
              "created_at": {
                "type": "string"
              }
            },
            "required": []
          },
          "totals": {
            "type": "object",
            "properties": {
              "contacts": {
                "type": "integer"
              },
              "called": {
                "type": "integer"
              },
              "answered": {
                "type": "integer"
              },
              "opted_out": {
                "type": "integer"
              }
            },
            "required": []
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "contact_id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "phone": {
                  "type": "string"
                },
                "status": {},
                "outcome": {},
                "opted_out": {
                  "type": "boolean"
                },
                "attempts": {
                  "type": "integer"
                },
                "talk_seconds": {
                  "type": "integer"
                },
                "last_call_at": {},
                "tags": {},
                "summary": {},
                "captured": {},
                "variables": {}
              },
              "required": []
            }
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "test": {
            "type": "boolean"
          }
        },
        "required": []
      },
      "VerifyStartRequest": {
        "type": "object",
        "properties": {
          "phone": {
            "type": "string",
            "description": "10-digit Indian mobile (6-9), or +91 form."
          },
          "method": {
            "type": "string",
            "enum": [
              "missed_call",
              "voice"
            ],
            "default": "missed_call"
          },
          "language": {
            "type": "string",
            "enum": [
              "te",
              "hi",
              "en",
              "ta",
              "kn",
              "ml",
              "mr",
              "bn",
              "or",
              "gu"
            ],
            "default": "en",
            "description": "Voice only."
          },
          "reference": {
            "type": "string",
            "maxLength": 120
          }
        },
        "required": [
          "phone"
        ]
      },
      "MissedCallStarted": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "callNumber": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "const": "pending"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "expiresIn": {
            "type": "integer"
          },
          "instruction": {
            "type": "string"
          },
          "test": {
            "type": "boolean"
          }
        },
        "required": [
          "requestId",
          "callNumber"
        ]
      },
      "VoiceStarted": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "method": {
            "type": "string",
            "const": "voice"
          },
          "status": {
            "type": "string",
            "const": "calling"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "reference": {
            "type": "string"
          },
          "test": {
            "type": "boolean"
          },
          "test_code": {
            "type": "string",
            "description": "Test keys only: always \"123456\"."
          }
        },
        "required": [
          "id",
          "status"
        ]
      },
      "VerifyCheckRequest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "code": {
            "type": "string",
            "pattern": "^\\d{6}$"
          }
        },
        "required": [
          "id",
          "code"
        ]
      },
      "VerifyChecked": {
        "type": "object",
        "properties": {
          "verified": {
            "type": "boolean",
            "const": true
          },
          "id": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "test": {
            "type": "boolean"
          }
        },
        "required": [
          "verified"
        ]
      },
      "VerifyStatus": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string"
          },
          "method": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "verified",
              "expired"
            ]
          },
          "verified": {
            "type": "boolean"
          },
          "verifiedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "test": {
            "type": "boolean"
          }
        },
        "required": [
          "requestId",
          "status",
          "verified"
        ]
      },
      "AgentFull": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "role": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "paused",
              "draft"
            ]
          },
          "needs_activation": {
            "type": "boolean"
          },
          "activation": {
            "type": "string",
            "description": "Present on a draft: what a person has to do."
          },
          "prompt": {
            "type": "string"
          },
          "greeting": {
            "type": "string"
          },
          "personality": {
            "type": "string"
          },
          "caller_name": {
            "type": "string"
          },
          "gender": {
            "type": "string",
            "enum": [
              "feminine",
              "masculine"
            ]
          },
          "knowledge_base": {
            "type": "string"
          },
          "calling_rules": {
            "type": "string"
          },
          "booking_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "brochure_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "maps_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "languages": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "transfer_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "transfer_whisper": {
            "type": [
              "string",
              "null"
            ]
          },
          "tools": {
            "type": "array",
            "description": "Lookups the agent can call mid-call. Secrets are never returned.",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "kind": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                }
              }
            }
          },
          "created_at": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          },
          "test": {
            "type": "boolean",
            "description": "true on a test key: simulated, nothing stored."
          }
        },
        "required": [
          "id",
          "name",
          "role",
          "status",
          "needs_activation",
          "prompt"
        ]
      },
      "AgentCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 80
          },
          "role": {
            "type": "string",
            "maxLength": 80
          },
          "prompt": {
            "type": "string",
            "maxLength": 12000,
            "description": "What the agent is and how it behaves on the call."
          },
          "greeting": {
            "type": "string",
            "maxLength": 500
          },
          "personality": {
            "type": "string",
            "maxLength": 1000
          },
          "caller_name": {
            "type": "string",
            "maxLength": 40
          },
          "gender": {
            "type": "string",
            "enum": [
              "feminine",
              "masculine"
            ]
          },
          "knowledge_base": {
            "type": "string",
            "maxLength": 20000
          },
          "calling_rules": {
            "type": "string",
            "maxLength": 4000
          },
          "booking_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "https only."
          },
          "brochure_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "https only."
          },
          "maps_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "https only."
          },
          "languages": {
            "type": "array",
            "minItems": 1,
            "maxItems": 10,
            "items": {
              "type": "string"
            },
            "description": "Language names or codes: English, Hindi, Telugu, Tamil, Kannada, Malayalam, Bengali, Marathi, Gujarati (en hi te ta kn ml bn mr gu)."
          },
          "transfer_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "An Indian mobile (10 digits, 6-9) to warm-transfer a hot lead to. null clears it."
          },
          "transfer_whisper": {
            "type": "string",
            "maxLength": 200
          },
          "tools": {
            "type": "array",
            "description": "Same rules as the dashboard: https endpoints on the public internet only; a calendar tool needs one of your own connected calendars.",
            "items": {
              "type": "object"
            }
          }
        },
        "required": [
          "name",
          "role",
          "prompt"
        ]
      },
      "AgentPatch": {
        "type": "object",
        "additionalProperties": false,
        "minProperties": 1,
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 80
          },
          "role": {
            "type": "string",
            "maxLength": 80
          },
          "prompt": {
            "type": "string",
            "maxLength": 12000,
            "description": "What the agent is and how it behaves on the call."
          },
          "greeting": {
            "type": "string",
            "maxLength": 500
          },
          "personality": {
            "type": "string",
            "maxLength": 1000
          },
          "caller_name": {
            "type": "string",
            "maxLength": 40
          },
          "gender": {
            "type": "string",
            "enum": [
              "feminine",
              "masculine"
            ]
          },
          "knowledge_base": {
            "type": "string",
            "maxLength": 20000
          },
          "calling_rules": {
            "type": "string",
            "maxLength": 4000
          },
          "booking_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "https only."
          },
          "brochure_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "https only."
          },
          "maps_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "https only."
          },
          "languages": {
            "type": "array",
            "minItems": 1,
            "maxItems": 10,
            "items": {
              "type": "string"
            },
            "description": "Language names or codes: English, Hindi, Telugu, Tamil, Kannada, Malayalam, Bengali, Marathi, Gujarati (en hi te ta kn ml bn mr gu)."
          },
          "transfer_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "An Indian mobile (10 digits, 6-9) to warm-transfer a hot lead to. null clears it."
          },
          "transfer_whisper": {
            "type": "string",
            "maxLength": 200
          },
          "tools": {
            "type": "array",
            "description": "Same rules as the dashboard: https endpoints on the public internet only; a calendar tool needs one of your own connected calendars.",
            "items": {
              "type": "object"
            }
          }
        },
        "description": "Only the fields sent change. The agent goes back to draft."
      },
      "IvrFlow": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "steps"
        ],
        "description": "A keypad call: the steps play in order. A step cannot point at another one, so there are no loops or dangling references. Key 9 is always \"stop these calls\".",
        "properties": {
          "version": {
            "const": 1
          },
          "sponsor": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "description": "A map of language code to text, for example {\"en\": \"Hello\", \"hi\": \"Namaste\"}.",
                "additionalProperties": {
                  "type": "string"
                }
              }
            ]
          },
          "opt_out": {
            "type": "boolean",
            "default": true
          },
          "closing": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "description": "A map of language code to text, for example {\"en\": \"Hello\", \"hi\": \"Namaste\"}.",
                "additionalProperties": {
                  "type": "string"
                }
              }
            ]
          },
          "steps": {
            "type": "array",
            "minItems": 1,
            "maxItems": 12,
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "type",
                    "text"
                  ],
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[a-z0-9_]{1,30}$"
                    },
                    "type": {
                      "const": "say"
                    },
                    "text": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object",
                          "description": "A map of language code to text, for example {\"en\": \"Hello\", \"hi\": \"Namaste\"}.",
                          "additionalProperties": {
                            "type": "string"
                          }
                        }
                      ]
                    }
                  }
                },
                {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "type",
                    "text",
                    "options"
                  ],
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[a-z0-9_]{1,30}$"
                    },
                    "type": {
                      "const": "ask"
                    },
                    "title": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object",
                          "description": "A map of language code to text, for example {\"en\": \"Hello\", \"hi\": \"Namaste\"}.",
                          "additionalProperties": {
                            "type": "string"
                          }
                        }
                      ]
                    },
                    "text": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object",
                          "description": "A map of language code to text, for example {\"en\": \"Hello\", \"hi\": \"Namaste\"}.",
                          "additionalProperties": {
                            "type": "string"
                          }
                        }
                      ]
                    },
                    "rotate": {
                      "type": "boolean"
                    },
                    "menu_in_recording": {
                      "type": "boolean"
                    },
                    "options": {
                      "type": "array",
                      "minItems": 2,
                      "maxItems": 8,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "key",
                          "label"
                        ],
                        "properties": {
                          "key": {
                            "type": "string",
                            "pattern": "^[a-z0-9_]{1,30}$"
                          },
                          "label": {
                            "oneOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "object",
                                "description": "A map of language code to text, for example {\"en\": \"Hello\", \"hi\": \"Namaste\"}.",
                                "additionalProperties": {
                                  "type": "string"
                                }
                              }
                            ]
                          },
                          "say": {
                            "oneOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "object",
                                "description": "A map of language code to text, for example {\"en\": \"Hello\", \"hi\": \"Namaste\"}.",
                                "additionalProperties": {
                                  "type": "string"
                                }
                              }
                            ]
                          },
                          "verdict": {
                            "enum": [
                              "interested",
                              "callback",
                              "not_interested",
                              "wrong_person",
                              "do_not_call"
                            ]
                          },
                          "fixed": {
                            "type": "boolean"
                          }
                        }
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "IvrFlowCreate": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "flow"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 80
          },
          "languages": {
            "type": "array",
            "minItems": 1,
            "maxItems": 10,
            "items": {
              "type": "string"
            },
            "description": "Language names or codes: English, Hindi, Telugu, Tamil, Kannada, Malayalam, Bengali, Marathi, Gujarati (en hi te ta kn ml bn mr gu)."
          },
          "flow": {
            "$ref": "#/components/schemas/IvrFlow"
          }
        }
      },
      "IvrFlowPatch": {
        "type": "object",
        "additionalProperties": false,
        "minProperties": 1,
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 80
          },
          "languages": {
            "type": "array",
            "minItems": 1,
            "maxItems": 10,
            "items": {
              "type": "string"
            },
            "description": "Language names or codes: English, Hindi, Telugu, Tamil, Kannada, Malayalam, Bengali, Marathi, Gujarati (en hi te ta kn ml bn mr gu)."
          },
          "flow": {
            "$ref": "#/components/schemas/IvrFlow"
          }
        }
      },
      "IvrFlowObject": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "paused",
              "draft"
            ]
          },
          "needs_activation": {
            "type": "boolean"
          },
          "activation": {
            "type": "string"
          },
          "languages": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "kind": {
            "type": "string",
            "enum": [
              "survey",
              "broadcast"
            ]
          },
          "flow": {
            "$ref": "#/components/schemas/IvrFlow"
          },
          "created_at": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          },
          "test": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "name",
          "status",
          "flow"
        ]
      },
      "IvrFlowList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IvrFlowObject"
            }
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "data",
          "has_more"
        ]
      },
      "Balance": {
        "type": "object",
        "description": "The key owner's own numbers. Read only.",
        "properties": {
          "wallet": {
            "type": [
              "object",
              "null"
            ],
            "description": "null while the wallet is switched off for the account.",
            "properties": {
              "balance_inr": {
                "type": "number"
              },
              "currency": {
                "const": "INR"
              }
            }
          },
          "plan": {
            "type": "object",
            "properties": {
              "key": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "pay_as_you_go": {
                "type": "boolean"
              },
              "minutes_included": {
                "type": "integer"
              },
              "minutes_used": {
                "type": "integer"
              },
              "minutes_remaining": {
                "type": "integer"
              }
            }
          },
          "otp": {
            "type": "object",
            "properties": {
              "verification_credits": {
                "type": "integer"
              },
              "voice_credits": {
                "type": "integer"
              }
            }
          },
          "test": {
            "type": "boolean"
          }
        },
        "required": [
          "plan",
          "otp"
        ]
      },
      "TopupLinkRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "amount_inr"
        ],
        "properties": {
          "amount_inr": {
            "type": "integer",
            "minimum": 200,
            "maximum": 50000,
            "description": "Whole rupees. The same bounds as Add money in the dashboard."
          }
        }
      },
      "TopupLink": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "description": "A page in the dashboard. A person opens it signed in, checks the amount and pays there."
          },
          "amount_inr": {
            "type": "integer"
          },
          "min_inr": {
            "type": "integer"
          },
          "max_inr": {
            "type": "integer"
          },
          "charged": {
            "const": false
          },
          "note": {
            "type": "string"
          },
          "test": {
            "type": "boolean"
          }
        },
        "required": [
          "url",
          "amount_inr",
          "charged"
        ]
      }
    }
  },
  "paths": {
    "/api/v1/agents": {
      "get": {
        "tags": [
          "Agents"
        ],
        "operationId": "listAgents",
        "summary": "List agents",
        "description": "Scope: read, calls or campaigns. Id, name, language and status only. To read an agent's prompt, use GET /agents/{id} (scope agents).",
        "security": [
          {
            "accountKey": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "The next_cursor from the previous page."
          }
        ],
        "responses": {
          "200": {
            "description": "Agents",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentList"
                }
              }
            }
          },
          "400": {
            "description": "invalid_request, invalid_json, invalid_cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "401": {
            "description": "missing_api_key or invalid_api_key (also a revoked key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "403": {
            "description": "insufficient_scope (the key lacks the scope in `required_scope`), account_suspended, account_pending, phone_unverified, international_not_allowed, contact_opted_out",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited (300 requests a minute per key) or daily_limit_reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Agent builder"
        ],
        "operationId": "createAgent",
        "summary": "Create an agent (saved as a draft)",
        "security": [
          {
            "accountKey": []
          }
        ],
        "description": "Scope: agents. Saved as a DRAFT: it cannot place calls, run campaigns or answer a number until a person presses Activate on the Agents page in the dashboard. Validated with the dashboard's own rules (transfer number, tools, languages) plus the length limits shown. Counts against the plan's agent limit. With an nc_test_ key nothing is stored and the response is simulated (test: true). There is no delete endpoint.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created as a draft",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentFull"
                }
              }
            }
          },
          "400": {
            "description": "invalid_request (the message names the field; unknown fields are refused), invalid_json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "403": {
            "description": "insufficient_scope, agent_limit_reached (the plan's agent limit), account errors",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "401": {
            "description": "missing_api_key or invalid_api_key (also a revoked key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited (300 requests a minute per key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/calls": {
      "post": {
        "tags": [
          "Calls"
        ],
        "operationId": "placeCall",
        "summary": "Place one AI call",
        "description": "Scope: calls. A real call that spends the owner's minutes. With an nc_test_ key nothing is dialled and the response is simulated (test: true). 422 outside_calling_hours, 403 contact_opted_out, 402 no_minutes, 404 agent_not_found. 409 agent_draft if the agent is a draft.",
        "security": [
          {
            "accountKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CallRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Call initiated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallCreated"
                }
              }
            }
          },
          "400": {
            "description": "invalid_request, invalid_json, invalid_cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "401": {
            "description": "missing_api_key or invalid_api_key (also a revoked key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "403": {
            "description": "insufficient_scope (the key lacks the scope in `required_scope`), account_suspended, account_pending, phone_unverified, international_not_allowed, contact_opted_out",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "404": {
            "description": "agent_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "422": {
            "description": "outside_calling_hours",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited (300 requests a minute per key) or daily_limit_reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "409": {
            "description": "agent_draft (the agent was saved through the API and has not been activated), calling_paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Calls"
        ],
        "operationId": "listCalls",
        "summary": "List calls, newest first",
        "description": "Scope: read or calls. A test key lists only its own simulated calls.",
        "security": [
          {
            "accountKey": []
          }
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "agent_id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "campaign_id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "The next_cursor from the previous page."
          }
        ],
        "responses": {
          "200": {
            "description": "Calls",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallList"
                }
              }
            }
          },
          "400": {
            "description": "invalid_request, invalid_json, invalid_cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "401": {
            "description": "missing_api_key or invalid_api_key (also a revoked key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "403": {
            "description": "insufficient_scope (the key lacks the scope in `required_scope`), account_suspended, account_pending, phone_unverified, international_not_allowed, contact_opted_out",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited (300 requests a minute per key) or daily_limit_reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/calls/{id}": {
      "get": {
        "tags": [
          "Calls"
        ],
        "operationId": "getCall",
        "summary": "One call with transcript and recording link",
        "description": "Scope: read or calls.",
        "security": [
          {
            "accountKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Call id."
          }
        ],
        "responses": {
          "200": {
            "description": "Call",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallDetail"
                }
              }
            }
          },
          "400": {
            "description": "invalid_request, invalid_json, invalid_cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "401": {
            "description": "missing_api_key or invalid_api_key (also a revoked key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "403": {
            "description": "insufficient_scope (the key lacks the scope in `required_scope`), account_suspended, account_pending, phone_unverified, international_not_allowed, contact_opted_out",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "404": {
            "description": "call_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited (300 requests a minute per key) or daily_limit_reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/campaigns": {
      "post": {
        "tags": [
          "Campaigns"
        ],
        "operationId": "createCampaign",
        "summary": "Create and start a campaign, or dry-run one",
        "description": "Scope: campaigns (a dry run also accepts read). With dryRun=true (or dry_run: true in the body) nothing is created, dialled or reserved: you get contact counts, a cost range at the platform per-minute rate, whether the wallet covers it, and the calling-hour and daily limits. Without it the campaign starts at once inside calling hours, otherwise at the next 9 am IST. An nc_test_ key simulates both. 409 agent_draft if the agent is a draft (also on a dry run).",
        "security": [
          {
            "accountKey": []
          }
        ],
        "parameters": [
          {
            "name": "dryRun",
            "in": "query",
            "schema": {
              "type": "boolean"
            },
            "description": "true or 1: estimate only."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CampaignRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dry run result (dryRun=true)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CampaignDryRun"
                }
              }
            }
          },
          "201": {
            "description": "Campaign created (not a dry run)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CampaignCreated"
                }
              }
            }
          },
          "400": {
            "description": "invalid_request, invalid_json, invalid_cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "401": {
            "description": "missing_api_key or invalid_api_key (also a revoked key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "403": {
            "description": "insufficient_scope (the key lacks the scope in `required_scope`), account_suspended, account_pending, phone_unverified, international_not_allowed, contact_opted_out",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "404": {
            "description": "agent_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "409": {
            "description": "agent_draft, calling_paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "422": {
            "description": "all_contacts_opted_out",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited (300 requests a minute per key) or daily_limit_reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/campaigns/{id}/results": {
      "get": {
        "tags": [
          "Campaigns"
        ],
        "operationId": "campaignResults",
        "summary": "Totals and one row per contact",
        "description": "Scope: read or campaigns.",
        "security": [
          {
            "accountKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Campaign id."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "The next_cursor from the previous page."
          }
        ],
        "responses": {
          "200": {
            "description": "Results",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CampaignResults"
                }
              }
            }
          },
          "400": {
            "description": "invalid_request, invalid_json, invalid_cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "401": {
            "description": "missing_api_key or invalid_api_key (also a revoked key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "403": {
            "description": "insufficient_scope (the key lacks the scope in `required_scope`), account_suspended, account_pending, phone_unverified, international_not_allowed, contact_opted_out",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "404": {
            "description": "campaign_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited (300 requests a minute per key) or daily_limit_reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/api/verify/start": {
      "post": {
        "tags": [
          "Verification"
        ],
        "operationId": "startVerification",
        "summary": "Start a missed-call or voice OTP verification",
        "description": "Auth: an nck_ site key, or an nc_ key with the otp scope (acts for the account's oldest active OTP site). Voice OTP phones the number and reads a 6-digit code; it spends one voice credit when answered. With an nc_test_ key nothing is called: a voice request returns test_code \"123456\"; a missed-call request reads as verified three seconds after it starts. Limits: 120 starts a minute per site, 5 per number per 10 minutes (missed call), 3 voice calls per number per hour and 10 a day.",
        "security": [
          {
            "siteKey": []
          },
          {
            "accountKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VerifyStartRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Started. Missed call returns requestId; voice returns id.",
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests allowed in the current window."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the current window."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/MissedCallStarted"
                    },
                    {
                      "$ref": "#/components/schemas/VoiceStarted"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "invalid_phone or invalid_method",
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests allowed in the current window."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the current window."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyError"
                }
              }
            }
          },
          "401": {
            "description": "invalid_api_key",
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests allowed in the current window."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the current window."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyError"
                }
              }
            }
          },
          "402": {
            "description": "insufficient_credits",
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests allowed in the current window."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the current window."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyError"
                }
              }
            }
          },
          "403": {
            "description": "insufficient_scope (nc_ keys without otp) or a blocked number",
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests allowed in the current window."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the current window."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyError"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests allowed in the current window."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the current window."
              },
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyError"
                }
              }
            }
          },
          "503": {
            "description": "Verification line not configured",
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests allowed in the current window."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the current window."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyError"
                }
              }
            }
          }
        }
      }
    },
    "/api/verify/check": {
      "post": {
        "tags": [
          "Verification"
        ],
        "operationId": "checkVerification",
        "summary": "Check a voice OTP code",
        "description": "Voice requests only. 5 attempts, then 410. Idempotent once verified. Test keys accept 123456.",
        "security": [
          {
            "siteKey": []
          },
          {
            "accountKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VerifyCheckRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verified",
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests allowed in the current window."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the current window."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyChecked"
                }
              }
            }
          },
          "400": {
            "description": "incorrect_code (with attemptsLeft) or a missed-call request",
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests allowed in the current window."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the current window."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyError"
                }
              }
            }
          },
          "404": {
            "description": "Unknown request",
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests allowed in the current window."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the current window."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyError"
                }
              }
            }
          },
          "410": {
            "description": "code_expired",
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests allowed in the current window."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the current window."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyError"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests allowed in the current window."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the current window."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyError"
                }
              }
            }
          }
        }
      }
    },
    "/api/verify/status/{id}": {
      "get": {
        "tags": [
          "Verification"
        ],
        "operationId": "verificationStatus",
        "summary": "Status of a verification",
        "description": "Poll every 2 to 3 seconds from your server. Mark a phone verified only when status is \"verified\".",
        "security": [
          {
            "siteKey": []
          },
          {
            "accountKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "requestId (missed call) or id (voice)."
          }
        ],
        "responses": {
          "200": {
            "description": "Status",
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests allowed in the current window."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the current window."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyStatus"
                }
              }
            }
          },
          "404": {
            "description": "Unknown request",
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests allowed in the current window."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the current window."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyError"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests allowed in the current window."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the current window."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/agents/{id}": {
      "get": {
        "tags": [
          "Agent builder"
        ],
        "operationId": "getAgent",
        "summary": "Get one agent in full",
        "security": [
          {
            "accountKey": []
          }
        ],
        "description": "Scope: agents (the prompt and knowledge are the owner's work, so read access alone is not enough). Tool secrets are never returned. A keypad flow answers 409 is_ivr_flow: use /ivr-flows/{id}.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The agent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentFull"
                }
              }
            }
          },
          "404": {
            "description": "agent_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "409": {
            "description": "is_ivr_flow",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "401": {
            "description": "missing_api_key or invalid_api_key (also a revoked key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "403": {
            "description": "insufficient_scope (the key lacks the scope in `required_scope`), account_suspended, account_pending, phone_unverified",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited (300 requests a minute per key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Agent builder"
        ],
        "operationId": "updateAgent",
        "summary": "Edit an agent (it goes back to draft)",
        "security": [
          {
            "accountKey": []
          }
        ],
        "description": "Scope: agents. Only the fields sent change. The agent is saved as a DRAFT again, so a live agent stops taking calls and campaign dials until a person presses Activate: tell the owner before editing an agent that is in use. With an nc_test_ key nothing is stored (test: true).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentPatch"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated, now a draft",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentFull"
                }
              }
            }
          },
          "400": {
            "description": "invalid_request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "404": {
            "description": "agent_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "409": {
            "description": "is_ivr_flow",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "401": {
            "description": "missing_api_key or invalid_api_key (also a revoked key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "403": {
            "description": "insufficient_scope (the key lacks the scope in `required_scope`), account_suspended, account_pending, phone_unverified",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited (300 requests a minute per key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ivr-flows": {
      "get": {
        "tags": [
          "Agent builder"
        ],
        "operationId": "listIvrFlows",
        "summary": "List keypad (IVR) flows",
        "security": [
          {
            "accountKey": []
          }
        ],
        "description": "Scope: agents. A keypad flow is an agent that plays a scripted call and records key presses; its id is the agent_id you use for calls and campaigns.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Flows",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IvrFlowList"
                }
              }
            }
          },
          "400": {
            "description": "invalid_cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "401": {
            "description": "missing_api_key or invalid_api_key (also a revoked key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "403": {
            "description": "insufficient_scope (the key lacks the scope in `required_scope`), account_suspended, account_pending, phone_unverified",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited (300 requests a minute per key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Agent builder"
        ],
        "operationId": "createIvrFlow",
        "summary": "Create a keypad flow (saved as a draft)",
        "security": [
          {
            "accountKey": []
          }
        ],
        "description": "Scope: agents (a keypad flow is an agent row, so it shares the scope). Strictly validated: step types, unique ids and option keys, 2 to 8 options a question, at most 12 steps, text lengths, verdicts, no markup or [placeholders]; unknown fields are refused. Saved as a DRAFT until a person activates it in the dashboard. Counts against the plan's agent limit. Recorded audio is added in the dashboard. nc_test_: simulated, nothing stored.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IvrFlowCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created as a draft",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IvrFlowObject"
                }
              }
            }
          },
          "400": {
            "description": "invalid_request (the message names the field)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "403": {
            "description": "insufficient_scope, agent_limit_reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "401": {
            "description": "missing_api_key or invalid_api_key (also a revoked key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited (300 requests a minute per key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ivr-flows/{id}": {
      "get": {
        "tags": [
          "Agent builder"
        ],
        "operationId": "getIvrFlow",
        "summary": "Get one keypad flow",
        "security": [
          {
            "accountKey": []
          }
        ],
        "description": "Scope: agents.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The flow",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IvrFlowObject"
                }
              }
            }
          },
          "404": {
            "description": "ivr_flow_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "401": {
            "description": "missing_api_key or invalid_api_key (also a revoked key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "403": {
            "description": "insufficient_scope (the key lacks the scope in `required_scope`), account_suspended, account_pending, phone_unverified",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited (300 requests a minute per key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Agent builder"
        ],
        "operationId": "updateIvrFlow",
        "summary": "Edit a keypad flow (it goes back to draft)",
        "security": [
          {
            "accountKey": []
          }
        ],
        "description": "Scope: agents. Only the fields sent change; `flow` is replaced whole and validated like a create. Saved as a DRAFT again.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IvrFlowPatch"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated, now a draft",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IvrFlowObject"
                }
              }
            }
          },
          "400": {
            "description": "invalid_request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "404": {
            "description": "ivr_flow_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "401": {
            "description": "missing_api_key or invalid_api_key (also a revoked key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "403": {
            "description": "insufficient_scope (the key lacks the scope in `required_scope`), account_suspended, account_pending, phone_unverified",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited (300 requests a minute per key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/balance": {
      "get": {
        "tags": [
          "Balance"
        ],
        "operationId": "getBalance",
        "summary": "Wallet balance, plan minutes and OTP credits",
        "security": [
          {
            "accountKey": []
          }
        ],
        "description": "Scope: read. Your own numbers, read only. With an nc_test_ key the numbers are made up and marked test: true.",
        "responses": {
          "200": {
            "description": "Balance",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Balance"
                }
              }
            }
          },
          "401": {
            "description": "missing_api_key or invalid_api_key (also a revoked key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "403": {
            "description": "insufficient_scope (the key lacks the scope in `required_scope`), account_suspended, account_pending, phone_unverified",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited (300 requests a minute per key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/balance/topup-link": {
      "post": {
        "tags": [
          "Balance"
        ],
        "operationId": "createTopupLink",
        "summary": "Get a link for a person to add money",
        "security": [
          {
            "accountKey": []
          }
        ],
        "description": "Scope: billing_link (read is not enough). NOTHING IS CHARGED and nothing is stored: this only returns the dashboard's Add money page with the amount filled in. A person opens it signed in, checks the amount and pays. An agent must never try to pay. 5 links an hour per key. With an nc_test_ key the link is fake and marked test: true.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TopupLinkRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The link",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TopupLink"
                }
              }
            }
          },
          "400": {
            "description": "invalid_request: amount_inr must be a whole number from min_inr to max_inr (both returned)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "503": {
            "description": "wallet_unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "401": {
            "description": "missing_api_key or invalid_api_key (also a revoked key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "403": {
            "description": "insufficient_scope (the key lacks the scope in `required_scope`), account_suspended, account_pending, phone_unverified",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited (300 requests a minute per key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    }
  }
}
