Docs
Validate Emails, Phones & IBANs with DataForge

Validate Emails, Phones & IBANs with DataForge

A step-by-step guide to integrating DataForge's 9-in-1 data validation API into your application.

DataForge is a unified data validation API that handles nine common validation tasks through a single endpoint. This guide shows you how to integrate it into a backend service to validate user-submitted data at the point of entry.

Supported Validation Types

TypeDescription
emailRFC-compliant email format and domain check
phoneInternational phone number validation (E.164)
ibanIBAN format and checksum validation
credit_cardCredit card number Luhn algorithm check
vatEU VAT number format validation
postal_codePostal code validation by country
dateDate format and range validation
passwordPassword strength scoring
crypto_addressBTC, ETH, and other crypto address validation

Making a Validation Request

curl -X POST https://api.apivult.com/v1/dev/dataforge/validate \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{"type": "iban", "value": "GB33BUKB20201555555555"}'

Response:

{
  "valid": true,
  "type": "iban",
  "value": "GB33BUKB20201555555555",
  "details": {
    "country": "GB",
    "bank_code": "BUKB",
    "formatted": "GB33 BUKB 2020 1555 5555 55"
  }
}

Integration Example: Node.js Registration Form

async function validateRegistrationData(email, phone, country) {
  const apiKey = process.env.APIVULT_API_KEY;
 
  const [emailResult, phoneResult] = await Promise.all([
    validateField("email", email, apiKey),
    validateField("phone", phone, apiKey),
  ]);
 
  const errors = [];
  if (!emailResult.valid) errors.push("Invalid email address");
  if (!phoneResult.valid) errors.push("Invalid phone number");
 
  return { valid: errors.length === 0, errors };
}
 
async function validateField(type, value, apiKey) {
  const response = await fetch("https://api.apivult.com/v1/dev/dataforge/validate", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "X-API-Key": apiKey,
    },
    body: JSON.stringify({ type, value }),
  });
  return response.json();
}

Error Handling

Invalid inputs return valid: false with a reason field:

{
  "valid": false,
  "type": "email",
  "value": "not-an-email",
  "reason": "invalid_format"
}

Always check the valid field before processing user data. See the DataForge reference for the full list of reason codes.