{
  "openapi": "3.0.3",
  "info": {
    "title": "Kodtelefona API",
    "version": "1.0.0",
    "description": "Оператор, регион и код по номеру телефона. Данные открытого реестра нумерации РФ."
  },
  "servers": [
    {
      "url": "https://www.kodtelefona.ru"
    }
  ],
  "paths": {
    "/api/v1/lookup": {
      "get": {
        "summary": "Оператор и регион по номеру",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "number",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "example": "79001234567"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Результат проверки"
          },
          "400": {
            "description": "Нет параметра number"
          },
          "401": {
            "description": "Нет или неверный ключ"
          },
          "429": {
            "description": "Лимит исчерпан"
          }
        }
      }
    },
    "/api/v1/demo": {
      "get": {
        "summary": "Демо без ключа (20 запросов в сутки)",
        "parameters": [
          {
            "name": "number",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "example": "79001234567"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Результат проверки"
          },
          "429": {
            "description": "Демо-лимит"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    },
    "schemas": {
      "Lookup": {
        "type": "object",
        "properties": {
          "valid": {
            "type": "boolean"
          },
          "number": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "code": {
            "type": "integer"
          },
          "operator": {
            "type": "string",
            "nullable": true
          },
          "region": {
            "type": "string",
            "nullable": true
          },
          "city": {
            "type": "string",
            "nullable": true
          },
          "range_known": {
            "type": "boolean"
          },
          "source": {
            "type": "string"
          }
        }
      }
    }
  }
}