Get Credit Balance (v2)

This API will tell you how many credits you have left on your account. It's simple, fast and easy to use.

Here are a few scenarios that businesses will use this API for.

  • You use our API to validate emails and you need to check within a certain time-frame when your credit balance is too low, so you can make a payment.
  • You want to track how many email validation credits you're using per your defined time-frame to generate useful statistical information.
  • You want to automate and integrate information into your application dashboard that shows you your currently remaining credit balance.

Below, you will find the instructions on how to use our API. It's very easy to use and it requires SSL.

GET /v2/getcredits

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

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
  • api_key
    Your API Key, found in your account.

Get Credit Balance Code Samples

  • 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_netTryDimapiKey ="Your Secret Key"DimapiURL ="https://api.zerobounce.net/v2/getcredits?api_key="&apiKey Dimrequest AsHttpWebRequest =DirectCast(WebRequest.Create(apiURL),HttpWebRequest)request.Timeout=150000request.Method ="GET"Usingresponse AsWebResponse =request.GetResponse()response.GetResponseStream().ReadTimeout =20000Usingostream AsNewStreamReader(response.GetResponseStream())responseString =ostream.ReadToEnd()EndUsingEndUsingCatchex asexception 'Catch Exception - All errors will be shown here - if there are issues with the APIEndTry
// 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-sharptry{stringapiKey ="Your Secret Key";stringapiURL ="https://api.zerobounce.net/v2/getcredits?api_key="+apiKey;HttpWebRequestrequest =(HttpWebRequest)WebRequest.Create(apiURL);request.Timeout =150000;request.Method ="GET";using(WebResponseresponse =request.GetResponse()){response.GetResponseStream().ReadTimeout =20000;using(StreamReaderostream =newStreamReader(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$apiKey='Your Secret Key';// use curl to make the request$url='https://api.zerobounce.net/v2/getcredits?api_key='.$apiKey;$ch=curl_init($url);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__javaimportjava.io.BufferedReader;importjava.io.InputStreamReader;importjava.net.HttpURLConnection;importjava.net.URL;publicclassMyClass{publicstaticvoidmain(String[]args){Stringkey ="Your Secret Key";StringtargetURL ="https://api.zerobounce.net/v2/getcredits?api_key="+key;HttpURLConnectionconnection =null;finalStringUSER_AGENT ="Mozilla/5.0";try{URLurl =newURL(targetURL);connection =(HttpURLConnection)url.openConnection();connection.setRequestMethod("GET");connection.addRequestProperty("User-Agent",USER_AGENT);connection.setUseCaches(false);connection.setDoOutput(true);BufferedReaderin =newBufferedReader(newInputStreamReader(connection.getInputStream()));StringinputLine;StringBufferresponse =newStringBuffer();while((inputLine =in.readLine())!=null){response.append(inputLine);}in.close();//print resultSystem.out.println(response.toString());}catch(Exceptione){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__pythonimportrequests
importjson target_url ="https://api.zerobounce.net/v2/getcredits?api_key="secret_key ="Your Secret Key"api_response =requests.get("%s%s"%(target_url,secret_key))data =json.loads(api_response.content)# prints the number of creditsprintdata["Credits"]
// Complete API Libraries and Wrappers can be found here: // https://www.zerobounce.net/docs/zerobounce-api-wrappers/#api_wrappers__v2__IOSletkey ="Your Secret Key"leturl =URL(string:String(format:"https://api.zerobounce.net/v2/getcredits?api_key=%@",key))lettask =URLSession.shared.dataTask(with:url!){(data,response,error)iniferror !=nil{NSLog("Error (String(describing: error))")}else{do{letparsedData =tryJSONSerialization.jsonObject(with:data!)as![String:Any]for(key,value)inparsedData {NSLog("(key)=(value) ")}}catch{print("Error deserializing JSON: (error)")}}}task.resume()
NSString *key =@"Your Secret Key";NSString *urlString =[NSString stringWithFormat:@"https://api.zerobounce.net/v2/getcredits?api_key=%@",key];__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 25useLibrary 'org.apache.http.legacy'}//------------------------------------------//Filename: JsonParser.javaimportandroid.os.AsyncTask;importorg.json.JSONObject;importjava.util.Iterator;publicclassMainActivityextendsAppCompatActivity{@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);newAsyncTaskParseJson().execute();}}publicclassAsyncTaskParseJsonextendsAsyncTask<String,String,String>{Stringkey ="Your Secret Key";Stringurl ="https://api.zerobounce.net/v2/getcredits?api_key="+key;@OverrideprotectedvoidonPreExecute(){}@OverrideprotectedStringdoInBackground(String...arg0){JsonParserjParser =newJsonParser();JSONObjectjson =jParser.getJSONFromUrl(url);Iteratorkeys =json.keys();while(keys.hasNext()){Stringkey =(String)keys.next();try{System.out.println("ZeroBounce: "+key+"="+json.get(key).toString());}catch(Exceptione){}}returnnull;}@OverrideprotectedvoidonPostExecute(StringstrFromDoInBg){}}//---------------------------------------------------//Filename: MainActivity.javapackagecom.zerobounce.zbapiandroid;importjava.io.BufferedReader;importjava.io.IOException;importjava.io.InputStream;importjava.io.InputStreamReader;importjava.io.UnsupportedEncodingException;importorg.apache.http.HttpEntity;importorg.apache.http.HttpResponse;importorg.apache.http.client.ClientProtocolException;importorg.apache.http.client.methods.HttpGet;importorg.apache.http.impl.client.DefaultHttpClient;importorg.json.JSONException;importorg.json.JSONObject;importandroid.util.Log;publicclassJsonParser{finalStringTAG ="JsonParser.java";staticInputStreamis =null;staticJSONObjectjObj =null;staticStringjson ="";publicJSONObjectgetJSONFromUrl(Stringurl){try{DefaultHttpClienthttpClient =newDefaultHttpClient();HttpGethttpGet =newHttpGet(url);HttpResponsehttpResponse =httpClient.execute(httpGet);HttpEntityhttpEntity =httpResponse.getEntity();is =httpEntity.getContent();}catch(UnsupportedEncodingExceptione){e.printStackTrace();}catch(ClientProtocolExceptione){e.printStackTrace();}catch(IOExceptione){e.printStackTrace();}try{BufferedReaderreader =newBufferedReader(newInputStreamReader(is,"iso-8859-1"),8);StringBuildersb =newStringBuilder();Stringline =null;while((line =reader.readLine())!=null){sb.append(line +"
");}is.close();json =sb.toString();}catch(Exceptione){Log.e(TAG,"Error converting result "+e.toString());}try{jObj =newJSONObject(json);}catch(JSONExceptione){Log.e(TAG,"Error parsing data "+e.toString());}returnjObj;}}

This API will tell you how many credits you have left on your account. It's simple, fast and easy to use.

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

https://api.zerobounce.net/v2/getcredits?api_key=[replacewithyours]

This API will tell you how many credits you have left on your account.

The API will return these results in a JSON format using the "getcredits" method. credits - The amount of credits you have left in your account for email validations. If a -1 is returned, that means your API Key is invalid.

Endpoint Response

This API will tell you how many credits you have left on your account. It's simple, fast and easy to use.

Successful Response

{"Credits":2375323}

Error Response

{"Credits":-1}