EmailReputationAPI Documentation
Validating domains using EmailReputationAPI couldn't be easier; after generating a unique API key,
you'll interact with the https://emailreputationapi.com/api/v1/validate
endpoint, passing the domain/email
via a secure customer header named email
. Your API key will be securely passed to our server
via a bearer token header.
Generating Your API Key
After starting a trial, head over to the dashboard to generate an API key.
EmailReputationAPI Libraries
Laravel users can install the EmailReputationAPI package via Composer. The package is open source and available on GitHub:
API Requests
The API is pretty straightforward in that all you need to do is make a POST request to the https://emailreputationapi.com/api/v1/validate
endpoint, passing the domain or email address you want to validate in the email
header. Here is an PHP example that doesn't require any dependencies:
function makePostRequest($url, $token, $email) { $boundary = uniqid(); $delimiter = '-------------' . $boundary; // Create the header for multipart form data $data = '--' . $delimiter . "\r\n" . 'Content-Disposition: form-data; name="email"' . "\r\n\r\n" . $email . "\r\n" . '--' . $delimiter . '--' . "\r\n"; $headers = [ 'Authorization: Bearer ' . $token, 'Content-Type: multipart/form-data; boundary=' . $delimiter, 'Content-Length: ' . strlen($data) ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $response = curl_exec($ch); if (curl_errno($ch)) { throw new Exception('Error making POST request: ' . curl_error($ch)); } curl_close($ch); return $response; } // URL and token $url = 'https://emailreputationapi.com/api/v1/validate'; $token = 'YOUR-TOKEN-HERE'; $email = '[email protected]'; try { $response = makePostRequest($url, $token, $email); echo 'Response: ' . $response; } catch (Exception $e) { echo 'Error: ' . $e->getMessage(); }
API Responses
The EmailReputationAPI API will perform (at a minimum) two checks on the domain you submit:
- Syntax Validity: A lead e-mail or domain is useless if it's syntactically invalid. Examples of invalid syntax
include:
willATexample-.com
,example .com
,[email protected]
,example@@com
, andexample.com@
. - Domain Type: Each domain is compared to the EmailReputationAPI database to determine whether it is associated with a personal or disposal (anonymized) e-mail service. If the domain is not of type personal or anonymized, the service may be able to classify it as being of type business or government. If all of these checks fail, the domain is classified as unknown.
Let's walk through several response scenarios.
Invalid Domain Syntax
If the client submits a domain that is syntactically invalid such as [email protected]
, the server will return a 400 response with a JSON payload
that looks like this:
{ "email": ".org", "syntax": "invalid" }
Invalid Top-Level Domain (TLD)
If the client submits a domain with an invalid top-level domain (TLD) such as nebraskacorn.corn
, the server will return a 200 response with a JSON payload that looks like this:
{ "email": "nebraska.corn", "syntax": "valid", "tld": "false", "personal": "false", "disposable": "false", "business": "false", "government": "false", "unknown": "true" }
Personal Domain Identified
If the client submits an email address or domain that is identified as a personal domain, the server will return a
200 response with a JSON payload setting the personal
attribute to true
:
{ "email": "hotmail.com", "syntax": "valid", "tld": "true", "personal": "true", "disposable": "false", "government": "false", "business": "false", "unknown": "false" }
Disposable Domain Identified
If the client submits an email address or domain that is identified as a disposable domain, the server will return a
200 response with a JSON payload setting the disposable
to true
:
{ "email": "sharklasers.com", "syntax": "valid", "tld": "true", "personal": "false", "disposable": "true", "government": "false", "business": "false", "unknown": "false" }
Business Domain Identified
If the client submits an email address or domain that is identified as a business domain, the server will return a
200 response with a JSON payload setting the business
to true
:
{ "email": "kona-ice.com", "syntax": "valid", "tld": "true", "personal": "false", "disposable": "true", "government": "false", "business": "true", "unknown": "false" }
Business Domain Identified
If the client submits an email address or domain that is identified as a business domain, the server will return a
200 response with a JSON payload setting the business
to true
:
{ "email": "kona-ice.com", "syntax": "valid", "tld": "true", "personal": "false", "disposable": "true", "government": "false", "business": "true", "unknown": "false" }
Unknown Domain Identified
A domain will be identified as of type unknown
when our system does not
identify it as being associated with a known domain. Keep in mind that while our database is
quite comprehensive and regularly updated, it is not exhaustive.
Our system is tracking a growing number of government and business domains, and if the submitted domain is further
identified, the subtype
key will contain additional info. Here is an example:
{ "email": "example.com", "syntax": "valid", "tld": "true", "personal": "false", "disposable": "false", "business": "false", "government": "false", "unknown": "true" }