AI Scoring API

The ZeroBounce AI Scoring API combines a vast selection of data with proven statistical analysis to granularity rate the quality level of an email address. The software identifies positive and negative patterns of an email address and returns a score that users can rely on when performing their email hygiene. The methodology of ZeroBounce A.I. periodically adjusts as email trends evolve.

Get an in-depth look into the quality of your leads by learning more about your subscribers’ online activity. With the added information you can segment your lists to better serve your customers with targeted messaging. If you want to further segment your email list based on Quality Score, we recommend validating your "valid" file also.

Recommended File management endpoint for AI Scoring

Recommended File management endpoint usage
Recommended File management endpoint usage

AI Scoring API: Send File

/ai-scoring-api/send-file/

The scoring sendfile API allows a user to send a file for bulk email scoring. The content type needs to be multipart/form-data. Please refer to the C# example for details.

POST /V2/SCORING/SENDFILE

API URL: https://bulkapi.zerobounce.net/v2/scoring/sendfile

URL Parameters

  • Parameter
    Required/Optional
    Description
  • file
    Required
    The csv or txt file. Byte array contents for the submitted file. The content's header is type of "text/csv"
  • api_key
    Required
    Your API Key, found in your account
  • email_address_column
    Required
    The column index of the email address in the file. Index starts at 1
  • return_url
    Optional
    The URL will be used as a callback when the scoring service is completed
  • has_header_row
    Optional
    If the first row from the submitted file is a header row. True or False

If a return_url was specified in the Multipart Form Data during the send file request, we will POST the following data to the URL when the validation process is complete.

{file_id": "aaaaaaaa-zzzz-xxxx-yyyy-5003727fffff","file_name":"Your file name.csv","upload_date":"10/20/2018 4:35:58 PM"}

Send File Code Samples

  • Visual Basic
  • C#
  • PHP
  • Java
  • Python
  • Swift
  • Objective C
  • Android Java
' Send File Sample in VB.netPublicClassSendFileStatus PublicPropertysuccess AsBooleanPublicPropertymessage AsStringPublicPropertyfile_name AsStringPublicPropertyfile_id AsStringEndClassPrivateSharedSubSendFileAPITest()DimfileFullPath AsString=$"full file path of a csv or txt file"' requiredDimapiKey AsString="replace with your api key here"' requiredDimemailAddressColumn AsInteger=2' requiredDimipAddressColumn AsInteger? =11' optionalDimhasHeaderRow AsBoolean? =True' optionalDimreturnUrl AsString=Nothing' optionalTryDimsendFileStatus AsSendFileStatus =SendFile(fileFullPath,apiKey,emailAddressColumn,ipAddressColumn,hasHeaderRow,returnUrl).Result Console.Write(JsonConvert.SerializeObject(sendFileStatus,Formatting.Indented))Catchex AsException Console.Write(ex.InnerException.Message)EndTryConsole.ReadKey()EndSubPublicSharedAsync FunctionSendFile(ByValfileFullPath AsString,ByValapiKey AsString,ByValemailAddressColumn AsInteger,ByValOptionalipAddressColumn AsInteger? =Nothing,ByValOptionalhasHeaderRow AsBoolean? =Nothing,ByValOptionalreturnUrl AsString=Nothing)AsTask(OfSendFileStatus)IfString.IsNullOrEmpty(fileFullPath)ThenThrowNewException("Error: fileFullPath is required")IfString.IsNullOrEmpty(apiKey)ThenThrowNewException("Error: apiKey is required")Dimfi =NewFileInfo(fileFullPath)DimfileContents =File.ReadAllBytes(fi.FullName)DimfileName =fi.NameDimuri AsUri =NewUri("https://bulkapi.zerobounce.net/v2/scoring/sendfile")Usingclient =NewHttpClient()Usingrequest =NewHttpRequestMessage(HttpMethod.Post,uri)DimmultiPartContent AsMultipartFormDataContent =NewMultipartFormDataContent()DimbyteArrayContent AsByteArrayContent =NewByteArrayContent(fileContents)byteArrayContent.Headers.Add("Content-Type","text/csv")multiPartContent.Add(byteArrayContent,"file",fileName)multiPartContent.Add(NewStringContent(apiKey),"api_key")multiPartContent.Add(NewStringContent(emailAddressColumn.ToString()),"email_address_column")IfipAddressColumn IsNotNothingThenmultiPartContent.Add(NewStringContent(ipAddressColumn.ToString()),"ip_address_column")IfhasHeaderRow IsNotNothingThenmultiPartContent.Add(NewStringContent(If((hasHeaderRow =True),"true","false")),"has_header_row")IfreturnUrl IsNotNothingThenmultiPartContent.Add(NewStringContent(returnUrl.ToString()),"return_url")request.Content =multiPartContent Usingresponse =Await client.SendAsync(request,HttpCompletionOption.ResponseContentRead,CancellationToken.None).ConfigureAwait(False)Dimcontent =Await response.Content.ReadAsStringAsync()Ifresponse.IsSuccessStatusCode =FalseThenDimerrorAsString=$"StatusCode ={CInt(response.StatusCode)},Content ={content}" ThrowNewException(error)EndIfReturnJsonConvert.DeserializeObject(OfSendFileStatus)(content)EndUsingEndUsingEndUsingEndFunction
// Send File Sample in C#publicclassSendFileStatus{publicboolsuccess {get;set;}publicstringmessage {get;set;}publicstringfile_name {get;set;}publicstringfile_id {get;set;}}privatestaticvoidSendFileAPITest(){stringfileFullPath =$"full file path of a csv or txt file";//requiredstringapiKey ="replace with your api key here";//required intemailAddressColumn =2;//requiredint?ipAddressColumn =11;//optionalbool?hasHeaderRow =true;//optionalstringreturnUrl =null;//optionaltry{SendFileStatussendFileStatus =SendFile(fileFullPath,apiKey,emailAddressColumn,ipAddressColumn,hasHeaderRow,returnUrl).Result;Console.Write(JsonConvert.SerializeObject(sendFileStatus,Formatting.Indented));}catch(Exceptionex){Console.Write(ex.InnerException.Message);}Console.ReadKey();}publicstaticasyncTask<SendFileStatus>SendFile(stringfileFullPath,stringapiKey,intemailAddressColumn,int?ipAddressColumn =null,bool?hasHeaderRow =null,stringreturnUrl =null){if(string.IsNullOrEmpty(fileFullPath))thrownewException("Error: fileFullPath is required");if(string.IsNullOrEmpty(apiKey))thrownewException("Error: apiKey is required");varfi =newFileInfo(fileFullPath);varfileContents =File.ReadAllBytes(fi.FullName);varfileName =fi.Name;Uriuri =newUri(@"https://bulkapi.zerobounce.net/v2/scoring/sendfile");using(varclient =newHttpClient())using(varrequest =newHttpRequestMessage(HttpMethod.Post,uri)){MultipartFormDataContentmultiPartContent =newMultipartFormDataContent();ByteArrayContentbyteArrayContent =newByteArrayContent(fileContents);byteArrayContent.Headers.Add("Content-Type","text/csv");multiPartContent.Add(byteArrayContent,"file",fileName);multiPartContent.Add(newStringContent(apiKey),"api_key");multiPartContent.Add(newStringContent(emailAddressColumn.ToString()),"email_address_column");if(ipAddressColumn !=null)multiPartContent.Add(newStringContent(ipAddressColumn.ToString()),"ip_address_column");if(hasHeaderRow !=null)multiPartContent.Add(newStringContent((hasHeaderRow ==true)?"true":"false"),"has_header_row");if(returnUrl !=null)multiPartContent.Add(newStringContent(returnUrl.ToString()),"return_url");request.Content =multiPartContent;using(varresponse =awaitclient.SendAsync(request,HttpCompletionOption.ResponseContentRead,CancellationToken.None).ConfigureAwait(false)){varcontent =awaitresponse.Content.ReadAsStringAsync();if(response.IsSuccessStatusCode ==false){varerror =$"StatusCode={(int)response.StatusCode}, Content={content}";thrownewException(error);}returnJsonConvert.DeserializeObject<SendFileStatus>(content);}}}
<?php$curl=curl_init();curl_setopt_array($curl,array(CURLOPT_URL=>"https://bulkapi.zerobounce.net/v2/scoring/sendfile",CURLOPT_RETURNTRANSFER=>true,CURLOPT_ENCODING=>"",CURLOPT_MAXREDIRS=>10,CURLOPT_TIMEOUT=>30,CURLOPT_HTTP_VERSION=>CURL_HTTP_VERSION_1_1,CURLOPT_CUSTOMREQUEST=>"POST",CURLOPT_POSTFIELDS=>"------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="api_key" replacewithyours
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="email_address_column" replacewithyours
------WebKitFormBoundary7MA4YWxkTrZu0gW--",CURLOPT_HTTPHEADER=>array("Postman-Token: fae6714d-dc09-4e08-b50d-c97030603b61","cache-control: no-cache","content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"),));$response=curl_exec($curl);$err=curl_error($curl);curl_close($curl);if($err){echo"cURL Error #:".$err;}else{echo$response;}?>
OkHttpClientclient =newOkHttpClient();MediaTypemediaType =MediaType.parse("multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW");RequestBodybody =RequestBody.create(mediaType,"------WebKitFormBoundary7MA4YWxkTrZu0gWContent-Disposition:form-data;name="api_key"replacewithyours
------WebKitFormBoundary7MA4YWxkTrZu0gWContent-Disposition:form-data;name="email_address_column"replacewithyours
------WebKitFormBoundary7MA4YWxkTrZu0gW--");Requestrequest =newRequest.Builder().url("https://bulkapi.zerobounce.net/v2/scoring/sendfile").post(body).addHeader("content-type","multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW").addHeader("cache-control","no-cache").addHeader("Postman-Token","25d608ba-6cb5-4c8c-88d7-d47276c67d8e").build();Responseresponse =client.newCall(request).execute();
importhttp.client conn =http.client.HTTPConnection("bulkapi,zerobounce,net")payload ="------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition:form-data;name="api_key"replacewithyours
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition:form-data;name="email_address_column"replacewithyours
------WebKitFormBoundary7MA4YWxkTrZu0gW--" headers ={'content-type':"multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW",'cache-control':"no-cache",'Postman-Token':"bc455eda-9884-417e-b16f-3a5fef3f7540"}conn.request("POST","v2,sendfile",payload,headers)res =conn.getresponse()data =res.read()print(data.decode("utf-8"))
importFoundationletheaders =["content-type":"multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW","cache-control":"no-cache","Postman-Token":"2f68fcc3-d9b6-458b-b613-56f6a03e6617"]letparameters =[["name":"api_key","value":"replacewithyours"],["name":"email_address_column","value":"replacewithyours"]]letboundary ="----WebKitFormBoundary7MA4YWxkTrZu0gW"varbody =""varerror:NSError?=nilforparam inparameters {letparamName =param["name"]!body +="--(boundary)" body +="Content-Disposition:form-data; name="(paramName)""ifletfilename =param["fileName"]{letcontentType =param["content-type"]!letfileContent =String(contentsOfFile:filename,encoding:String.Encoding.utf8)if(error !=nil){print(error)}body +="; filename="(filename)"
" body +="Content-Type:(contentType)" body +=fileContent }elseifletparamValue =param["value"]{body +=" (paramValue)" }}letrequest =NSMutableURLRequest(url:NSURL(string:"https://bulkapi.zerobounce.net/v2/scoring/sendfile")!asURL,cachePolicy:.useProtocolCachePolicy,timeoutInterval:10.0)request.httpMethod ="POST"request.allHTTPHeaderFields =headers request.httpBody =postData asDataletsession =URLSession.shared letdataTask =session.dataTask(with:request asURLRequest,completionHandler:{(data,response,error)->Voidinif(error !=nil){print(error)}else{lethttpResponse =response as?HTTPURLResponseprint(httpResponse)}})dataTask.resume()
// Please select VB or C# language for Send File Sample#import <Foundation/Foundation.h>NSDictionary *headers =@{@"content-type":@"multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW",@"cache-control":@"no-cache",@"Postman-Token":@"92c5b06e-624f-44e5-bd86-f537bc6cef67"};NSArray *parameters =@[@{@"name":@"api_key",@"value":@"replacewithyours"},@{@"name":@"email_address_column",@"value":@"replacewithyours"}];NSString *boundary =@"----WebKitFormBoundary7MA4YWxkTrZu0gW";NSError *error;NSMutableString *body =[NSMutableString string];for(NSDictionary *param inparameters){[body appendFormat:@"--%@",boundary];if(param[@"fileName"]){[body appendFormat:@"Content-Disposition:form-data; name="%@"; filename="%@"
", param[@"name"], param[@"fileName"]];[body appendFormat:@"Content-Type:%@", param[@"contentType"]];[body appendFormat:@"%@",[NSString stringWithContentsOfFile:param[@"fileName"]encoding:NSUTF8StringEncoding error:&error]];if(error){NSLog(@"%@",error);}}else{[body appendFormat:@"Content-Disposition:form-data; name="%@" ", param[@"name"]];[body appendFormat:@"%@",param[@"value"]];}}[body appendFormat:@"
--%@--",boundary];NSData *postData =[body dataUsingEncoding:NSUTF8StringEncoding];NSMutableURLRequest *request =[NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://bulkapi.zerobounce.net/v2/scoring/sendfile"]cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10.0];[request setHTTPMethod:@"POST"];[request setAllHTTPHeaderFields:headers];[request setHTTPBody:postData];NSURLSession *session =[NSURLSession sharedSession];NSURLSessionDataTask *dataTask =[session dataTaskWithRequest:request completionHandler:^(NSData *data,NSURLResponse *response,NSError *error){if(error){NSLog(@"%@",error);}else{NSHTTPURLResponse *httpResponse =(NSHTTPURLResponse *)response;NSLog(@"%@",httpResponse);}}];[dataTask resume];
//N/A

Endpoint Response

Successful Response

{"success":true,"message":"File Accepted","file_name":"Your file name.csv","file_id":"aaaaaaaa-zzzz-xxxx-yyyy-5003727fffff"}

Error Response

{"success":false,"message":["Error messages"]}

AI Scoring API: File Status

/ai-scoring-api/file-status/

The scoring filestatus API returns the file processing status for the file been submitted using sendfile API. Please refer to the C# example for details.

GET /V2/SCORING/FILESTATUS

API URL: https://bulkapi.zerobounce.net/v2/scoring/filestatus

URL Parameters

  • Parameter
    Required/Optional
    Description
  • api_key
    Required
    Your API Key, found in your account
  • file_id
    Required
    The returned file ID when calling scoring sendfile API

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 and the FILE ID with the returned file ID from scoring sendfile

File Status Code Samples

  • Visual Basic
  • C#
  • PHP
  • Java
  • Python
  • Swift
  • Objective C
  • Android Java
' File Status Sample in VB.netPublicClassFileStatus PublicPropertysuccess AsBooleanPublicPropertyfile_id AsStringPublicPropertyfile_name AsStringPublicPropertyupload_date AsStringPublicPropertyfile_status AsStringPublicPropertycomplete_percentage AsStringPublicPropertyreturn_url AsStringEndClassPrivateSharedSubFileStatusAPITest()DimapiKey AsString="replace with your api key here"DimfileID AsString="replace with the returned file ID when calling sendfile API"TryDimfileStatus AsFileStatus =FileStatusAsync(apiKey,fileID).Result Console.Write(JsonConvert.SerializeObject(fileStatus,Formatting.Indented))Catchex AsException Console.Write(ex.InnerException.Message)EndTryConsole.ReadKey()EndSubPublicSharedAsync FunctionFileStatusAsync(ByValapiKey AsString,ByValfileID AsString)AsTask(OfFileStatus)IfString.IsNullOrEmpty(apiKey)ThenThrowNewException("Error: apiKey is required")IfString.IsNullOrEmpty(fileID)ThenThrowNewException("Error: fileID is required")Dimuri AsUri =NewUri($"https://bulkapi.zerobounce.net/v2/scoring/filestatus?api_key={apiKey}&file_id={fileID}")Usingclient =NewHttpClient()Usingrequest =NewHttpRequestMessage(HttpMethod.Get,uri)Usingresponse =Await client.SendAsync(request).ConfigureAwait(False)Dimcontent =Await response.Content.ReadAsStringAsync()Ifresponse.IsSuccessStatusCode =FalseThenDimerrorAsString=$"StatusCode ={CInt(response.StatusCode)},Content ={content}" ThrowNewException(error)EndIfReturnJsonConvert.DeserializeObject(OfFileStatus)(content)EndUsingEndUsingEndUsingEndFunction
// File Status Sample in C#publicclassFileStatus{publicboolsuccess {get;set;}publicstringfile_id {get;set;}publicstringfile_name {get;set;}publicstringupload_date {get;set;}publicstringfile_status {get;set;}publicstringcomplete_percentage {get;set;}publicstringreturn_url {get;set;}}privatestaticvoidFileStatusAPITest(){stringapiKey ="replace with your api key here";stringfileID ="replace with the returned file ID when calling sendfile API";try{FileStatusfileStatus =FileStatusAsync(apiKey,fileID).Result;Console.Write(JsonConvert.SerializeObject(fileStatus,Formatting.Indented));}catch(Exceptionex){Console.Write(ex.InnerException.Message);}Console.ReadKey();}publicstaticasyncTask<FileStatus>FileStatusAsync(stringapiKey,stringfileID){if(string.IsNullOrEmpty(apiKey))thrownewException("Error: apiKey is required");if(string.IsNullOrEmpty(fileID))thrownewException("Error: fileID is required");Uriuri =newUri($"https://bulkapi.zerobounce.net/v2/scoring/filestatus?api_key={apiKey}&file_id={fileID}");using(varclient =newHttpClient())using(varrequest =newHttpRequestMessage(HttpMethod.Get,uri))using(varresponse =awaitclient.SendAsync(request).ConfigureAwait(false)){varcontent =awaitresponse.Content.ReadAsStringAsync();if(response.IsSuccessStatusCode ==false){varerror =$"StatusCode={(int)response.StatusCode}, Content={content}";thrownewException(error);}returnJsonConvert.DeserializeObject<FileStatus>(content);}}
<?php$curl=curl_init();curl_setopt_array($curl,array(CURLOPT_URL=>"https://bulkapi.zerobounce.net/v2/scoring/filestatus?api_key=replacewithyours&file_id=replacewithyours",CURLOPT_RETURNTRANSFER=>true,CURLOPT_ENCODING=>"",CURLOPT_MAXREDIRS=>10,CURLOPT_TIMEOUT=>30,CURLOPT_HTTP_VERSION=>CURL_HTTP_VERSION_1_1,CURLOPT_CUSTOMREQUEST=>"GET",CURLOPT_POSTFIELDS=>"",CURLOPT_HTTPHEADER=>array("Postman-Token: 91504cea-f92f-46b0-97a4-338167072887","cache-control: no-cache"),));$response=curl_exec($curl);$err=curl_error($curl);curl_close($curl);if($err){echo"cURL Error #:".$err;}else{echo$response;}?>
OkHttpClientclient =newOkHttpClient();Requestrequest =newRequest.Builder().url("https://bulkapi.zerobounce.net/v2/scoring/filestatus?api_key=replacewithyours&file_id=replacewithyours").get().addHeader("cache-control","no-cache").addHeader("Postman-Token","7fffd7a4-b2fd-4e8b-ac85-4099411f27ce").build();Responseresponse =client.newCall(request).execute();
importhttp.client conn =http.client.HTTPConnection("bulkapi,zerobounce,net")payload =""headers ={'cache-control':"no-cache",'Postman-Token':"caa917fe-45ce-45ae-9456-2b039b999dcb"}conn.request("GET","v2,filestatus",payload,headers)res =conn.getresponse()data =res.read()print(data.decode("utf-8"))
// Please select VB or C# language for File Status Sampleimport Foundationletheaders =["cache-control":"no-cache","Postman-Token":"4f1b92e2-034f-4fa0-94d9-b097d768668a"]letrequest =NSMutableURLRequest(url:NSURL(string:"https://bulkapi.zerobounce.net/v2/scoring/filestatus?api_key=replacewithyours&file_id=replacewithyours")!asURL,cachePolicy:.useProtocolCachePolicy,timeoutInterval:10.0)request.httpMethod ="GET"request.allHTTPHeaderFields =headers letsession =URLSession.shared letdataTask =session.dataTask(with:request asURLRequest,completionHandler:{(data,response,error)->Voidinif(error !=nil){print(error)}else{lethttpResponse =response as?HTTPURLResponseprint(httpResponse)}})dataTask.resume()
#import<Foundation/Foundation.h>NSDictionary *headers =@{@"cache-control":@"no-cache",@"Postman-Token":@"5e9c24ae-b577-4e33-8748-83f14e151ae9"};NSMutableURLRequest *request =[NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://bulkapi.zerobounce.net/v2/scoring/filestatus?api_key=replacewithyours&file_id=replacewithyours"]cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10.0];[request setHTTPMethod:@"GET"];[request setAllHTTPHeaderFields:headers];NSURLSession *session =[NSURLSession sharedSession];NSURLSessionDataTask *dataTask =[session dataTaskWithRequest:request completionHandler:^(NSData *data,NSURLResponse *response,NSError *error){if(error){NSLog(@"%@",error);}else{NSHTTPURLResponse *httpResponse =(NSHTTPURLResponse *)response;NSLog(@"%@",httpResponse);}}];[dataTask resume];
// N/A

Endpoint Response

Successful Response

{"success":true,"file_id":"aaaaaaaa-zzzz-xxxx-yyyy-5003727fffff","file_name":"Your file name.csv","upload_date":"10/20/2018 4:35:58 PM","file_status":"Complete","complete_percentage":"100%","return_url":"Your return URL if provided when calling sendfile API"}

Error Response

{"success":false,"message":"Error messages"}

AI Scoring API: Get File

/ai-scoring-api/get-file/

The scoring getfile API allows users to get the validation results file for the file been submitted using scoring sendfile API. Please refer to the C# example for details.

GET /V2/SCORING/GETFILE

API URL: https://bulkapi.zerobounce.net/v2/scoring/getfile

URL Parameters

  • Parameter
    Required/Optional
    Description
  • api_key
    Required
    Your API Key, found in your account
  • file_id
    Required
    The returned file ID when calling scoring sendfile API

Get File Code Samples

  • Visual Basic
  • C#
  • PHP
  • Java
  • Python
  • Swift
' Get File Sample in VB.netPrivateSharedSubGetFileAPITest()DimapiKey AsString="replace with your api key here"DimfileID AsString="replace with the returned file ID when calling sendfile API"Dimdir AsString="C:emp" TryDimfilePath =GetFileAsync(apiKey,fileID,dir).Result Console.Write($"File{filePath} retrieved successfully.")Catchex AsException Console.Write(ex.InnerException.Message)EndTryConsole.ReadKey()EndSubPublicSharedAsync FunctionGetFileAsync(ByValapiKey AsString,ByValfileID AsString,ByValdir AsString)AsTask(OfString)IfString.IsNullOrEmpty(apiKey)ThenThrowNewException("Error: apiKey is required")IfString.IsNullOrEmpty(fileID)ThenThrowNewException("Error: fileID is required")Dimuri AsUri =NewUri($"https://bulkapi.zerobounce.net/v2/scoring/getfile?api_key={apiKey}&file_id={fileID}")Usingclient =NewHttpClient()Usingrequest =NewHttpRequestMessage(HttpMethod.Get,uri)Usingresponse =Await client.SendAsync(request,HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(False)UsingstreamToReadFrom AsStream=Await response.Content.ReadAsStreamAsync()Ifresponse.IsSuccessStatusCode =FalseThenDim[error] =$"StatusCode ={CInt(response.StatusCode)},Content ={response.Content.ReadAsStringAsync().Result}" ThrowNewException([error])EndIfDimfilePath =Path.Combine(dir,response.Content.Headers.ContentDisposition.FileName)UsingstreamToWriteTo AsStream=File.Open(filePath,FileMode.Create)Await streamToReadFrom.CopyToAsync(streamToWriteTo)EndUsingReturnfilePath EndUsingEndUsingEndUsingEndUsingEndFunction
// Get File Sample in C#privatestaticvoidGetFileAPITest(){stringapiKey ="replace with your api key here";stringfileID ="replace with the returned file ID when calling sendfile API";stringdir =@"C:emp";// specify the directory where you want to save the results filetry{varfilePath =GetFileAsync(apiKey,fileID,dir).Result;Console.Write($"File{filePath} retrieved successfully.");}catch(Exceptionex){Console.Write(ex.InnerException.Message);}Console.ReadKey();}publicstaticasyncTask<string>GetFileAsync(stringapiKey,stringfileID,stringdir){if(string.IsNullOrEmpty(apiKey))thrownewException("Error: apiKey is required");if(string.IsNullOrEmpty(fileID))thrownewException("Error: fileID is required");Uriuri =newUri($"https://bulkapi.zerobounce.net/v2/scoring/getfile?api_key={apiKey}&file_id={fileID}");using(varclient =newHttpClient())using(varrequest =newHttpRequestMessage(HttpMethod.Get,uri))using(varresponse =awaitclient.SendAsync(request,HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false))using(StreamstreamToReadFrom =awaitresponse.Content.ReadAsStreamAsync()){if(response.IsSuccessStatusCode ==false){varerror =$"StatusCode={(int)response.StatusCode}, Content={response.Content.ReadAsStringAsync().Result}";thrownewException(error);}varfilePath =Path.Combine(dir,response.Content.Headers.ContentDisposition.FileName);using(StreamstreamToWriteTo =File.Open(filePath,FileMode.Create)){awaitstreamToReadFrom.CopyToAsync(streamToWriteTo);}returnfilePath;}}
<?php$request=newHttpRequest();$request->setUrl('https://bulkapi.zerobounce.net/v2/scoring/getfile');$request->setMethod(HTTP_METH_GET);$request->setQueryData(array('api_key'=>'replacewithyours','file_id'=>'replacewithyours'));$request->setHeaders(array('Postman-Token'=>'0a6c40b8-0cd4-4dbb-a57e-422558e7ab6a','cache-control'=>'no-cache'));try{$response=$request->send();echo$response->getBody();}catch(HttpException $ex){echo$ex;}?>
OkHttpClientclient =newOkHttpClient();Requestrequest =newRequest.Builder().url("https://bulkapi.zerobounce.net/v2/scoring/getfile?api_key=replacewithyours&file_id=replacewithyours").get().addHeader("cache-control","no-cache").addHeader("Postman-Token","d0b7d318-f3f6-47fb-842d-5622b26592c1").build();Responseresponse =client.newCall(request).execute();
importhttp.client conn =http.client.HTTPConnection("bulkapi,zerobounce,net")payload =""headers ={'cache-control':"no-cache",'Postman-Token':"9f615d7e-60af-4746-9bcc-317b1f80a6bb"}conn.request("GET","v2,getfile",payload,headers)res =conn.getresponse()data =res.read()print(data.decode("utf-8"))
importFoundationletheaders =["cache-control":"no-cache","Postman-Token":"6c8cb1cb-25ed-4e56-b4cb-65e949b8bdd1"]letrequest =NSMutableURLRequest(url:NSURL(string:"https://bulkapi.zerobounce.net/v2/scoring/getfile?api_key=replacewithyours&file_id=replacewithyours")!asURL,cachePolicy:.useProtocolCachePolicy,timeoutInterval:10.0)request.httpMethod ="GET"request.allHTTPHeaderFields =headers letsession =URLSession.shared
letdataTask =session.dataTask(with:request asURLRequest,completionHandler:{(data,response,error)->Voidinif(error !=nil){print(error)}else{lethttpResponse =response as?HTTPURLResponseprint(httpResponse)}})dataTask.resume()

Endpoint Response

Successful Response

{"success":true,"message":"File Accepted","file_name":"Your file name.csv","file_id":"aaaaaaaa-zzzz-xxxx-yyyy-5003727fffff"}

Error Response

{"success":false,"message":["Error messages"]}

AI Scoring API: Delete File

/ai-scoring-api/delete-file/

The scoring deletefile API deletes the file that was submitted using scoring sendfile API. File can be deleted only when its status is Complete.

POST /V2/SCORING/DELETEFILE

API URL: https://bulkapi.zerobounce.net/v2/scoring/deletefile

URL Parameters

  • Parameter
    Required/Optional
    Description
  • api_key
    Required
    Your API Key, found in your account
  • file_id
    Required
    The returned file ID when calling scoring sendfile API

Delete File Code Samples

  • Visual Basic
  • C#
  • PHP
  • Java
  • Python
  • Swift
  • Objective C
' Delete File Sample in VB.netPublicClassResponseResult PublicPropertysuccess AsBooleanPublicPropertymessage AsStringPublicPropertyfile_id AsStringPublicPropertyfile_name AsStringEndClassPrivateSharedSubDeleteFileAPITest()DimapiKey AsString="replace with your api key here"DimfileID AsString="replace with the returned file ID when calling sendfile API"TryDimresponseResult AsResponseResult =DeleteFileAsync(apiKey,fileID).Result Console.Write(JsonConvert.SerializeObject(responseResult,Formatting.Indented))Catchex AsException Console.Write(ex.InnerException.Message)EndTryConsole.ReadKey()EndSubPublicSharedAsync FunctionDeleteFileAsync(ByValapiKey AsString,ByValfileID AsString)AsTask(OfResponseResult)IfString.IsNullOrEmpty(apiKey)ThenThrowNewException("Error: apiKey is required")IfString.IsNullOrEmpty(fileID)ThenThrowNewException("Error: fileID is required")Dimuri AsUri =NewUri($"https://bulkapi.zerobounce.net/v2/scoring/deletefile?api_key={apiKey}&file_id={fileID}")Usingclient =NewHttpClient()Usingrequest =NewHttpRequestMessage(HttpMethod.[Get],uri)Usingresponse =Await client.SendAsync(request).ConfigureAwait(False)Dimcontent =Await response.Content.ReadAsStringAsync()Ifresponse.IsSuccessStatusCode =FalseThenDim[error] =$"StatusCode ={CInt(response.StatusCode)},Content ={content}" ThrowNewException([error])EndIfReturnJsonConvert.DeserializeObject(OfResponseResult)(content)EndUsingEndUsingEndUsingEndFunction
// Delete File Sample in C#publicclassResponseResult{publicboolsuccess {get;set;}publicstringmessage {get;set;}publicstringfile_id {get;set;}publicstringfile_name {get;set;}}privatestaticvoidDeleteFileAPITest(){stringapiKey ="replace with your api key here";stringfileID ="replace with the returned file ID when calling sendfile API";try{ResponseResultresponseResult =DeleteFileAsync(apiKey,fileID).Result;Console.Write(JsonConvert.SerializeObject(responseResult,Formatting.Indented));}catch(Exceptionex){Console.Write(ex.InnerException.Message);}Console.ReadKey();}publicstaticasyncTask<ResponseResult>DeleteFileAsync(stringapiKey,stringfileID){if(string.IsNullOrEmpty(apiKey))thrownewException("Error: apiKey is required");if(string.IsNullOrEmpty(fileID))thrownewException("Error: fileID is required");Uriuri =newUri($"https://bulkapi.zerobounce.net/v2/scoring/deletefile?api_key={apiKey}&file_id={fileID}");using(varclient =newHttpClient())using(varrequest =newHttpRequestMessage(HttpMethod.Get,uri))using(varresponse =awaitclient.SendAsync(request).ConfigureAwait(false)){varcontent =awaitresponse.Content.ReadAsStringAsync();if(response.IsSuccessStatusCode ==false){varerror =$"StatusCode={(int)response.StatusCode}, Content={content}";thrownewException(error);}returnJsonConvert.DeserializeObject<ResponseResult>(content);}}
<?php$curl=curl_init();curl_setopt_array($curl,array(CURLOPT_URL=>"https://bulkapi.zerobounce.net/v2/scoring/deletefile?api_key=replacewithyours&file_id=replacewithyours",CURLOPT_RETURNTRANSFER=>true,CURLOPT_ENCODING=>"",CURLOPT_MAXREDIRS=>10,CURLOPT_TIMEOUT=>30,CURLOPT_HTTP_VERSION=>CURL_HTTP_VERSION_1_1,CURLOPT_CUSTOMREQUEST=>"GET",CURLOPT_POSTFIELDS=>"",CURLOPT_HTTPHEADER=>array("Postman-Token: 91504cea-f92f-46b0-97a4-338167072887","cache-control: no-cache"),));$response=curl_exec($curl);$err=curl_error($curl);curl_close($curl);if($err){echo"cURL Error #:".$err;}else{echo$response;}?>
OkHttpClientclient =newOkHttpClient();Requestrequest =newRequest.Builder().url("https://bulkapi.zerobounce.net/v2/scoring/deletefile?api_key=replacewithyours&file_id=replacewithyours").get().addHeader("cache-control","no-cache").addHeader("Postman-Token","7fffd7a4-b2fd-4e8b-ac85-4099411f27ce").build();Responseresponse =client.newCall(request).execute();
importhttp.client conn =http.client.HTTPConnection("bulkapi,zerobounce,net")payload =""headers ={'cache-control':"no-cache",'Postman-Token':"caa917fe-45ce-45ae-9456-2b039b999dcb"}conn.request("GET","v2,deletefile",payload,headers)res =conn.getresponse()data =res.read()print(data.decode("utf-8"))
// Please select VB or C# language for File Status Sampleimport Foundationletheaders =["cache-control":"no-cache","Postman-Token":"4f1b92e2-034f-4fa0-94d9-b097d768668a"]letrequest =NSMutableURLRequest(url:NSURL(string:"https://bulkapi.zerobounce.net/v2/scoring/deletefile?api_key=replacewithyours&file_id=replacewithyours")!asURL,cachePolicy:.useProtocolCachePolicy,timeoutInterval:10.0)request.httpMethod ="GET"request.allHTTPHeaderFields =headers letsession =URLSession.shared
letdataTask =session.dataTask(with:request asURLRequest,completionHandler:{(data,response,error)->Voidinif(error !=nil){print(error)}else{lethttpResponse =response as?HTTPURLResponseprint(httpResponse)}})dataTask.resume()
#import<Foundation/Foundation.h>NSDictionary *headers =@{@"cache-control":@"no-cache",@"Postman-Token":@"5e9c24ae-b577-4e33-8748-83f14e151ae9"};NSMutableURLRequest *request =[NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://bulkapi.zerobounce.net/v2/scoring/deletefile?api_key=replacewithyours&file_id=replacewithyours"]cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10.0];[request setHTTPMethod:@"GET"];[request setAllHTTPHeaderFields:headers];NSURLSession *session =[NSURLSession sharedSession];NSURLSessionDataTask *dataTask =[session dataTaskWithRequest:request completionHandler:^(NSData *data,NSURLResponse *response,NSError *error){if(error){NSLog(@"%@",error);}else{NSHTTPURLResponse *httpResponse =(NSHTTPURLResponse *)response;NSLog(@"%@",httpResponse);}}];[dataTask resume];

Endpoint Response

Successful Response

{"success":true,"message":"File Deleted","file_name":"test2","file_id":"b222a0fd-90d5-416c-8f1a-9cc3851fc823"}

Error Response

{"success":false,"message":"File cannot be found."}