{
  "openapi": "3.0.3",
  "info": {
    "title": "TokenVerify B2B Trust & Fraud Prevention API",
    "description": "Sub-50ms edge B2B data verification API. Delivers deterministic disposable email checks, algorithmic EU/UK/US tax VAT/EIN validation, and phone toll-fraud defense.",
    "version": "1.0.0",
    "contact": {
      "name": "TokenVerify Support",
      "url": "https://tokenverifyapi.com"
    }
  },
  "servers": [
    {
      "url": "https://tokenverifyapi.com",
      "description": "Production Edge Gateway (Cloudflare Global)"
    },
    {
      "url": "http://localhost:3000",
      "description": "Local Development Server"
    }
  ],
  "paths": {
    "/v1/verify/b2b-lead": {
      "post": {
        "summary": "Unified 3-in-1 B2B Lead Verification",
        "description": "Evaluates email deliverability, tax ID (EU VAT/US EIN), and phone line risk in a single sub-50ms round-trip.",
        "operationId": "verifyB2BLead",
        "security": [
          { "BearerAuth": [] },
          { "RapidApiAuth": [] }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["email"],
                "properties": {
                  "email": { "type": "string", "example": "sarah@acme-corp.de" },
                  "tax_id": { "type": "string", "example": "DE811123456" },
                  "country_code": { "type": "string", "example": "DE" },
                  "phone": { "type": "string", "example": "+493012345678" }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verification evaluated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "verdict": { "type": "string", "enum": ["ALLOW", "REVIEW", "BLOCK"] },
                    "trust_score": { "type": "integer", "example": 96 },
                    "execution_time_ms": { "type": "integer", "example": 42 }
                  }
                }
              }
            }
          },
          "400": { "description": "Invalid input payload" },
          "401": { "description": "Unauthorized: Invalid API key" }
        }
      }
    },
    "/v1/verify/email": {
      "post": {
        "summary": "Email Deliverability & Disposable Verification",
        "description": "Performs Cloudflare DoH MX check and 3,500+ disposable domain blacklist verification.",
        "operationId": "verifyEmail",
        "security": [{ "BearerAuth": [] }, { "RapidApiAuth": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["email"],
                "properties": {
                  "email": { "type": "string", "example": "test@mailinator.com" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Email verified successfully" }
        }
      }
    },
    "/v1/verify/tax-id": {
      "post": {
        "summary": "EU VAT, UK VAT & US EIN Validation",
        "description": "Algorithmic ISO 7064 & Modulo checksum validator for all 27 EU member states, UK HMRC, and US EIN formats.",
        "operationId": "verifyTaxId",
        "security": [{ "BearerAuth": [] }, { "RapidApiAuth": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["tax_id"],
                "properties": {
                  "tax_id": { "type": "string", "example": "DE811123456" },
                  "country_code": { "type": "string", "example": "DE" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Tax ID validated successfully" }
        }
      }
    },
    "/v1/verify/phone": {
      "post": {
        "summary": "Phone E.164 & VoIP Fraud Risk",
        "description": "Normalizes phone numbers to E.164 standard and scores high-risk VoIP/virtual carrier toll-fraud risk.",
        "operationId": "verifyPhone",
        "security": [{ "BearerAuth": [] }, { "RapidApiAuth": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["phone"],
                "properties": {
                  "phone": { "type": "string", "example": "+493012345678" },
                  "country_code": { "type": "string", "example": "DE" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Phone verified successfully" }
        }
      }
    },
    "/v1/verify/batch": {
      "post": {
        "summary": "Batch Lead Verification (up to 50 items)",
        "description": "Processes up to 50 B2B verification checks in parallel for Clay.com, n8n, and Make workflows.",
        "operationId": "verifyBatch",
        "security": [{ "BearerAuth": [] }, { "RapidApiAuth": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["leads"],
                "properties": {
                  "leads": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": ["email"],
                      "properties": {
                        "email": { "type": "string" },
                        "tax_id": { "type": "string" }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Batch processed successfully" }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "TokenVerify Key (tv_live_...)"
      },
      "RapidApiAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-rapidapi-proxy-secret"
      }
    }
  }
}
