{
  "openapi": "3.0.3",
  "info": {
    "title": "Phone Number Validator",
    "description": "Validate & parse phone numbers: country, line type (mobile/fixed), E.164, and national/international formats.",
    "version": "1.0.0"
  },
  "components": {
    "schemas": {}
  },
  "paths": {
    "/validate": {
      "get": {
        "summary": "Validate & parse a phone number",
        "tags": [
          "Phone"
        ],
        "description": "Validates a phone number and returns its country, type (mobile/fixed-line/...), E.164, and national/international formats. Pass an international number (with +), or a national number plus the 2-letter country code.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "example": "+14155552671",
            "in": "query",
            "name": "number",
            "required": true,
            "description": "Phone number"
          },
          {
            "schema": {
              "type": "string"
            },
            "example": "US",
            "in": "query",
            "name": "country",
            "required": false,
            "description": "ISO 3166-1 alpha-2 region for national numbers"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "input": {
                      "type": "string"
                    },
                    "valid": {
                      "type": "boolean"
                    },
                    "possible": {
                      "type": "boolean"
                    },
                    "country": {
                      "type": "string",
                      "nullable": true
                    },
                    "countryCallingCode": {
                      "type": "string",
                      "nullable": true
                    },
                    "nationalNumber": {
                      "type": "string",
                      "nullable": true
                    },
                    "e164": {
                      "type": "string",
                      "nullable": true
                    },
                    "type": {
                      "type": "string",
                      "nullable": true
                    },
                    "formatInternational": {
                      "type": "string",
                      "nullable": true
                    },
                    "formatNational": {
                      "type": "string",
                      "nullable": true
                    },
                    "reason": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Bad request",
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/validate-batch": {
      "post": {
        "summary": "Validate up to 100 phone numbers",
        "tags": [
          "Phone"
        ],
        "description": "Runs full validation on each number in the array (max 100). Optional default country applies to all.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "numbers"
                ],
                "properties": {
                  "numbers": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "minItems": 1,
                    "maxItems": 100
                  },
                  "country": {
                    "type": "string",
                    "description": "Default ISO country code for national numbers"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "count": {
                      "type": "number"
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "input": {
                            "type": "string"
                          },
                          "valid": {
                            "type": "boolean"
                          },
                          "possible": {
                            "type": "boolean"
                          },
                          "country": {
                            "type": "string",
                            "nullable": true
                          },
                          "countryCallingCode": {
                            "type": "string",
                            "nullable": true
                          },
                          "nationalNumber": {
                            "type": "string",
                            "nullable": true
                          },
                          "e164": {
                            "type": "string",
                            "nullable": true
                          },
                          "type": {
                            "type": "string",
                            "nullable": true
                          },
                          "formatInternational": {
                            "type": "string",
                            "nullable": true
                          },
                          "formatNational": {
                            "type": "string",
                            "nullable": true
                          },
                          "reason": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Bad request",
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "servers": [
    {
      "url": "https://web-toolbox-api-production.up.railway.app/phone",
      "description": "Production"
    }
  ]
}