EmailAPI Documentation
Just add your API KEY
API Request
- HTTP
- http or https
- APIKEY
- Unique account identifier received after signup
- Email Address to validate.
http://emailapi.com/api/APIKEY/EMAIL
Example Request GET
https://emailapi.com/api/APIKEY/hello@emailapi.com
API Response
We return the the following fields:
Status
status
(boolean) Is the email address valid and deliverable?
message
(string) Status Reason
disposable
(boolean) Is the email address disposable?
role
(boolean) Is the email address a role? (support, admin, contact, etc)
Email Information
email
(string) The email address string.
user
(string) The first portion of the email address, also known as the user name or mailbox. This is the unique name recognized by the mail server.
sub
(string) sub-addressing, but it is also known as plus addressing or tagged addressing.
domain
(string) The domain name part of an email address.
tld
The last part of the email address, .com, is the top-level domain (TLD).
Example Response JSON
{ "data": { "email": "hello@emailapi.com", "user": "hello", "domain": "emailapi.com", "tld": ".com", "sub": false, "role": true, "catchall": false, "disposable": false, "status": true } }
Errors
The API makes use of standard HTTP response status codes to indicate the success or failure of a request. The 2xx series of response codes indicate a success, 4xx indicates an error from the client side, and a 5xx error indicates a server side error. Here are the HTTP response codes the API utilizes:
HTTP status code | Reason |
---|---|
200 - OK | Everything worked as expected. Standard response for successful HTTP requests. |
400 - Bad Request | The request was unacceptable, the server cannot process the request, often due to missing a required parameter. |
401 - Unauthorized | When no or invalid authentication details are provided. API Key Invalid. |
404 - Not Found | The requested resource could not be found. |
500 - Server Error | Something went wrong on our end. (This is rare.) |
Error Response JSON
{ "error": { "code": "401", "message": "API Key Invalid" } }
Sample Code
curl
curl "http://emailapi.com/api/APIKEY/EMAIL";
PHP
<?php $email = 'hello@emailapi.com'; $request = file_get_contents("http://emailapi.com/api/APIKEY/$email"); $result = json_decode($request, true); print_r($result); ?>
PHP using curl
<?php $email = 'hello@emailapi.com'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://emailapi.com/api/APIKEY/$email"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); $result = curl_exec($ch); curl_close($ch); print_r($result); ?>
Javascript
<script> var email = encodeURIComponent('test@emailapi.com').replace(/%20/g,'+'); var xhr = new XMLHttpRequest(); xhr.open('GET', 'http://emailapi.com/api/APIKEY/'+email, false); xhr.send(); if (xhr.status == 200) { var result = JSON.parse(xhr.responseText); console.log(result); } </script>
Javascript using jQuery
<script> $(document).ready(function() { var email = encodeURIComponent('test@emailapi.com').replace(/%20/g,'+'); $.get('http://emailapi.com/api/APIKEY/'+email, function(data) { console.log(data); }); }); </script>
Python
import requests url = 'http://emailapi.com/api/v1/json/APIKEY' email = 'test@emailapi.com' r = requests.get(url, params={'email': email}) data = r.json()
Ruby
require 'net/http' require 'json' email = 'test@emailapi.com' url = 'http://emailapi.com/api/v1/json/APIKEY/email' uri = URI(url) response = Net::HTTP.get(uri) JSON.parse(response)
Node.js
var request = require('request'); var email = 'test@emailapi.com'; var url = 'http://emailapi.com/api/v1/json/APIKEY/email'; request(url, function (error, response, body) { if (!error && response.statusCode == 200) { var data = JSON.parse(body); } });