How Abstract API Handles Email Validation in Yup
Abstract API addresses the core weaknesses of traditional validation methods through multi-layer checks that extend beyond simple syntax rules.
- It performs multi-layer checks for syntax, typos, MX records, and SMTP responses, and it provides a risk score based on machine learning.
- It provides a real-time deliverability flag and a numeric quality score to inform rejection or throttling logic.
- It detects disposable, role-based, and catch-all email addresses so you can block or triage risky sign-ups.
How to Bring Abstract API to Your Dev Environment
Once you understand Abstract's capabilities, you can add its email validation API to your project with a simple process.
- Install Yup and Axios with npm.
- Create a free Abstract account and copy your Email Validation API key.
- Add your ABSTRACT_KEY to a dot-env file or secret manager.
- Write a helper function that calls the Abstract API endpoint with your key and the user's email.
- Add an asynchronous Yup test that awaits the helper and checks for a "DELIVERABLE" status and a non-disposable address.
- Use the schema in your controller or form. Yup will reject the promise if the API flags the address as risky.
Sample Email Validation Implementation with Abstract API
The code above defines a function, checkEmail, that sends a user's email to Abstract API. It returns "true" only if the API confirms the address is "DELIVERABLE" and not disposable. This function integrates into a Yup schema via the asynchronous .test method. This process layers real-time deliverability checks on top of Yup's standard syntax validation.
The API returns a detailed JSON object. Key fields like "deliverability" and "quality_score" tell you whether to accept, refuse, or flag an email. Other boolean flags for disposable, role-based, or catch-all addresses give you fine-grained control to filter sign-ups and protect your platform.
Final Thoughts
Traditional email validation often relies on syntax checks that approve undeliverable or temporary addresses. This method creates gaps for bad data and potential fraud.
Abstract API closes these gaps with real-time checks for deliverability and address type. For reliable user validation, create a free account on Abstract API and get your API key.
Frequently Asked Questions
What does Yup's built-in email() method actually check?
Yup's string().email() method validates email format using a permissive regex pattern that mirrors browser input validation. It catches obvious formatting errors but is intentionally lenient, which means it can accept malformed addresses like user@example.com..au and treats empty strings as valid unless you also chain .required().
How do I apply a stricter regex pattern for email validation in Yup?
Use Yup's matches() method to pass a custom regular expression, which lets you enforce rules such as forbidding double dots or restricting domains to an internal zone. You can also set the excludeEmptyString option to handle optional email fields cleanly without needing a separate required() call.
Can I use validator.js with Yup for RFC-compliant email validation?
Yes. You can wrap validator.js inside Yup's test() function to delegate the format check to a library that follows RFC 5322 more thoroughly than a hand-rolled regex. This gives you the reliability of a battle-tested external library while keeping Yup's declarative schema structure.
Why can't local Yup validation confirm whether an email address is real?
All local approaches (built-in email(), custom regex, or validator.js) only check syntax and cannot verify whether a domain exists, has valid MX records, or whether the inbox is active. This means a perfectly formatted address like nobody@fakeddomain.xyz passes every local check even though no mail will ever be delivered.
How do you integrate Abstract's Email Validation API into a Yup schema?
Add an async test() call to your schema that sends the value to Abstract's emailvalidation.abstractapi.com/v1 endpoint and returns true only when data.deliverability === 'DELIVERABLE' and data.is_disposable_email.value is false. This layers real deliverability checking on top of Yup's standard syntax validation with minimal extra code.
What extra signals does Abstract return beyond a pass/fail result?
The API response includes a quality_score, a deliverability flag, and boolean fields indicating whether the address is disposable, role-based, or a catch-all inbox. This granular data lets you apply different rules per use case: for example, blocking disposable addresses at sign-up while still allowing catch-all domains for B2B contact forms.


