{
  "openapi": "3.1.0",
  "info": {
    "title": "Plans API",
    "version": "1.0.0",
    "summary": "Indian prepaid recharge plans for Airtel, Jio, Vi and BSNL.",
    "description": "Returns active prepaid recharge plans by operator, telecom circle and price. Plan data is collected from operators' published plan listings and updated regularly; GET /v1/plans/status reports the last update time. Plans API supplies plan information only and does not process recharges.",
    "termsOfService": "https://plans.nxtbytes.com/terms",
    "contact": { "name": "NxtBytes", "url": "https://plans.nxtbytes.com/about", "email": "reachtonxtbytes@gmail.com" }
  },
  "externalDocs": { "url": "https://plans.nxtbytes.com/docs" },
  "servers": [{ "url": "https://api.plans.nxtbytes.com" }],
  "paths": {
    "/v1/plans": {
      "get": {
        "operationId": "getPlans",
        "summary": "List prepaid plans for an operator",
        "description": "Returns active plans for one operator sorted by price ascending. With a circle, returns plans sold in that circle plus all-India plans.",
        "security": [{ "ApiKey": [] }],
        "parameters": [
          { "name": "operator", "in": "query", "required": true, "schema": { "type": "string", "enum": ["airtel", "jio", "vi", "bsnl"] } },
          { "name": "circle", "in": "query", "required": false, "description": "Telecom circle name, matched case-insensitively. Supported circles: Andhra Pradesh, Assam, Bihar & Jharkhand, Chennai, Delhi NCR, Gujarat, Haryana, Himachal Pradesh, Jammu & Kashmir, Karnataka, Kerala, Kolkata, Madhya Pradesh & Chhattisgarh, Maharashtra & Goa, Mumbai, North East, Odisha, Punjab, Rajasthan, Tamil Nadu, Uttar Pradesh East, Uttar Pradesh West & Uttarakhand, West Bengal. An unknown circle returns only all-India plans.", "schema": { "type": "string", "examples": ["Delhi NCR", "Karnataka", "Maharashtra & Goa"] } },
          { "name": "price", "in": "query", "required": false, "description": "Exact plan price in rupees.", "schema": { "type": "integer", "minimum": 1 } }
        ],
        "responses": {
          "200": { "description": "Plans found (the data array may be empty).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PlansResponse" } } } },
          "400": { "description": "operator required or invalid operator.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } },
          "401": { "description": "missing_api_key (no header), invalid (unknown key) or inactive (deactivated key).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } },
          "429": { "description": "daily_quota_exceeded or monthly_quota_exceeded.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } },
          "500": { "description": "Unexpected server error.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }
        }
      }
    },
    "/v1/plans/status": {
      "get": {
        "operationId": "getStatus",
        "summary": "Time of the latest plan-data update",
        "description": "Public. Needs no API key and does not count toward quotas.",
        "security": [],
        "responses": {
          "200": { "description": "Last update time in IST.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/StatusResponse" } } } },
          "500": { "description": "Unexpected server error.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }
        }
      }
    }
  },
  "components": {
    "securitySchemes": { "ApiKey": { "type": "apiKey", "in": "header", "name": "X-API-KEY" } },
    "schemas": {
      "Plan": {
        "type": "object",
        "required": ["price", "validity", "data"],
        "properties": {
          "price": { "type": "number", "description": "Price in INR." },
          "validity": { "type": "string", "examples": ["28 Days"] },
          "data": { "type": "string", "examples": ["2GB/Day"] },
          "talktime": { "type": ["string", "null"], "examples": ["Truly Unlimited Calls"] },
          "sms": { "type": ["string", "null"], "examples": ["100 SMS/Day"] },
          "description": { "type": ["string", "null"], "description": "Operator's plan description." }
        }
      },
      "Message": { "type": "object", "properties": { "code": { "type": ["string", "null"], "description": "Error category.", "examples": ["BadRequest", "Unauthorized", "TooManyRequests"] }, "message": { "type": ["string", "null"], "description": "Machine-readable reason.", "examples": ["operator required", "invalid operator", "missing_api_key", "invalid", "inactive", "daily_quota_exceeded", "monthly_quota_exceeded"] } } },
      "PlansResponse": { "type": "object", "required": ["success", "data"], "properties": { "success": { "type": "boolean", "const": true }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/Plan" } } } },
      "StatusResponse": { "type": "object", "required": ["success", "data"], "properties": { "success": { "type": "boolean" }, "data": { "type": "object", "required": ["lastUpdated"], "properties": { "lastUpdated": { "type": "string", "description": "Human-readable time of the latest update, in IST.", "examples": ["Wednesday, November 11, 2026 2:02:31 PM IST"] } } } } },
      "ErrorResponse": { "type": "object", "required": ["success", "errors"], "properties": { "success": { "type": "boolean", "const": false }, "errors": { "type": "array", "items": { "$ref": "#/components/schemas/Message" } }, "messages": { "type": ["array", "null"], "description": "Informational messages; null on error responses.", "items": { "$ref": "#/components/schemas/Message" } } } }
    }
  }
}
