Send File (v2)

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

POST /v2/sendfile


URL Parameters

  • Parameter
  • file
    csv or txt file. Byte array contents for the submitted file. The content's header is type of "text/csv".
  • api_key
    Your API Key, found in your account. (Required)
  • return_url
    The URL will be used to call back when the validation is completed. (Optional)
  • email_address_column
    The column index of the email address in the file. Index starts from 1. (Required)
  • first_name_column
    The column index of the first name column. (Optional)
  • last_name_column
    The column index of the last name column. (Optional)
  • gender_column
    The column index of the gender column. (Optional)
  • ip_address_column
    The IP Address the email signed up from. (Optional)
  • has_header_row
    If the first row from the submitted file is a header row. true or false (Optional)

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
' Complete API Libraries and Wrappers can be found here: 

' Send File Sample in

Public Class SendFileStatus
    Public Property success As Boolean
    Public Property message As String
    Public Property file_name As String
    Public Property file_id As String
End Class

Private Shared Sub SendFileAPITest()
    Dim fileFullPath As String = $"full file path of a csv or txt file"  ' required
    Dim apiKey As String = "replace with your api key here"              ' required
    Dim emailAddressColumn As Integer = 2  ' required
    Dim firstNameColumn As Integer? = 5    ' optional
    Dim lastNameColumn As Integer? = 6     ' optional
    Dim genderColumn As Integer? = Nothing ' optional
    Dim ipAddressColumn As Integer? = 11   ' optional
    Dim hasHeaderRow As Boolean? = True    ' optional
    Dim returnUrl As String = Nothing      ' optional

        Dim sendFileStatus As SendFileStatus = SendFile(fileFullPath, apiKey, emailAddressColumn, firstNameColumn, lastNameColumn, genderColumn, ipAddressColumn, hasHeaderRow, returnUrl).Result
        Console.Write(JsonConvert.SerializeObject(sendFileStatus, Formatting.Indented))
    Catch ex As Exception
    End Try

End Sub

Public Shared Async Function SendFile(ByVal fileFullPath As String, 
                                      ByVal apiKey As String, 
                                      ByVal emailAddressColumn As Integer, 
                                      ByVal Optional firstNameColumn As Integer? = Nothing, 
                                      ByVal Optional lastNameColumn As Integer? = Nothing, 
                                      ByVal Optional genderColumn As Integer? = Nothing, 
                                      ByVal Optional ipAddressColumn As Integer? = Nothing, 
                                      ByVal Optional hasHeaderRow As Boolean? = Nothing, 
                                      ByVal Optional returnUrl As String = Nothing) As Task(Of SendFileStatus)

    If String.IsNullOrEmpty(fileFullPath) Then Throw New Exception("Error: fileFullPath is required")
    If String.IsNullOrEmpty(apiKey) Then Throw New Exception("Error: apiKey is required")
    Dim fi = New FileInfo(fileFullPath)
    Dim fileContents = File.ReadAllBytes(fi.FullName)
    Dim fileName = fi.Name
    Dim uri As Uri = New Uri("")

    Using client = New HttpClient()

        Using request = New HttpRequestMessage(HttpMethod.Post, uri)
            Dim multiPartContent As MultipartFormDataContent = New MultipartFormDataContent()
            Dim byteArrayContent As ByteArrayContent = New ByteArrayContent(fileContents)
            byteArrayContent.Headers.Add("Content-Type", "text/csv")
            multiPartContent.Add(byteArrayContent, "file", fileName)
            multiPartContent.Add(New StringContent(apiKey), "api_key")
            multiPartContent.Add(New StringContent(emailAddressColumn.ToString()), "email_address_column")
            If firstNameColumn IsNot Nothing Then multiPartContent.Add(New StringContent(firstNameColumn.ToString()), "first_name_column")
            If lastNameColumn IsNot Nothing Then multiPartContent.Add(New StringContent(lastNameColumn.ToString()), "last_name_column")
            If genderColumn IsNot Nothing Then multiPartContent.Add(New StringContent(genderColumn.ToString()), "gender_column")
            If ipAddressColumn IsNot Nothing Then multiPartContent.Add(New StringContent(ipAddressColumn.ToString()), "ip_address_column")
            If hasHeaderRow IsNot Nothing Then multiPartContent.Add(New StringContent(If((hasHeaderRow = True), "true", "false")), "has_header_row")
            If returnUrl IsNot Nothing Then multiPartContent.Add(New StringContent(returnUrl.ToString()), "return_url")
            request.Content = multiPartContent

            Using response = Await client.SendAsync(request, HttpCompletionOption.ResponseContentRead, CancellationToken.None).ConfigureAwait(False)
                Dim content = Await response.Content.ReadAsStringAsync()

                If response.IsSuccessStatusCode = False Then
                    Dim error As String = $"StatusCode = {CInt(response.StatusCode)}, Content = {content}"
                    Throw New Exception(error)
                End If

                Return JsonConvert.DeserializeObject(Of SendFileStatus)(content)
            End Using
        End Using
    End Using
End Function

// Complete API Libraries and Wrappers can be found here: 

// Send File Sample in C#

public class SendFileStatus
    public bool success { get; set; }
    public string message { get; set; }
    public string file_name { get; set; }
    public string file_id { get; set; }

private static void SendFileAPITest()
    string fileFullPath = $"full file path of a csv or txt file";  //required
    string apiKey = "replace with your api key here";  //required       
    int emailAddressColumn = 2;  //required
    int? firstNameColumn = 5;  //optional
    int? lastNameColumn = 6;  //optional
    int? genderColumn = null;  //optional
    int? ipAddressColumn = 11;  //optional
    bool? hasHeaderRow = true;  //optional
    string returnUrl = null;  //optional

        SendFileStatus sendFileStatus = SendFile(fileFullPath, apiKey, emailAddressColumn, firstNameColumn, lastNameColumn, genderColumn, ipAddressColumn, hasHeaderRow, returnUrl).Result;
        Console.Write(JsonConvert.SerializeObject(sendFileStatus, Formatting.Indented));
    catch (Exception ex)



public static async Task<SendFileStatus> SendFile(string fileFullPath, string apiKey, int emailAddressColumn, 
                                            int? firstNameColumn = null, int? lastNameColumn = null, int? genderColumn = null, 
                                            int? ipAddressColumn = null, bool? hasHeaderRow = null, string returnUrl = null)
    if (string.IsNullOrEmpty(fileFullPath))
        throw new Exception("Error: fileFullPath is required");
    if (string.IsNullOrEmpty(apiKey))
        throw new Exception("Error: apiKey is required");

    var fi = new FileInfo(fileFullPath);
    var fileContents = File.ReadAllBytes(fi.FullName);
    var fileName = fi.Name;

    Uri uri = new Uri(@"");

    using (var client = new HttpClient())
    using (var request = new HttpRequestMessage(HttpMethod.Post, uri))
        MultipartFormDataContent multiPartContent = new MultipartFormDataContent();
        ByteArrayContent byteArrayContent = new ByteArrayContent(fileContents);
        byteArrayContent.Headers.Add("Content-Type", "text/csv");
        multiPartContent.Add(byteArrayContent, "file", fileName);
        multiPartContent.Add(new StringContent(apiKey), "api_key");
        multiPartContent.Add(new StringContent(emailAddressColumn.ToString()), "email_address_column");
        if (firstNameColumn != null)
            multiPartContent.Add(new StringContent(firstNameColumn.ToString()), "first_name_column");
        if (lastNameColumn != null)
            multiPartContent.Add(new StringContent(lastNameColumn.ToString()), "last_name_column");
        if (genderColumn != null)
            multiPartContent.Add(new StringContent(genderColumn.ToString()), "gender_column");
        if (ipAddressColumn != null)
            multiPartContent.Add(new StringContent(ipAddressColumn.ToString()), "ip_address_column");
        if (hasHeaderRow != null)
            multiPartContent.Add(new StringContent((hasHeaderRow == true) ? "true" : "false"), "has_header_row");
        if (returnUrl != null)
            multiPartContent.Add(new StringContent(returnUrl.ToString()), "return_url");

        request.Content = multiPartContent;

        using (var response = await client.SendAsync(request, HttpCompletionOption.ResponseContentRead, CancellationToken.None).ConfigureAwait(false))
            var content = await response.Content.ReadAsStringAsync();

            if (response.IsSuccessStatusCode == false)
                var error = $"StatusCode = {(int)response.StatusCode}, Content = {content}";
                throw new Exception(error);

            return JsonConvert.DeserializeObject<SendFileStatus>(content);

// Complete API Libraries and Wrappers can be found here: 

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "",
  CURLOPT_POSTFIELDS => "------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="api_key"

Content-Disposition: form-data; name="email_address_column"

    "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);


if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;

  //Complete API Libraries and Wrappers can be found here: 

  OkHttpClient client = new OkHttpClient();

  MediaType mediaType = MediaType.parse("multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW");
  RequestBody body = RequestBody.create(mediaType, "------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="api_key"

Content-Disposition: form-data; name="email_address_column"

  Request request = new Request.Builder()
    .addHeader("content-type", "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW")
    .addHeader("cache-control", "no-cache")
    .addHeader("Postman-Token", "25d608ba-6cb5-4c8c-88d7-d47276c67d8e")
  Response response = client.newCall(request).execute();

    # Complete API Libraries and Wrappers can be found here: 
  import http.client

  conn = http.client.HTTPConnection("bulkapi,zerobounce,net")
  payload = "------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="api_key"

Content-Disposition: form-data; name="email_address_column"

  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 =

  // Complete API Libraries and Wrappers can be found here: 

  import Foundation

  let headers = [
    "content-type": "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW",
    "cache-control": "no-cache",
    "Postman-Token": "2f68fcc3-d9b6-458b-b613-56f6a03e6617"
  let parameters = [
      "name": "api_key",
      "value": "replacewithyours"
      "name": "email_address_column",
      "value": "replacewithyours"
  let boundary = "----WebKitFormBoundary7MA4YWxkTrZu0gW"
  var body = ""
  var error: NSError? = nil
  for param in parameters {
    let paramName = param["name"]!
    body += "--(boundary)
    body += "Content-Disposition:form-data; name="(paramName)""
    if let filename = param["fileName"] {
      let contentType = param["content-type"]!
      let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
      if (error != nil) {
      body += "; filename="(filename)"
      body += "Content-Type: (contentType)

      body += fileContent
    } else if let paramValue = param["value"] {
      body += "

  let request = NSMutableURLRequest(url: NSURL(string: "")! as URL,
                                          cachePolicy: .useProtocolCachePolicy,
                                      timeoutInterval: 10.0)
  request.httpMethod = "POST"
  request.allHTTPHeaderFields = headers
  request.httpBody = postData as Data
  let session = URLSession.shared
  let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
    if (error != nil) {
    } else {
      let httpResponse = response as? HTTPURLResponse

  // Complete API Libraries and Wrappers can be found here: 

// 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 in parameters) {
    [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:@""]
[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];

  // Complete API Libraries and Wrappers can be found here: 


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"