Add contacts to address book

The AddContactsToAddressBook method is now considered obsolete and you should use AddContactsToAddressBookWithProgress where possible.

This method adds multiple contacts stored in a CSV or XLS file to an address book using a single API call. It allows you to set the information about the contacts you are uploading and the address book you are uploading them to.

We recommend that you use a .CSV file wherever possible. It is useful when you need to upload multiple contacts in one go into the dotMailer system. As each call only counts as one API call it allows you to easily stay below your API limit whilst uploading multiple contacts. It has the benefit of being run through our data watchdog so you know the data you are importing is of a good quality.


Guidance Notes

This method will create the contact being added if it doesn't already exist which means you do not need to call a method such as CreateContact before calling it. You may upload either a .csv or .xls file. It must contain one column with the heading "Email" or the translated equivalent if your account is using a language other than English. Other columns will attempt to map to your custom data fields. There is a 10MB upload limit per file.

As the import goes through our data watchdog there might be a delay between uploading the contacts and them being successfully added to the address book.


Parameters

username string This is the username from your API key. It is in the format of an email address and will look similar to apiuser-908709770324@apiconnector.com required
password string This is the password from your API key. required
addressBookId int This is the Id of the address book which you would like to upload the contact to. required
data base64Binary This is the original file, encoded in Base64 format. required
dataType CSV or XLS This is the type of file which you are uploading, either .CSV, or .XLS. At this time, XLSX is not supported. required

Return values

None.

Error responses

  • ERROR_ADDRESSBOOK_NOT_FOUND
  • ERROR_ADDRESSBOOK_NOTWRITABLE
  • ERROR_APIUSAGE_EXCEEDED
  • ERROR_CONTACT_INVALID
  • ERROR_CONTACT_SUPPRESSED
  • ERROR_CONTACT_TOOMANY
  • ERROR_DATAFIELD_NOTFOUND
  • ERROR_IMPORT_TOOMANYACTIVEIMPORTS
  • ERROR_INVALID_LOGIN
  • ERROR_NO_EMAIL_COLUMN
  • ERROR_PARAMETER_INVALID
  • ERROR_SYSTEM_SERVICETEMPORARILYUNAVAILABLE
  • ERROR_UNKNOWN

Request

Example of use in C# .NET

Example of use in PHP

Sample request

Sample response

Get started with dotMailer:

Small & Medium businesses Large businesses
Call the team on 0845 337 9170
What our clients say:

“dotMailer has changed our complete marketing process for the better. It's one of the easiest apps I have used and allows us to do things we have only dreamed of before."

Amberley Shermon, Cazenove+Loyd