{
  "openapi": "3.0.3",
  "info": {
    "title": "EU VAT Number Validator",
    "version": "1.0.0",
    "description": "Validate EU VAT/MwSt numbers via VIES (VAT Information Exchange System). Covers all 27 EU member states plus Northern Ireland (XI). Returns validity and — where the member state exposes it — the registered company name and address. Includes a batch endpoint for up to 10 numbers per request.\n",
    "contact": {
      "name": "EU VAT Validator API Support",
      "email": "api@hiroapp.cc"
    }
  },
  "servers": [
    {
      "url": "https://api.sprytools.com/v1/vat",
      "description": "Production (SpryTools API Gateway)"
    }
  ],
  "tags": [
    {
      "name": "Validation",
      "description": "VAT number validation"
    },
    {
      "name": "Lookup",
      "description": "Company data lookup"
    },
    {
      "name": "Batch",
      "description": "Bulk validation"
    }
  ],
  "security": [
    {
      "ApiKeyHeader": []
    },
    {
      "RapidApiProxy": []
    }
  ],
  "paths": {
    "/api/v1/validate": {
      "get": {
        "operationId": "validateVat",
        "summary": "Validate an EU VAT number",
        "description": "Validates a single EU VAT number against VIES. The number must include the 2-letter country prefix (e.g. `DE123456789`).\n",
        "tags": [
          "Validation"
        ],
        "parameters": [
          {
            "name": "vat",
            "in": "query",
            "required": true,
            "description": "VAT number including country prefix",
            "schema": {
              "type": "string"
            },
            "example": "DE811569869"
          }
        ],
        "responses": {
          "200": {
            "description": "Validation result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VatResult"
                },
                "example": {
                  "valid": true,
                  "countryCode": "DE",
                  "vatNumber": "811569869",
                  "name": "MUSTER GMBH",
                  "address": "MUSTERSTR 1, 10115 BERLIN",
                  "requestDate": "2026-05-31"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "502": {
            "$ref": "#/components/responses/ViesFailed"
          }
        }
      }
    },
    "/api/v1/lookup": {
      "get": {
        "operationId": "lookupVat",
        "summary": "Look up company data for a VAT number",
        "description": "Returns the same VIES record as `/validate`, intended for retrieving the registered company name and address where the member state provides it.\n",
        "tags": [
          "Lookup"
        ],
        "parameters": [
          {
            "name": "vat",
            "in": "query",
            "required": true,
            "description": "VAT number including country prefix",
            "schema": {
              "type": "string"
            },
            "example": "DE811569869"
          }
        ],
        "responses": {
          "200": {
            "description": "Company data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VatResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "502": {
            "$ref": "#/components/responses/ViesFailed"
          }
        }
      }
    },
    "/api/v1/validate/batch": {
      "post": {
        "operationId": "validateVatBatch",
        "summary": "Validate multiple VAT numbers",
        "description": "Validate up to 10 VAT numbers in a single request. Each is checked independently.",
        "tags": [
          "Batch"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "vatNumbers"
                ],
                "properties": {
                  "vatNumbers": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 10,
                    "items": {
                      "type": "string"
                    }
                  }
                }
              },
              "example": {
                "vatNumbers": [
                  "DE811569869",
                  "FR40303265045"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Batch validation results",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchVatResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      },
      "RapidApiProxy": {
        "type": "apiKey",
        "in": "header",
        "name": "x-rapidapi-proxy-secret"
      }
    },
    "schemas": {
      "VatResult": {
        "type": "object",
        "properties": {
          "valid": {
            "type": "boolean"
          },
          "countryCode": {
            "type": "string"
          },
          "vatNumber": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "address": {
            "type": "string",
            "nullable": true
          },
          "requestDate": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "BatchVatResultItem": {
        "allOf": [
          {
            "$ref": "#/components/schemas/VatResult"
          },
          {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "nullable": true
              }
            }
          }
        ]
      },
      "BatchVatResult": {
        "type": "object",
        "properties": {
          "count": {
            "type": "integer"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BatchVatResultItem"
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          }
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Bad request — missing or invalid VAT number",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "'vat' query parameter is required"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "API key missing",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "API key required"
            }
          }
        }
      },
      "ViesFailed": {
        "description": "VIES lookup failed (upstream service error)",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "VIES lookup failed"
            }
          }
        }
      },
      "RateLimited": {
        "description": "Rate limit exceeded (100 requests per minute)",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "Rate limit exceeded"
            }
          }
        }
      }
    }
  }
}