{
  "openapi": "3.0.3",
  "info": {
    "title": "Email Validation API",
    "version": "1.0.0",
    "description": "Validate email addresses with multi-layer checks: RFC 5322 syntax, MX record existence, disposable/throwaway domain detection (10,000+ known domains), role-based address detection (admin@, noreply@, etc.), free provider classification, and typo suggestion for common domains (gmial.com → gmail.com). Batch validation of up to 100 emails per request.\n",
    "contact": {
      "name": "Email Validation API Support",
      "email": "api@hiroapp.cc"
    }
  },
  "servers": [
    {
      "url": "https://api.sprytools.com/v1/email-validation",
      "description": "Production (SpryTools API Gateway)"
    }
  ],
  "tags": [
    {
      "name": "Validate",
      "description": "Validate single or multiple email addresses"
    }
  ],
  "security": [
    {
      "ApiKeyHeader": []
    },
    {
      "RapidApiProxy": []
    }
  ],
  "paths": {
    "/api/v1/validate": {
      "get": {
        "operationId": "validateEmailGet",
        "summary": "Validate a single email address",
        "description": "Perform multi-layer validation: syntax check, MX record lookup, disposable domain detection, role-based detection, free provider classification, and typo suggestion.\n",
        "tags": [
          "Validate"
        ],
        "parameters": [
          {
            "name": "email",
            "in": "query",
            "required": true,
            "description": "Email address to validate",
            "schema": {
              "type": "string",
              "format": "email"
            },
            "example": "test@example.com"
          }
        ],
        "responses": {
          "200": {
            "description": "Validation result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationResult"
                },
                "examples": {
                  "valid": {
                    "summary": "Valid email",
                    "value": {
                      "email": "test@example.com",
                      "valid": true,
                      "reason": "valid",
                      "roleBased": false,
                      "freeProvider": false,
                      "checks": {
                        "syntax": true,
                        "mxRecords": true,
                        "disposable": false,
                        "roleBased": false,
                        "freeProvider": false
                      },
                      "suggestion": null
                    }
                  },
                  "invalid_syntax": {
                    "summary": "Invalid syntax",
                    "value": {
                      "email": "not-an-email",
                      "valid": false,
                      "reason": "invalid_syntax",
                      "checks": {
                        "syntax": false,
                        "mxRecords": false,
                        "disposable": false,
                        "roleBased": false,
                        "freeProvider": false
                      },
                      "suggestion": null
                    }
                  },
                  "typo": {
                    "summary": "Typo suggestion",
                    "value": {
                      "email": "user@gmial.com",
                      "valid": false,
                      "reason": "no_mx_records",
                      "checks": {
                        "syntax": true,
                        "mxRecords": false,
                        "disposable": false,
                        "roleBased": false,
                        "freeProvider": false
                      },
                      "suggestion": "user@gmail.com"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "validateEmailBatch",
        "summary": "Validate multiple email addresses in batch",
        "description": "Validate up to 100 email addresses in a single request. Returns per-email results and a summary.",
        "tags": [
          "Validate"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "emails"
                ],
                "properties": {
                  "emails": {
                    "type": "array",
                    "description": "Email addresses to validate (max 100)",
                    "items": {
                      "type": "string",
                      "format": "email"
                    },
                    "minItems": 1,
                    "maxItems": 100
                  }
                }
              },
              "example": {
                "emails": [
                  "test@example.com",
                  "user@gmial.com",
                  "admin@mailinator.com"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Batch validation results",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchValidationResult"
                },
                "example": {
                  "results": [
                    {
                      "email": "test@example.com",
                      "valid": true,
                      "reason": "valid"
                    },
                    {
                      "email": "admin@mailinator.com",
                      "valid": false,
                      "reason": "disposable_email"
                    }
                  ],
                  "summary": {
                    "total": 2,
                    "valid": 1,
                    "invalid": 1
                  }
                }
              }
            }
          },
          "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": {
      "ValidationChecks": {
        "type": "object",
        "properties": {
          "syntax": {
            "type": "boolean"
          },
          "mxRecords": {
            "type": "boolean"
          },
          "disposable": {
            "type": "boolean"
          },
          "roleBased": {
            "type": "boolean"
          },
          "freeProvider": {
            "type": "boolean"
          }
        }
      },
      "ValidationResult": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string"
          },
          "valid": {
            "type": "boolean"
          },
          "reason": {
            "type": "string",
            "enum": [
              "valid",
              "invalid_syntax",
              "no_mx_records",
              "disposable_email"
            ]
          },
          "roleBased": {
            "type": "boolean",
            "nullable": true
          },
          "freeProvider": {
            "type": "boolean",
            "nullable": true
          },
          "checks": {
            "$ref": "#/components/schemas/ValidationChecks"
          },
          "suggestion": {
            "type": "string",
            "nullable": true,
            "description": "Typo-corrected email suggestion if domain looks misspelled"
          }
        }
      },
      "BatchSummary": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer"
          },
          "valid": {
            "type": "integer"
          },
          "invalid": {
            "type": "integer"
          }
        }
      },
      "BatchValidationResult": {
        "type": "object",
        "properties": {
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ValidationResult"
            }
          },
          "summary": {
            "$ref": "#/components/schemas/BatchSummary"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          }
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Bad request — missing or invalid parameters",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "email query parameter is required"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "API key missing",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "API key required"
            }
          }
        }
      },
      "RateLimited": {
        "description": "Rate limit exceeded (100 requests per minute)",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "Rate limit exceeded"
            }
          }
        }
      }
    }
  }
}