DEV Community

Rijul
Rijul

Posted on

I Built a Batch Validation API That Replaces 10 Different APIs in One Call

If you've ever built a form backend or an automation workflow,
you know the pain: you need to validate an email, a phone number,
an IBAN, a credit card, and a URL — and you end up calling five
different APIs to do it.

I built MultiValidator to fix that. One API call. Up to 50 fields.
13 format types. Here's how it works and how I built it in a weekend.

What it does

Send a batch of fields, get back validation results for all of them:

import requests

payload = {
    "fields": [
        {"type": "email", "value": "user@example.com", "field_name": "email"},
        {"type": "phone", "value": "+447911123456", "field_name": "mobile"},
        {"type": "iban", "value": "GB29NWBK60161331926819", "field_name": "bank"},
        {"type": "credit_card", "value": "4111111111111111", "field_name": "card"},
        {"type": "url", "value": "https://example.com", "field_name": "website"}
    ]
}

response = requests.post(
    "https://multivalidator-batch-format-validation.p.rapidapi.com/validate/batch",
    json=payload,
    headers={"X-RapidAPI-Key": "YOUR_KEY"}
)

print(response.json())
Enter fullscreen mode Exit fullscreen mode

Response:

{
  "results": [
    {"field_name": "email", "valid": true, "detail": "Valid email format"},
    {"field_name": "mobile", "valid": true, "detail": "Valid GB mobile number"},
    {"field_name": "bank", "valid": true, "detail": "Valid IBAN — country code GB"},
    {"field_name": "card", "valid": true, "detail": "Valid card number — Visa"},
    {"field_name": "website", "valid": true, "detail": "Valid URL using https"}
  ],
  "summary": {"total": 5, "valid": 5, "invalid": 0},
  "processing_ms": 3.42
}
Enter fullscreen mode Exit fullscreen mode

One call. Five fields validated. Summary included.

The 13 supported formats

email, phone (200+ countries), IBAN, EU VAT, credit card
(with Luhn checksum), UK postcode, US ZIP, URL, UUID,
IPv4/IPv6, SSN, EIN, ISO dates.

How I built it

Stack: Python, FastAPI, Railway, RapidAPI

Libraries that did the heavy lifting:

  • python-stdnum — handles IBAN, VAT, SSN, EIN with proper checksum validation
  • phonenumbers — Google's library, handles 200+ countries
  • diffprivlib — not used here but I've used it in other projects
  • slowapi — rate limiting in one line on top of FastAPI

The core is a validator registry — a dict that maps format
type strings to validator functions:

VALIDATORS = {
    "email": validate_email,
    "phone": validate_phone,
    "iban": validate_iban,
    "credit_card": validate_credit_card,
    # ... 9 more
}

def validate(format_type: str, value: str) -> dict:
    fn = VALIDATORS.get(format_type.lower())
    if fn is None:
        return {"valid": False, "detail": f"Unknown format '{format_type}'"}
    return fn(value)
Enter fullscreen mode Exit fullscreen mode

The batch endpoint just loops over the fields array and calls
this for each one. The whole thing is under 200 lines of code.

Deployment: pushed to GitHub, connected to Railway,
auto-deployed. Live in about 90 seconds.

Listing: added to RapidAPI with a free tier (100 req/day),
Basic ($9/mo), and Pro ($29/mo).

Total time from idea to live API: one day.
Total cost: $0.

Why batch matters

Most validation APIs are single-format. You need a different
endpoint — often a different provider — for each field type.
That means:

  • Multiple API keys to manage
  • Multiple rate limits to track
  • Multiple failure points in your pipeline
  • More latency from sequential calls

MultiValidator sends everything in one request and returns
a summary with valid/invalid counts. Your form backend makes
one call and knows exactly which fields to reject.

What I learned

This was my first time shipping a paid API product. A few things
stood out:

FastAPI is excellent for this. Auto-generated docs at /docs,
Pydantic validation, rate limiting with slowapi — everything
just works.

python-stdnum is underrated. It handles IBAN checksum
validation, EU VAT formats across all countries, SSN invalid
range detection — all out of the box. I expected to write a lot
of regex. I barely wrote any.

Railway is genuinely zero-friction deployment. Connect GitHub
repo, done. Auto-deploys on every push.

The hardest part wasn't the code. It was deciding what
formats to include and what the response schema should look like.
API design decisions feel small but they're what users actually
interact with.

Try it

The API is live on RapidAPI with a free tier — 100 requests/day,
no credit card required.

Search MultiValidator Batch Format Validation on RapidAPI
or find it at:
rapidapi.com/rijul.ssh/api/multivalidator-batch-format-validation

Happy to answer questions about the build in the comments.

Top comments (0)