Single Email Validator - Real time (v2)

Below you will find the instructions on how to use our API, it's very easy to use and requires SSL. The API requires that you have an active credit balance and will never consume a credit for any unknown result.

To test out or API without using credits - Please use the emails provided in our Sandbox Mode (v2)

The response time for our API is between one second and 70 seconds. Since API's are meant to be fast by nature, we limit the amount of time we spend validating an email address. So if we encounter a slow mail server or a mail server with a greylisting algorithm you will get an unknown result. You can always re-validate those conditions, uploading a file to the bulk email validator.

On average 96-98% of all domains will return in 1 to 5 seconds, there are a handful of domains that run off Postfix/Dovecot that have a 20 second connection time for real-time validations and a very small fractional percentage of other domains that are very slow to respond to SMTP inquiries. All the major ISP will return in 1 to 3 seconds, which is usually the majority of most email distribution.

- GET /v2/validate

API URL: https://api.zerobounce.net/v2/validate

Below you will find the instructions on how to use our API, it's very easy to use and requires SSL. The API requires that you have an active credit balance and will never consume a credit for any unknown result.

URL Parameters

  • Parameter
    Description
  • email
    The email address you want to validate
  • ip_address
    The IP Address the email signed up from (Can be blank, but parameter required)
  • api_key
    Your API Key, found in your account.

If you want to call the API from your browser to test it, all you need to do is to replace the API KEY with your key:

  • https://api.zerobounce.net/v2/validate?api_key=replacewithyours&email=valid@example.com&ip_address=156.124.12.145

To verify an email address, use the following codes for the following languages:

  • Visual Basic
  • C#
  • PHP
  • Java
  • Python
  • Swift
  • Objective C
  • Android Java

        
  ' Complete API Libraries and Wrappers can be found here: 
  ' https://www.zerobounce.net/docs/zerobounce-api-wrappers/#api_wrappers__v2__dot_net

  Try
    Dim api_key as string = "Your Secret Key"
    Dim emailToValidate as string = "example@example.com"
    Dim ip_address = "" 'Can be blank, but parameter required on the API Call
    Dim responseString as string = ""
  
    Dim apiURL as string = "https://api.zerobounce.net/v2/validate?api_key=" & api_key & "&email=" &  HttpUtility.UrlEncode(emailToValidate) & "&ip_address=" & System.Net.WebUtility.UrlEncode(ip_address)
  
    Dim request As HttpWebRequest = DirectCast(WebRequest.Create(apiURL), HttpWebRequest)
    request.Timeout = 150000
    request.Method = "GET"
  
    Using response As WebResponse = request.GetResponse()
        response.GetResponseStream().ReadTimeout = 20000
        Using ostream As New StreamReader(response.GetResponseStream())
            responseString = ostream.ReadToEnd()
        End Using
    End Using
  Catch ex as exception
  'Catch Exception - All errors will be shown here - if there are issues with the API
  End Try
      

// Complete API Libraries and Wrappers can be found here: 
// https://www.zerobounce.net/docs/zerobounce-api-wrappers/#api_wrappers__v2__dot_net
// https://www.zerobounce.net/docs/zerobounce-api-wrappers/#api_wrappers__v2__c-sharp

try {
  string api_key = "Your Secret Key";
  string emailToValidate = "example@example.com";
  string ip_address = "" //Can be blank, but parameter required on the API Call
  
  string responseString = "";
  
  string apiURL = "https://api.zerobounce.net/v2/validate?api_key=" + api_key + "&email=" +  HttpUtility.UrlEncode(emailToValidate) + "&ip_address=" + HttpUtility.UrlEncode(ip_address);
  
  
      HttpWebRequest request = (HttpWebRequest)WebRequest.Create(apiURL);
      request.Timeout = 150000;
      request.Method = "GET";
  
      using (WebResponse response = request.GetResponse()) {
          response.GetResponseStream().ReadTimeout = 20000;
          using (StreamReader ostream = new StreamReader(response.GetResponseStream())) {
              responseString = ostream.ReadToEnd();
          }
      }
      } catch (exception ex) {
  //Catch Exception - All errors will be shown here - if there are issues with the API
  }
      

  <?php

  // Complete API Libraries and Wrappers can be found here: 
  // https://www.zerobounce.net/docs/zerobounce-api-wrappers/#api_wrappers__v2__php

  //set the api key and email to be validated
  $api_key = 'Your Secret Key';
  $emailToValidate = 'example@example.com';
  $IPToValidate = '99.123.12.122';
  // use curl to make the request
  $url = 'https://api.zerobounce.net/v2/validate?api_key='.$api_key.'&email='.urlencode($emailToValidate).'&ip_address='.urlencode($IPToValidate);

  $ch = curl_init($url);
  //PHP 5.5.19 and higher has support for TLS 1.2
  curl_setopt($ch, CURLOPT_SSLVERSION, 6);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15); 
  curl_setopt($ch, CURLOPT_TIMEOUT, 150); 
  $response = curl_exec($ch);
  curl_close($ch);

  //decode the json response
  $json = json_decode($response, true);
  ?>
      
      


  //Complete API Libraries and Wrappers can be found here: 
  //https://www.zerobounce.net/docs/zerobounce-api-wrappers/#api_wrappers__v2__java

  import java.io.BufferedReader;
  import java.io.InputStreamReader;
  import java.net.HttpURLConnection;
  import java.net.URL;

  public class MyClass {

      public static void main(String[] args){

          String key = "Your Secret Key";
          String email = "example@example.com";
          String ip = "99.123.12.122"; //ip address can be blank
          String targetURL = "https://api.zerobounce.net/v2/validate?api_key="+key+"&email="+email+"&ip_address="+ip;


          HttpURLConnection connection = null;
          final String USER_AGENT = "Mozilla/5.0";

          try {
              URL url = new URL(targetURL);
              connection = (HttpURLConnection) url.openConnection();
              connection.setRequestMethod("GET");
              connection.addRequestProperty("User-Agent", USER_AGENT);
              connection.setUseCaches(false);
              connection.setDoOutput(true);

              BufferedReader in = new BufferedReader(
                      new InputStreamReader(connection.getInputStream()));
              String inputLine;
              StringBuffer response = new StringBuffer();

              while ((inputLine = in.readLine()) != null) {
                  response.append(inputLine);
              }
              in.close();

              //print result
              System.out.println(response.toString());

          } catch (Exception e) {
              e.printStackTrace();
          } finally {
              if (connection != null) {
                  connection.disconnect();
              }
          }

      }
  }
      

  # Complete API Libraries and Wrappers can be found here: 
  # https://www.zerobounce.net/docs/zerobounce-api-wrappers/#api_wrappers__v2__python
  
  url = "https://api.zerobounce.net/v2/validate"
  api_key = "Your Secret Key"
  email = "example@example.com"
  ip_address = "99.123.12.122" #ip_address can be blank
  
  params = {"email": email, "api_key": api_key, "ip_address":ip_address}
  
  response = requests.get(url, params=params)
  
  # Print the returned json
  print json.loads(response.content)
  
      


  // Complete API Libraries and Wrappers can be found here: 
  // https://www.zerobounce.net/docs/zerobounce-api-wrappers/#api_wrappers__v2__IOS

  let key = "Your Secret Key"
  let email = "example@example.com"
  let ip = "99.123.12.122" //ip address can be blank
  let url = URL(string: String(format: "https://api.zerobounce.net/v2/validate?api_key=%@&email=%@&ip_address=%@", key, email, ip))
  let task = URLSession.shared.dataTask(with: url!) { (data, response, error) in
      if error != nil {
          NSLog("Error (String(describing: error))")
      } else {
          do {
              let parsedData = try JSONSerialization.jsonObject(with: data!) as! [String:Any]
              for (key, value) in parsedData {
                  NSLog("(key) = (value) ")
              }
          } catch {
              print("Error deserializing JSON: (error)")
          }
      }
  }
  task.resume()      
      


  // Complete API Libraries and Wrappers can be found here: 
  // https://www.zerobounce.net/docs/zerobounce-api-wrappers/#api_wrappers__v2__IOS

  NSString *key = @"Your Secret Key";
  NSString *email = @"example@example.com";
  NSString *ip = @"99.123.12.122"; //ip address can be blank
  
  NSString *urlString = [NSString stringWithFormat:@"https://api.zerobounce.net/v2/validate?api_key=%@&email=%@&ip_address=%@", key, email, ip];
  
  __block NSURL *url = [NSURL URLWithString:urlString];
  
  dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  
      NSData *response = [NSData dataWithContentsOfURL:url];
      NSDictionary *arrResponse = nil;
      if(response!=nil)
      {
          arrResponse = [NSJSONSerialization JSONObjectWithData: response options:kNilOptions error:nil];
      }
      dispatch_async(dispatch_get_main_queue(), ^(void) {
          for(NSString *key in [arrResponse allKeys]) {
              NSLog(@"%@: %@",key,[arrResponse objectForKey:key]);
          }
  //            callback(nil, arr);
      });
  });
      



  // Complete API Libraries and Wrappers can be found here: 
  // https://www.zerobounce.net/docs/zerobounce-api-wrappers/#api_wrappers__v2__android

  //Add to build.gradle (App) in the "android" bracket:
  useLibrary 'org.apache.http.legacy'
  
  Example:
  
  android {
      compileSdkVersion 25
      useLibrary 'org.apache.http.legacy'
  }
  
  //-----------------------------------
  //Filename: JsonParser.java
  
  
  import android.os.AsyncTask;
  import org.json.JSONObject;
  import java.util.Iterator;
  
  public class MainActivity extends AppCompatActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          new AsyncTaskParseJson().execute();
      }
  }
  
  public class AsyncTaskParseJson extends AsyncTask<String, String, String> {
  
      String key = "Your Secret Key";
      String email = "example@example.com";
      String ip = "99.123.12.122"; //ip address can be blank
      String url = "https://api.zerobounce.net/v2/validate?api_key="+key+"&email="+email+"&ip_address="+ip;
  
      @Override
      protected void onPreExecute() {
      }
  
      @Override
      protected String doInBackground(String... arg0) {
  
          JsonParser jParser = new JsonParser();
          JSONObject json = jParser.getJSONFromUrl(url);
          Iterator keys = json.keys();
          while( keys.hasNext() ) {
              String key = (String)keys.next();
              try {
                  System.out.println("ZeroBounce: "+key+" = " +json.get(key).toString());
              }
              catch (Exception e){}
          }
  
          return null;
      }
      @Override
      protected void onPostExecute(String strFromDoInBg) {}
  }
  
  //----------------------------------
  //Filename: MainActivity.java
  
  package com.zerobounce.zbapiandroid;
  
  import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.InputStreamReader;
  import java.io.UnsupportedEncodingException;
  
  import org.apache.http.HttpEntity;
  import org.apache.http.HttpResponse;
  import org.apache.http.client.ClientProtocolException;
  import org.apache.http.client.methods.HttpGet;
  import org.apache.http.impl.client.DefaultHttpClient;
  import org.json.JSONException;
  import org.json.JSONObject;
  
  import android.util.Log;
  
  public class JsonParser {
  
      final String TAG = "JsonParser.java";
  
      static InputStream is = null;
      static JSONObject jObj = null;
      static String json = "";
  
      public JSONObject getJSONFromUrl(String url) {
  
          try {
  
              DefaultHttpClient httpClient = new DefaultHttpClient();
              HttpGet httpGet = new HttpGet(url);
  
              HttpResponse httpResponse = httpClient.execute(httpGet);
              HttpEntity httpEntity = httpResponse.getEntity();
              is = httpEntity.getContent();
  
          } catch (UnsupportedEncodingException e) {
              e.printStackTrace();
          } catch (ClientProtocolException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          }
  
          try {
  
              BufferedReader reader = new BufferedReader(new InputStreamReader(is, "iso-8859-1"), 8);
              StringBuilder sb = new StringBuilder();
              String line = null;
              while ((line = reader.readLine()) != null) {
                  sb.append(line + "
");
              }
              is.close();
              json = sb.toString();
  
          } catch (Exception e) {
              Log.e(TAG, "Error converting result " + e.toString());
          }
  
          try {
              jObj = new JSONObject(json);
          } catch (JSONException e) {
              Log.e(TAG, "Error parsing data " + e.toString());
          }
  
          return jObj;
      }
    }
      

Successful Response

      
  {
    "address":"flowerjill@aol.com",
    "status":"valid",
    "sub_status":"",
    "free_email":true,
    "did_you_mean":null,
    "account":"flowerjill",
    "domain":"aol.com",
    "domain_age_days": "8426",
    "smtp_provider":"yahoo",
    "mx_record":"mx-aol.mail.gm0.yahoodns.net",
    "mx_found": true,
    "firstname":"Jill",
    "lastname":"Stein",
    "gender":"female",
    "country":"United States",
    "region":"Florida",
    "city":"West Palm Beach",
    "zipcode":"33401",
    "processed_at":"2017-04-01 02:48:02.592"
    }
      

Error Response

      
      {"error":"Invalid API Key or your account ran out of credits"}
      // Failure response sample using the API with either method Get
      

The API will return these results in a JSON format using the "Validate" method.

JSON Properties

  • Properties
    Description
  • address
    The email address you are validating.
  • status
    [valid, invalid, catch-all, unknown, spamtrap, abuse, do_not_mail]
  • sub_status
    [antispam_system,
    greylisted, mail_server_temporary_error, forcible_disconnect, mail_server_did_not_respond, timeout_exceeded, failed_smtp_connection, mailbox_quota_exceeded, exception_occurred, possible_traps, role_based, global_suppression, mailbox_not_found, no_dns_entries, failed_syntax_check, possible_typo, unroutable_ip_address, leading_period_removed, does_not_accept_mail, alias_address, role_based_catch_all, disposable, toxic]
  • account
    The portion of the email address before the "@" symbol.
  • domain
    The portion of the email address after the "@" symbol.
  • did_you_mean
    Suggestive Fix for an email typo
  • domain_age_days
    Age of the email domain in days or [null].
  • free_email
    [true/false] If the email comes from a free provider.
  • mx_found
    [true/false] Does the domain have an MX record.
  • mx_record
    The preferred MX record of the domain
  • smtp_provider
    The SMTP Provider of the email or [null] [BETA].
  • firstname
    The first name of the owner of the email when available or [null].
  • lastname
    The last name of the owner of the email when available or [null].
  • gender
    The gender of the owner of the email when available or [null].
  • city
    The city of the IP passed in.
  • region
    The region/state of the IP passed in.
  • zipcode
    The zipcode of the IP passed in.
  • country
    The country of the IP passed in.
  • Processed_at
    The UTC time the email was validated.