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"]}