{
  "openapi": "3.0.3",
  "info": {
    "title": "IVR Solutions — Partner Clients API",
    "version": "1.0.0",
    "summary": "Partner API to onboard and manage end-clients: registration, KYC, DIDs, agents, call flows, WhatsApp, wallet and credits.",
    "description": "# Partner Clients API\n\nFor **IVR Solutions partners & resellers**. Programmatically onboard your own clients and manage everything they need — registration and KYC, DID numbers, agents, call flows, voice bots, WhatsApp, wallet and credits.\n\n## Base URL\n```\nhttps://api.ivrsolutions.in\n```\n\n## Authentication\nEvery request requires your **partner API key** as a Bearer token:\n\n```bash\ncurl https://api.ivrsolutions.in/partnerclients/clients \\\n  -H \"Authorization: Bearer YOUR_PARTNER_API_KEY\"\n```\n\nGet your partner key from your IVR Solutions partner dashboard. Each client you create is identified by its `client_id` (the client's `api_key`), which you pass to most endpoints.\n\n## Response format\nAll responses are JSON shaped as `{ status, message, data }`. Errors return `{ status, message }` with a matching HTTP status (400 / 401 / 404 / 405).\n\n## Typical onboarding flow\n1. `register` → `verify_otp`\n2. KYC: `verify_pan` → `aadhar_otp`/`aadhar_verify` → `verify_gst` (or `skip_gst`) → `accept_kyc`\n3. Provision: `buy_did` → `add_agent` → `create_basic_flow` → `map_flow_did`\n4. Bill: `add_client_credits` → `wallet_balance`\n\n## Support\n- Email: support@ivrsolutions.in\n- Website: [www.ivrsolutions.in](https://www.ivrsolutions.in)",
    "contact": {
      "name": "IVR Solutions Partner Support",
      "email": "support@ivrsolutions.in",
      "url": "https://www.ivrsolutions.in"
    }
  },
  "servers": [
    {
      "url": "https://api.ivrsolutions.in",
      "description": "Production Server"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Client Registration & KYC",
      "description": "Onboard new clients and complete KYC — registration, OTP, PAN, Aadhaar and GST verification."
    },
    {
      "name": "Clients",
      "description": "List and manage the clients under your partner account."
    },
    {
      "name": "DID Numbers",
      "description": "Search, buy, assign and remove DID (virtual) numbers for your clients."
    },
    {
      "name": "DID Scheduling",
      "description": "Set working hours and holidays for a client's DID numbers."
    },
    {
      "name": "Agents",
      "description": "Create, edit, delete and assign DIDs to a client's agents."
    },
    {
      "name": "Agent Scheduling & Availability",
      "description": "Manage agent working hours and live availability."
    },
    {
      "name": "Call Flows",
      "description": "Build and map basic IVR call flows for a client."
    },
    {
      "name": "Voice Bots",
      "description": "Configure WSS voice bots used inside call flows."
    },
    {
      "name": "WhatsApp",
      "description": "Link WhatsApp numbers and manage their schedules and holidays."
    },
    {
      "name": "Wallet & Credits",
      "description": "Check balances, pull transactions, add credits and extend client validity."
    }
  ],
  "paths": {
    "/partnerclients/register": {
      "post": {
        "tags": [
          "Client Registration & KYC"
        ],
        "summary": "Register a client (Step 1)",
        "operationId": "partner_register",
        "description": "Start onboarding a new client — the first step of partner-led signup.\n\n**How it works:** Pass the client's `name`, `email`, `mobile`, `password` and `country_code` (optional `promo`). The platform creates a pending client and sends OTPs to verify the email and mobile, returning a `request_id` for the next step.\n\n**Use it for** self-serve client signup from your own portal or sales flow.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "example": "Acme Corp"
                  },
                  "email": {
                    "type": "string",
                    "example": "ops@acme.com"
                  },
                  "mobile": {
                    "type": "string",
                    "example": "9876543210"
                  },
                  "password": {
                    "type": "string",
                    "example": "SecurePass@123"
                  },
                  "country_code": {
                    "type": "string",
                    "example": "+91"
                  },
                  "promo": {
                    "type": "string",
                    "example": "WELCOME10"
                  }
                },
                "required": [
                  "name",
                  "email",
                  "mobile",
                  "password",
                  "country_code"
                ]
              },
              "example": {
                "name": "Acme Corp",
                "email": "ops@acme.com",
                "mobile": "9876543210",
                "password": "SecurePass@123",
                "country_code": "+91",
                "promo": "WELCOME10"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/verify_otp": {
      "post": {
        "tags": [
          "Client Registration & KYC"
        ],
        "summary": "Step 2: Verify OTP",
        "operationId": "partner_verify_otp",
        "description": "Verify the email and mobile OTPs sent during registration.\n\n**How it works:** Pass the `request_id` with the `mobileotp` and `emailotp` the client received. Successful verification moves onboarding on to the KYC steps.\n\n**Use it for** confirming contact details before KYC and account creation.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "request_id": {
                    "type": "string",
                    "example": "req_8f3a21"
                  },
                  "mobileotp": {
                    "type": "string",
                    "example": "123456"
                  },
                  "emailotp": {
                    "type": "string",
                    "example": "654321"
                  }
                },
                "required": [
                  "request_id",
                  "mobileotp",
                  "emailotp"
                ]
              },
              "example": {
                "request_id": "req_8f3a21",
                "mobileotp": "123456",
                "emailotp": "654321"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/resend_otp": {
      "post": {
        "tags": [
          "Client Registration & KYC"
        ],
        "summary": "Resend OTP",
        "operationId": "partner_resend_otp",
        "description": "Resend a verification OTP if the client didn't receive it.\n\n**How it works:** Pass the `request_id` and the `type` (email or mobile) to trigger a fresh code.\n\n**Use it for** recovering from expired or undelivered OTPs during signup.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "request_id": {
                    "type": "string",
                    "example": "req_8f3a21"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "email",
                      "mobile",
                      "both"
                    ],
                    "example": "both"
                  }
                },
                "required": [
                  "request_id",
                  "type"
                ]
              },
              "example": {
                "request_id": "req_8f3a21",
                "type": "both"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/verify_pan": {
      "post": {
        "tags": [
          "Client Registration & KYC"
        ],
        "summary": "Step 3a: Verify Business PAN",
        "operationId": "partner_verify_pan",
        "description": "Verify the client's business PAN as part of KYC.\n\n**How it works:** Pass the `temp_client_id`, the `pan` number and the business type `btype`; the platform validates it against records.\n\n**Use it for** meeting KYC requirements for business clients during onboarding.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "temp_client_id": {
                    "type": "string",
                    "example": "tmp_5521"
                  },
                  "pan": {
                    "type": "string",
                    "example": "ABCDE1234F"
                  },
                  "btype": {
                    "type": "string",
                    "enum": [
                      "proprietorship",
                      "company",
                      "firm"
                    ],
                    "example": "company"
                  }
                },
                "required": [
                  "temp_client_id",
                  "pan",
                  "btype"
                ]
              },
              "example": {
                "temp_client_id": "tmp_5521",
                "pan": "ABCDE1234F",
                "btype": "company"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/aadhar_otp": {
      "post": {
        "tags": [
          "Client Registration & KYC"
        ],
        "summary": "Step 3b: Send Aadhaar OTP",
        "operationId": "partner_aadhar_otp",
        "description": "Send an Aadhaar OTP to begin individual KYC.\n\n**How it works:** Pass the `temp_client_id` and `aadhar_num`; an OTP is sent to the Aadhaar-linked mobile and a reference is returned for verification.\n\n**Use it for** Aadhaar-based KYC for individual or proprietor clients.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "temp_client_id": {
                    "type": "string",
                    "example": "tmp_5521"
                  },
                  "aadhar_num": {
                    "type": "string",
                    "example": "123412341234"
                  }
                },
                "required": [
                  "temp_client_id",
                  "aadhar_num"
                ]
              },
              "example": {
                "temp_client_id": "tmp_5521",
                "aadhar_num": "123412341234"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/aadhar_verify": {
      "post": {
        "tags": [
          "Client Registration & KYC"
        ],
        "summary": "Step 3c: Verify Aadhaar OTP",
        "operationId": "partner_aadhar_verify",
        "description": "Verify the Aadhaar OTP to complete Aadhaar KYC.\n\n**How it works:** Pass the `temp_client_id`, the `otp` and the `ref` from the previous step to confirm the Aadhaar identity.\n\n**Use it for** completing the Aadhaar leg of client KYC.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "temp_client_id": {
                    "type": "string",
                    "example": "tmp_5521"
                  },
                  "otp": {
                    "type": "string",
                    "example": "123456"
                  },
                  "ref": {
                    "type": "string",
                    "description": "reference_id from aadhar_otp",
                    "example": "ref_99812"
                  }
                },
                "required": [
                  "temp_client_id",
                  "otp",
                  "ref"
                ]
              },
              "example": {
                "temp_client_id": "tmp_5521",
                "otp": "123456",
                "ref": "ref_99812"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/verify_gst": {
      "post": {
        "tags": [
          "Client Registration & KYC"
        ],
        "summary": "Step 3d: Verify GST",
        "operationId": "partner_verify_gst",
        "description": "Verify the client's GST number.\n\n**How it works:** Pass the `temp_client_id` and `gst_num`; the platform validates the GSTIN and links it to the client.\n\n**Use it for** capturing GST details for tax-registered business clients.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "temp_client_id": {
                    "type": "string",
                    "example": "tmp_5521"
                  },
                  "gst_num": {
                    "type": "string",
                    "example": "29ABCDE1234F1Z5"
                  }
                },
                "required": [
                  "temp_client_id",
                  "gst_num"
                ]
              },
              "example": {
                "temp_client_id": "tmp_5521",
                "gst_num": "29ABCDE1234F1Z5"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/skip_gst": {
      "post": {
        "tags": [
          "Client Registration & KYC"
        ],
        "summary": "Skip GST verification",
        "operationId": "partner_skip_gst",
        "description": "Skip GST verification when the client isn't GST-registered.\n\n**How it works:** Pass the `temp_client_id` to mark GST as not applicable and continue onboarding.\n\n**Use it for** onboarding small or unregistered clients who have no GSTIN.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "temp_client_id": {
                    "type": "string",
                    "example": "tmp_5521"
                  }
                },
                "required": [
                  "temp_client_id"
                ]
              },
              "example": {
                "temp_client_id": "tmp_5521"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/preview_kyc": {
      "post": {
        "tags": [
          "Client Registration & KYC"
        ],
        "summary": "Preview KYC data before final submission",
        "operationId": "partner_preview_kyc",
        "description": "Review all collected KYC details before final submission.\n\n**How it works:** Pass the `temp_client_id` to get a summary of the captured PAN, Aadhaar and GST data for confirmation.\n\n**Use it for** showing a confirmation screen before the client account is created.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "temp_client_id": {
                    "type": "string",
                    "example": "tmp_5521"
                  }
                },
                "required": [
                  "temp_client_id"
                ]
              },
              "example": {
                "temp_client_id": "tmp_5521"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/accept_kyc": {
      "post": {
        "tags": [
          "Client Registration & KYC"
        ],
        "summary": "Step 4: Accept KYC and create client account",
        "operationId": "partner_accept_kyc",
        "description": "Accept the KYC and create the live client account.\n\n**How it works:** Pass the `temp_client_id` and the client's `signature`; the platform finalizes KYC and converts the pending record into an active client.\n\n**Use it for** completing onboarding and going live with a new client.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "temp_client_id": {
                    "type": "string",
                    "example": "tmp_5521"
                  },
                  "signature": {
                    "type": "string",
                    "description": "base64",
                    "example": "data:image/png;base64,iVBORw0K..."
                  }
                },
                "required": [
                  "temp_client_id"
                ]
              },
              "example": {
                "temp_client_id": "tmp_5521",
                "signature": "data:image/png;base64,iVBORw0K..."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/clients": {
      "get": {
        "tags": [
          "Clients"
        ],
        "summary": "Get list of clients for the partner",
        "operationId": "partner_clients",
        "description": "List all clients under your partner account.\n\n**How it works:** Call the endpoint to get every client with their ID, status and basic details.\n\n**Use it for** building a client dashboard or picking a `client_id` for other calls.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/client/{client_id}": {
      "get": {
        "tags": [
          "Clients"
        ],
        "summary": "Get client details",
        "operationId": "partner_client",
        "description": "Get the full profile of a single client.\n\n**How it works:** Pass the `client_id` in the path to retrieve that client's details, status and configuration.\n\n**Use it for** showing or editing one client's account.",
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "description": "client_id",
            "schema": {
              "type": "string"
            },
            "example": "CLIENTAPIKEY12345"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/update_status": {
      "post": {
        "tags": [
          "Clients"
        ],
        "summary": "Update client status (activate/deactivate)",
        "operationId": "partner_update_status",
        "description": "Activate or deactivate a client account.\n\n**How it works:** Pass the `client_id` and the new `status`; a deactivated client can't use the platform until reactivated.\n\n**Use it for** suspending clients for non-payment or pausing inactive accounts.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "0",
                      "1"
                    ],
                    "example": "1"
                  }
                },
                "required": [
                  "client_id",
                  "status"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345",
                "status": "1"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/pending": {
      "get": {
        "tags": [
          "Clients"
        ],
        "summary": "Get pending registrations (temp clients)",
        "operationId": "partner_pending",
        "description": "List registrations that started but haven't completed KYC.\n\n**How it works:** Call the endpoint to get the temp (pending) clients still in onboarding.\n\n**Use it for** following up on incomplete signups and chasing stalled KYC.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/did_regions": {
      "get": {
        "tags": [
          "DID Numbers"
        ],
        "summary": "Get available DID regions",
        "operationId": "partner_did_regions",
        "description": "List the regions where DID numbers are available.\n\n**How it works:** Call the endpoint to get the regions you can search for numbers in.\n\n**Use it for** driving a region selector before searching DIDs for a client.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/search_dids": {
      "post": {
        "tags": [
          "DID Numbers"
        ],
        "summary": "Search available DIDs",
        "operationId": "partner_search_dids",
        "description": "Search for DID numbers available to assign to a client.\n\n**How it works:** Pass the `client_id`, `country_code`, `region` and an optional `search_pattern`; the API returns matching available numbers.\n\n**Use it for** letting clients pick a local or vanity number during setup.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  },
                  "country_code": {
                    "type": "string",
                    "example": "+91"
                  },
                  "pattern": {
                    "type": "string",
                    "example": "4310"
                  },
                  "search_pattern": {
                    "type": "string",
                    "enum": [
                      "startswith",
                      "contains",
                      "endswith"
                    ],
                    "example": "contains"
                  },
                  "region": {
                    "type": "string",
                    "example": "1"
                  }
                },
                "required": [
                  "client_id",
                  "country_code"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345",
                "country_code": "+91",
                "pattern": "4310",
                "search_pattern": "contains",
                "region": "1"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/buy_did": {
      "post": {
        "tags": [
          "DID Numbers"
        ],
        "summary": "Buy/Assign DID to client",
        "operationId": "partner_buy_did",
        "description": "Buy a DID and assign it to a client.\n\n**How it works:** Pass the `client_id`, the chosen `number` and `country`; the platform provisions the DID and links it to that client.\n\n**Use it for** giving a client their first number or expanding their inventory.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  },
                  "number": {
                    "type": "string",
                    "example": "+911143104501"
                  },
                  "country": {
                    "type": "string",
                    "example": "IN"
                  }
                },
                "required": [
                  "client_id",
                  "number",
                  "country"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345",
                "number": "+911143104501",
                "country": "IN"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/remove_did": {
      "post": {
        "tags": [
          "DID Numbers"
        ],
        "summary": "Remove DID from client",
        "operationId": "partner_remove_did",
        "description": "Remove (unlink) a DID from a client.\n\n**How it works:** Pass the `client_id` and the `did_no`; the number is released from that client.\n\n**Use it for** reclaiming numbers from churned clients or correcting assignments.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  },
                  "did_no": {
                    "type": "string",
                    "example": "+911143104501"
                  }
                },
                "required": [
                  "client_id",
                  "did_no"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345",
                "did_no": "+911143104501"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/client_dids/{client_id}": {
      "get": {
        "tags": [
          "DID Numbers"
        ],
        "summary": "Get client's DIDs",
        "operationId": "partner_client_dids",
        "description": "List the DID numbers assigned to a client.\n\n**How it works:** Pass the `client_id` in the path to get all of that client's DIDs and their status.\n\n**Use it for** auditing a client's numbers and choosing one to configure.",
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "description": "client_id",
            "schema": {
              "type": "string"
            },
            "example": "CLIENTAPIKEY12345"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/add_agent": {
      "post": {
        "tags": [
          "Agents"
        ],
        "summary": "Add agent",
        "operationId": "partner_add_agent",
        "description": "Create an agent under a client account.\n\n**How it works:** Pass the `client_id` with the agent's `name`, `email`, `phonenumber`, `password` and `extension` (plus options like `did_num`, `is_webrtc`, `dial_preference` and `permission_group`). The agent is provisioned to take calls.\n\n**Use it for** onboarding a client's call-centre team programmatically.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  },
                  "name": {
                    "type": "string",
                    "example": "Acme Corp"
                  },
                  "email": {
                    "type": "string",
                    "example": "ops@acme.com"
                  },
                  "phonenumber": {
                    "type": "string",
                    "example": "9876543210"
                  },
                  "password": {
                    "type": "string",
                    "example": "SecurePass@123"
                  },
                  "extension": {
                    "type": "string",
                    "example": "2101"
                  },
                  "reporting_manager": {
                    "type": "string",
                    "example": "1"
                  },
                  "manager": {
                    "type": "string",
                    "example": "1"
                  },
                  "is_webrtc": {
                    "type": "string",
                    "example": "1"
                  },
                  "dial_preference": {
                    "type": "string",
                    "example": "1"
                  },
                  "did_num": {
                    "type": "string",
                    "example": "+911143104501"
                  },
                  "permission_group": {
                    "type": "string",
                    "example": "2"
                  }
                },
                "required": [
                  "client_id",
                  "name",
                  "email",
                  "phonenumber",
                  "password"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345",
                "name": "Acme Corp",
                "email": "ops@acme.com",
                "phonenumber": "9876543210",
                "password": "SecurePass@123",
                "extension": "2101",
                "reporting_manager": "1",
                "manager": "1",
                "is_webrtc": "1",
                "dial_preference": "1",
                "did_num": "+911143104501",
                "permission_group": "2"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/edit_agent": {
      "post": {
        "tags": [
          "Agents"
        ],
        "summary": "Edit agent",
        "operationId": "partner_edit_agent",
        "description": "Update an existing agent's details or settings.\n\n**How it works:** Pass the `client_id` and `agent_id` with any fields to change — name, `extension`, `did_num`, `is_webrtc`, `permission_group` and more.\n\n**Use it for** reassigning extensions, updating contact details or changing permissions.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  },
                  "agent_id": {
                    "type": "string",
                    "example": "4821"
                  },
                  "name": {
                    "type": "string",
                    "example": "Acme Corp"
                  },
                  "email": {
                    "type": "string",
                    "example": "ops@acme.com"
                  },
                  "phonenumber": {
                    "type": "string",
                    "example": "9876543210"
                  },
                  "password": {
                    "type": "string",
                    "example": "SecurePass@123"
                  },
                  "extension": {
                    "type": "string",
                    "example": "2101"
                  },
                  "reporting_manager": {
                    "type": "string",
                    "example": "1"
                  },
                  "manager": {
                    "type": "string",
                    "example": "1"
                  },
                  "is_webrtc": {
                    "type": "string",
                    "example": "1"
                  },
                  "dial_preference": {
                    "type": "string",
                    "example": "1"
                  },
                  "did_num": {
                    "type": "string",
                    "example": "+911143104501"
                  },
                  "permission_group": {
                    "type": "string",
                    "example": "2"
                  }
                },
                "required": [
                  "client_id",
                  "agent_id",
                  "name",
                  "email",
                  "phonenumber",
                  "password"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345",
                "agent_id": "4821",
                "name": "Acme Corp",
                "email": "ops@acme.com",
                "phonenumber": "9876543210",
                "password": "SecurePass@123",
                "extension": "2101",
                "reporting_manager": "1",
                "manager": "1",
                "is_webrtc": "1",
                "dial_preference": "1",
                "did_num": "+911143104501",
                "permission_group": "2"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/delete_agent": {
      "post": {
        "tags": [
          "Agents"
        ],
        "summary": "Delete agent (set status to 0)",
        "operationId": "partner_delete_agent",
        "description": "Remove an agent from a client account.\n\n**How it works:** Pass the `client_id` and `agent_id`; the agent is deactivated (status set to 0) and can no longer take calls.\n\n**Use it for** offboarding agents who've left a client's team.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  },
                  "agent_id": {
                    "type": "string",
                    "example": "4821"
                  }
                },
                "required": [
                  "client_id",
                  "agent_id"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345",
                "agent_id": "4821"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/update_agent_did": {
      "post": {
        "tags": [
          "Agents"
        ],
        "summary": "Update agent DID",
        "operationId": "partner_update_agent_did",
        "description": "Change the DID tied to a client's agent.\n\n**How it works:** Pass the `client_id`, the `agent_ext` and the `did_num`; the agent's outbound caller ID updates.\n\n**Use it for** giving agents local caller IDs or moving numbers between them.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  },
                  "agent_ext": {
                    "type": "string",
                    "example": "2101"
                  },
                  "did_num": {
                    "type": "string",
                    "example": "+911143104501"
                  }
                },
                "required": [
                  "client_id",
                  "agent_ext",
                  "did_num"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345",
                "agent_ext": "2101",
                "did_num": "+911143104501"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/create_basic_flow": {
      "post": {
        "tags": [
          "Call Flows"
        ],
        "summary": "Create basic call flow",
        "operationId": "partner_create_basic_flow",
        "description": "Create a basic IVR call flow for a client.\n\n**How it works:** Pass the `client_id`, a `flow_name`, the target `agent_ext`, the `did_no` and an optional `recording_id`. The platform builds a simple routing flow for that number.\n\n**Use it for** standing up quick call routing for a client without the full flow builder.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  },
                  "flow_name": {
                    "type": "string",
                    "example": "Support Flow"
                  },
                  "agent_ext": {
                    "type": "string",
                    "example": "2101"
                  },
                  "did_no": {
                    "type": "string",
                    "description": "defaults to client's primary DID",
                    "example": "+911143104501"
                  },
                  "recording_id": {
                    "type": "string",
                    "description": "welcome message recording ID",
                    "example": "2207"
                  }
                },
                "required": [
                  "client_id",
                  "flow_name",
                  "agent_ext"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345",
                "flow_name": "Support Flow",
                "agent_ext": "2101",
                "did_no": "+911143104501",
                "recording_id": "2207"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/edit_basic_flow": {
      "post": {
        "tags": [
          "Call Flows"
        ],
        "summary": "Edit basic call flow",
        "operationId": "partner_edit_basic_flow",
        "description": "Edit a client's basic call flow.\n\n**How it works:** Pass the `client_id` and `flow_id` with fields to change — `flow_name`, `recording_id`, `transfer_to`, `agent_ext` or a `wss_bot_id` to route to a voice bot.\n\n**Use it for** retuning routing, greetings or bot handoff for a client.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  },
                  "flow_id": {
                    "type": "string",
                    "example": "10045"
                  },
                  "flow_name": {
                    "type": "string",
                    "example": "Support Flow"
                  },
                  "recording_id": {
                    "type": "string",
                    "example": "2207"
                  },
                  "transfer_to": {
                    "type": "string",
                    "example": "2101"
                  },
                  "agent_ext": {
                    "type": "string",
                    "example": "2101"
                  },
                  "wss_bot_id": {
                    "type": "string",
                    "example": "77"
                  }
                },
                "required": [
                  "client_id",
                  "flow_id"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345",
                "flow_id": "10045",
                "flow_name": "Support Flow",
                "recording_id": "2207",
                "transfer_to": "2101",
                "agent_ext": "2101",
                "wss_bot_id": "77"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/map_flow_did": {
      "post": {
        "tags": [
          "Call Flows"
        ],
        "summary": "Map call flow with DID",
        "operationId": "partner_map_flow_did",
        "description": "Attach a call flow to a client's DID number.\n\n**How it works:** Pass the `client_id`, the `flow_id` and the `did_no`; inbound calls to that number then run the flow.\n\n**Use it for** activating a flow on a number, or swapping which flow a number uses.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  },
                  "flow_id": {
                    "type": "string",
                    "example": "10045"
                  },
                  "did_no": {
                    "type": "string",
                    "example": "+911143104501"
                  }
                },
                "required": [
                  "client_id",
                  "flow_id",
                  "did_no"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345",
                "flow_id": "10045",
                "did_no": "+911143104501"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/create_wss_bot": {
      "post": {
        "tags": [
          "Voice Bots"
        ],
        "summary": "Create or Update WSS Bot for a client",
        "operationId": "partner_create_wss_bot",
        "description": "Create or update a WSS voice bot for a client.\n\n**How it works:** Pass the `client_id`, a `bot_name`, the `wss_url` (with optional `api_url`/`wss_header`) and `to_be_used`; pass an `id` to update an existing bot. Flows can then route calls to this bot.\n\n**Use it for** wiring a client's AI/WebSocket bot into their call flows.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  },
                  "bot_name": {
                    "type": "string",
                    "example": "Lead Bot"
                  },
                  "to_be_used": {
                    "type": "string",
                    "example": "voice"
                  },
                  "id": {
                    "type": "string",
                    "description": "for update",
                    "example": "77"
                  },
                  "api_url": {
                    "type": "string",
                    "example": "https://example.com/bot"
                  },
                  "wss_url": {
                    "type": "string",
                    "example": "wss://example.com/stream"
                  },
                  "wss_header": {
                    "type": "string",
                    "example": "Authorization: Bearer xyz"
                  }
                },
                "required": [
                  "client_id",
                  "bot_name",
                  "to_be_used"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345",
                "bot_name": "Lead Bot",
                "to_be_used": "voice",
                "id": "77",
                "api_url": "https://example.com/bot",
                "wss_url": "wss://example.com/stream",
                "wss_header": "Authorization: Bearer xyz"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/get_wss_bots/{client_id}": {
      "get": {
        "tags": [
          "Voice Bots"
        ],
        "summary": "Get all WSS Bots for a client",
        "operationId": "partner_get_wss_bots",
        "description": "List all WSS voice bots configured for a client.\n\n**How it works:** Pass the `client_id` in the path to get each bot with its ID and settings.\n\n**Use it for** showing a bot picker when building call flows.",
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "description": "client_id",
            "schema": {
              "type": "string"
            },
            "example": "CLIENTAPIKEY12345"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/get_wss_bot": {
      "post": {
        "tags": [
          "Voice Bots"
        ],
        "summary": "Get single WSS Bot",
        "operationId": "partner_get_wss_bot",
        "description": "Get a single WSS voice bot's configuration.\n\n**How it works:** Pass the `client_id` and the bot `id` to retrieve its URLs and headers.\n\n**Use it for** inspecting or pre-filling a bot's settings before editing.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  },
                  "id": {
                    "type": "string",
                    "example": "77"
                  }
                },
                "required": [
                  "client_id",
                  "id"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345",
                "id": "77"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/delete_wss_bot": {
      "post": {
        "tags": [
          "Voice Bots"
        ],
        "summary": "Delete WSS Bot",
        "operationId": "partner_delete_wss_bot",
        "description": "Delete a WSS voice bot from a client.\n\n**How it works:** Pass the `client_id` and the bot `id`; it's removed and can no longer be used in flows.\n\n**Use it for** cleaning up unused or deprecated bots.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  },
                  "id": {
                    "type": "string",
                    "example": "77"
                  }
                },
                "required": [
                  "client_id",
                  "id"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345",
                "id": "77"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/get_did_schedule": {
      "post": {
        "tags": [
          "DID Scheduling"
        ],
        "summary": "Get DID schedule (working hours, timezone, holidays)",
        "operationId": "partner_get_did_schedule",
        "description": "Get a DID's working hours, timezone and holidays.\n\n**How it works:** Pass the `client_id` and `did_id` to retrieve the number's schedule.\n\n**Use it for** showing current office hours before editing them.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  },
                  "did_id": {
                    "type": "string",
                    "example": "331"
                  }
                },
                "required": [
                  "client_id",
                  "did_id"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345",
                "did_id": "331"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/set_did_schedule": {
      "post": {
        "tags": [
          "DID Scheduling"
        ],
        "summary": "Set DID schedule (working hours, timezone)",
        "operationId": "partner_set_did_schedule",
        "description": "Set a DID's working hours and timezone.\n\n**How it works:** Pass the `client_id`, `did_id`, `timezone` and `working_hours`; calls outside these hours follow your off-hours handling.\n\n**Use it for** enforcing business hours on a client's inbound number.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  },
                  "did_id": {
                    "type": "string",
                    "example": "331"
                  },
                  "timezone": {
                    "type": "string",
                    "example": "Asia/Kolkata"
                  },
                  "working_hours": {
                    "type": "object",
                    "description": "Working hours keyed by day, e.g. {\"mon\":{\"open\":\"09:00\",\"close\":\"18:00\"}}",
                    "example": {
                      "mon": {
                        "open": "09:00",
                        "close": "18:00"
                      }
                    }
                  }
                },
                "required": [
                  "client_id",
                  "did_id",
                  "timezone"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345",
                "did_id": "331",
                "timezone": "Asia/Kolkata",
                "working_hours": {
                  "mon": {
                    "open": "09:00",
                    "close": "18:00"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/add_did_holiday": {
      "post": {
        "tags": [
          "DID Scheduling"
        ],
        "summary": "Add holiday to DID",
        "operationId": "partner_add_did_holiday",
        "description": "Add a holiday to a DID's schedule.\n\n**How it works:** Pass the `client_id`, `did_id`, a holiday `name` and `date`; the number is treated as closed that day.\n\n**Use it for** blocking public holidays and one-off closures.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  },
                  "did_id": {
                    "type": "string",
                    "example": "331"
                  },
                  "name": {
                    "type": "string",
                    "example": "Acme Corp"
                  },
                  "date": {
                    "type": "string",
                    "description": "YYYY-MM-DD",
                    "example": "2025-08-15"
                  }
                },
                "required": [
                  "client_id",
                  "did_id",
                  "name",
                  "date"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345",
                "did_id": "331",
                "name": "Acme Corp",
                "date": "2025-08-15"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/delete_did_holiday": {
      "post": {
        "tags": [
          "DID Scheduling"
        ],
        "summary": "Delete holiday from DID",
        "operationId": "partner_delete_did_holiday",
        "description": "Remove a holiday from a DID's schedule.\n\n**How it works:** Pass the `client_id` and the `holiday_id` to delete it.\n\n**Use it for** correcting a mistaken holiday or reopening a date.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  },
                  "holiday_id": {
                    "type": "string",
                    "example": "12"
                  }
                },
                "required": [
                  "client_id",
                  "holiday_id"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345",
                "holiday_id": "12"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/link_whatsapp_did": {
      "post": {
        "tags": [
          "WhatsApp"
        ],
        "summary": "Register/Link a WhatsApp Business number",
        "operationId": "partner_link_whatsapp_did",
        "description": "Link a WhatsApp Business number to a client.\n\n**How it works:** Pass the `client_id`, the `phone_number_id`, `access_token`, `display_number` and `verified_name`; the WhatsApp number is connected for the client.\n\n**Use it for** adding WhatsApp as a channel for a client.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  },
                  "phone_number_id": {
                    "type": "string",
                    "example": "1029384756"
                  },
                  "access_token": {
                    "type": "string",
                    "example": "EAAG..."
                  },
                  "display_number": {
                    "type": "string",
                    "example": "+911143104501"
                  },
                  "verified_name": {
                    "type": "string",
                    "example": "Acme Corp"
                  }
                },
                "required": [
                  "client_id",
                  "phone_number_id",
                  "access_token"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345",
                "phone_number_id": "1029384756",
                "access_token": "EAAG...",
                "display_number": "+911143104501",
                "verified_name": "Acme Corp"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/get_whatsapp_dids": {
      "post": {
        "tags": [
          "WhatsApp"
        ],
        "summary": "Get WhatsApp DIDs for a client",
        "operationId": "partner_get_whatsapp_dids",
        "description": "List a client's linked WhatsApp numbers.\n\n**How it works:** Pass the `client_id` to get every WhatsApp DID and its status.\n\n**Use it for** managing a client's WhatsApp channels.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  }
                },
                "required": [
                  "client_id"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/delete_whatsapp_did": {
      "post": {
        "tags": [
          "WhatsApp"
        ],
        "summary": "Delete/Unlink a WhatsApp DID",
        "operationId": "partner_delete_whatsapp_did",
        "description": "Unlink a WhatsApp number from a client.\n\n**How it works:** Pass the `client_id` and the `wa_did_id`; the number is disconnected.\n\n**Use it for** removing a deprecated or migrated WhatsApp number.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  },
                  "wa_did_id": {
                    "type": "string",
                    "example": "45"
                  }
                },
                "required": [
                  "client_id",
                  "wa_did_id"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345",
                "wa_did_id": "45"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/set_whatsapp_schedule": {
      "post": {
        "tags": [
          "WhatsApp"
        ],
        "summary": "Set WhatsApp DID schedule (working hours, timezone)",
        "operationId": "partner_set_whatsapp_schedule",
        "description": "Set working hours for a client's WhatsApp number.\n\n**How it works:** Pass the `client_id`, `wa_did_id`, `timezone` and `working_hours` to define when the number is active.\n\n**Use it for** enforcing business hours on WhatsApp conversations.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  },
                  "wa_did_id": {
                    "type": "string",
                    "example": "45"
                  },
                  "timezone": {
                    "type": "string",
                    "example": "Asia/Kolkata"
                  },
                  "working_hours": {
                    "type": "object",
                    "description": "Working hours keyed by day, e.g. {\"mon\":{\"open\":\"09:00\",\"close\":\"18:00\"}}",
                    "example": {
                      "mon": {
                        "open": "09:00",
                        "close": "18:00"
                      }
                    }
                  }
                },
                "required": [
                  "client_id",
                  "wa_did_id",
                  "timezone"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345",
                "wa_did_id": "45",
                "timezone": "Asia/Kolkata",
                "working_hours": {
                  "mon": {
                    "open": "09:00",
                    "close": "18:00"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/get_whatsapp_schedule": {
      "post": {
        "tags": [
          "WhatsApp"
        ],
        "summary": "Get WhatsApp DID schedule",
        "operationId": "partner_get_whatsapp_schedule",
        "description": "Get a WhatsApp number's schedule.\n\n**How it works:** Pass the `client_id` and `wa_did_id` to retrieve its working hours, timezone and holidays.\n\n**Use it for** reviewing WhatsApp availability before editing.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  },
                  "wa_did_id": {
                    "type": "string",
                    "example": "45"
                  }
                },
                "required": [
                  "client_id",
                  "wa_did_id"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345",
                "wa_did_id": "45"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/add_whatsapp_holiday": {
      "post": {
        "tags": [
          "WhatsApp"
        ],
        "summary": "Add holiday to WhatsApp DID",
        "operationId": "partner_add_whatsapp_holiday",
        "description": "Add a holiday to a WhatsApp number's schedule.\n\n**How it works:** Pass the `client_id`, `wa_did_id`, a holiday `name` and `date` to mark it closed.\n\n**Use it for** blocking holidays on WhatsApp channels.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  },
                  "wa_did_id": {
                    "type": "string",
                    "example": "45"
                  },
                  "name": {
                    "type": "string",
                    "example": "Acme Corp"
                  },
                  "date": {
                    "type": "string",
                    "description": "YYYY-MM-DD",
                    "example": "2025-08-15"
                  }
                },
                "required": [
                  "client_id",
                  "wa_did_id",
                  "name",
                  "date"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345",
                "wa_did_id": "45",
                "name": "Acme Corp",
                "date": "2025-08-15"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/delete_whatsapp_holiday": {
      "post": {
        "tags": [
          "WhatsApp"
        ],
        "summary": "Delete holiday from WhatsApp DID",
        "operationId": "partner_delete_whatsapp_holiday",
        "description": "Remove a holiday from a WhatsApp number's schedule.\n\n**How it works:** Pass the `client_id` and `holiday_id` to delete it.\n\n**Use it for** correcting or reopening a WhatsApp closure date.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  },
                  "holiday_id": {
                    "type": "string",
                    "example": "12"
                  }
                },
                "required": [
                  "client_id",
                  "holiday_id"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345",
                "holiday_id": "12"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/wallet_transactions": {
      "post": {
        "tags": [
          "Wallet & Credits"
        ],
        "summary": "Get wallet transaction history",
        "operationId": "partner_wallet_transactions",
        "description": "Pull a client's wallet transaction history.\n\n**How it works:** Pass the `client_id` with optional filters — `page`, `limit`, `expense_type`, `start_date`, `end_date`, `did` — to page through debits and credits.\n\n**Use it for** billing dashboards, statements and usage reconciliation.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  },
                  "page": {
                    "type": "integer"
                  },
                  "limit": {
                    "type": "integer"
                  },
                  "expense_type": {
                    "type": "string",
                    "example": "call"
                  },
                  "start_date": {
                    "type": "string",
                    "description": "YYYY-MM-DD",
                    "example": "2025-08-01"
                  },
                  "end_date": {
                    "type": "string",
                    "description": "YYYY-MM-DD",
                    "example": "2025-08-31"
                  },
                  "did": {
                    "type": "string",
                    "example": "+911143104501"
                  }
                },
                "required": [
                  "client_id"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345",
                "page": "",
                "limit": "",
                "expense_type": "call",
                "start_date": "2025-08-01",
                "end_date": "2025-08-31",
                "did": "+911143104501"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/wallet_balance": {
      "post": {
        "tags": [
          "Wallet & Credits"
        ],
        "summary": "Get current wallet balance and client expiry",
        "operationId": "partner_wallet_balance",
        "description": "Check a client's current wallet balance and account expiry.\n\n**How it works:** Pass the `client_id` to get the live balance and validity date.\n\n**Use it for** showing balance widgets and triggering low-balance top-ups.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  }
                },
                "required": [
                  "client_id"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/get_agent_schedule": {
      "post": {
        "tags": [
          "Agent Scheduling & Availability"
        ],
        "summary": "Get agent availability schedule",
        "operationId": "partner_get_agent_schedule",
        "description": "Get an agent's availability schedule.\n\n**How it works:** Pass the `client_id` and `agent_id` to retrieve their working hours and timezone.\n\n**Use it for** reviewing an agent's shift before editing it.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  },
                  "agent_id": {
                    "type": "string",
                    "description": "SipUsers.id",
                    "example": "4821"
                  }
                },
                "required": [
                  "client_id",
                  "agent_id"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345",
                "agent_id": "4821"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/set_agent_schedule": {
      "post": {
        "tags": [
          "Agent Scheduling & Availability"
        ],
        "summary": "Set agent availability schedule",
        "operationId": "partner_set_agent_schedule",
        "description": "Set an agent's availability schedule.\n\n**How it works:** Pass the `client_id`, `agent_id`, `timezone` and `working_hours`; calls route to the agent only during these hours.\n\n**Use it for** defining agent shifts and routing windows.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  },
                  "agent_id": {
                    "type": "string",
                    "example": "4821"
                  },
                  "timezone": {
                    "type": "string",
                    "example": "Asia/Kolkata"
                  },
                  "working_hours": {
                    "type": "object",
                    "description": "Working hours keyed by day, e.g. {\"mon\":{\"open\":\"09:00\",\"close\":\"18:00\"}}",
                    "example": {
                      "mon": {
                        "open": "09:00",
                        "close": "18:00"
                      }
                    }
                  }
                },
                "required": [
                  "client_id",
                  "agent_id",
                  "timezone"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345",
                "agent_id": "4821",
                "timezone": "Asia/Kolkata",
                "working_hours": {
                  "mon": {
                    "open": "09:00",
                    "close": "18:00"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/update_agent_availability": {
      "post": {
        "tags": [
          "Agent Scheduling & Availability"
        ],
        "summary": "Update agent availability status (online/offline)",
        "operationId": "partner_update_agent_availability",
        "description": "Set an agent online or offline right now.\n\n**How it works:** Pass the `client_id`, `agent_id` and the `available` flag to flip their live status.\n\n**Use it for** wiring agent presence to your own dashboard or break button.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  },
                  "agent_id": {
                    "type": "string",
                    "example": "4821"
                  },
                  "available": {
                    "type": "string",
                    "enum": [
                      "0",
                      "1"
                    ],
                    "example": "1"
                  }
                },
                "required": [
                  "client_id",
                  "agent_id",
                  "available"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345",
                "agent_id": "4821",
                "available": "1"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/get_agents_availability": {
      "post": {
        "tags": [
          "Agent Scheduling & Availability"
        ],
        "summary": "Get all agents with availability status",
        "operationId": "partner_get_agents_availability",
        "description": "Get every agent for a client with their live availability.\n\n**How it works:** Pass the `client_id` to see which agents are online, offline or on a call.\n\n**Use it for** a live wallboard of agent presence.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  }
                },
                "required": [
                  "client_id"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partnerclients/add_client_credits": {
      "post": {
        "tags": [
          "Wallet & Credits"
        ],
        "summary": "Add credits and/or update validity for a client",
        "operationId": "partner_add_client_credits",
        "description": "Add credits and/or extend a client's validity.\n\n**How it works:** Pass the `client_id`, a `credit` amount and/or a new `valid_till` date; the wallet and expiry update immediately.\n\n**Use it for** top-ups, plan renewals and promotional credit.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "example": "CLIENTAPIKEY12345"
                  },
                  "valid_till": {
                    "type": "string",
                    "description": "Y-m-d H:i:s",
                    "example": "2025-12-31 23:59:59"
                  },
                  "credit": {
                    "type": "string",
                    "description": "numeric > 0",
                    "example": "500"
                  }
                },
                "required": [
                  "client_id"
                ]
              },
              "example": {
                "client_id": "CLIENTAPIKEY12345",
                "valid_till": "2025-12-31 23:59:59",
                "credit": "500"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid partner token"
          },
          "404": {
            "description": "Not found"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Your partner API key from the IVR Solutions partner dashboard."
      }
    },
    "schemas": {
      "PartnerResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "integer",
            "example": 200
          },
          "message": {
            "type": "string",
            "example": "Success"
          },
          "data": {
            "type": "object",
            "description": "Response payload (varies by endpoint)"
          }
        }
      },
      "PartnerError": {
        "type": "object",
        "properties": {
          "status": {
            "type": "integer",
            "example": 400
          },
          "message": {
            "type": "string",
            "example": "Field 'client_id' is required"
          }
        }
      }
    }
  }
}