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