Import Contacts using a JSON Payload
Use this method to create an asynchronous background job that adds new contacts or updates existing contacts by importing a JSON payload. This method requires a request body that contains the contact data you are importing and the contact lists to which you want to add the imported contacts. A contact's data must include an email address and/or sms_number. The sms_number must be a US phone number to associate with the contact's SMS-enabled phone. Valid formats are <code>1231231234</code> or <code>123-123-1234</code> (the country code must be valid).
Importing a new contact using this method automatically sets the contact's email permission_to_send property to implicit and the opt_in_source property as Account. Importing an existing contact only updates the contact properties you include in the request. For each contact, you can import up to three addresses and three phone numbers. International phone numbers are currently not supported.
To import custom fields, prefix the custom field name with cf: and add it as a contact property. For example, use the property name cf:first_name if you have a custom field named first_name. The custom field must already exist in the Constant Contact account you are using. Each contact can contain up to 25 custom fields.
To include a contact's sms_number, if the contact provided explicit permission to receive SMS messages, you must set the sms_permission_to_send property to explicit and specify the date of consent using the sms_consent_date column header. If explicit permission was not provided, set sms_permission_to_send to not_set (the sms_consent_date is not required). If the sms_consent_date is not set, SMS messages cannot be sent to contacts and sms_permission_to_send defaults to not_set. Valid value formats for sms_consent_date include MM/DD/YYYY, M/D/YYYY, YYYY/MM/DD, YYYY/M/D, YYYY-MM-DD, YYYY-M-D,M-D-YYYY, or M-DD-YYYY.
The request body payload has a maximum size of 4 megabytes (MB). If the request body exceeds 4 MB, this method only imports the first 4 MB and drops the remaining data. Use the activity URL to check the status of the import activity request.
Request body
Example request
{
"import_data": [
{
"email": "joe.jones@example.com",
"first_name": "Joe",
"last_name": "Jones",
"job_title": "Chief Innovation Officer",
"company_name": "RelativeGravity, Inc.",
"birthday_month": 11,
"birthday_day": 24,
"anniversary": "2006-11-15",
"phone": "555-555-5555",
"home_phone": "555-555-5555",
"work_phone": "555-555-4444",
"mobile_phone": "555-555-3333",
"other_phone": "555-555-2222",
"street": "123 Maple Lane",
"street2": "Apt. 337",
"city": "Chicago",
"state": "Illinois",
"zip": "60609",
"country": "United States",
"home_street": "123 Maple Lane",
"home_street2": "Apt. 337",
"home_city": "Chicago",
"home_state": "Illinois",
"home_zip": "60609",
"home country": "United States",
"work_street": "123 Maple Lane",
"work_street2": "Apt. 337",
"work_city": "Chicago",
"work_state": "Illinois",
"work_zip": "60609",
"work_country": "United States",
"other_street": "123 Maple Lane",
"other_street2": "Apt. 337",
"other_city": "Chicago",
"other_state": "Illinois",
"other_zip": "60609",
"other_country": "Canada",
"cf:custom_field_name": "Tesla S 2017",
"sms_number": "5081231235",
"sms_consent_date": "07-03-2024"
}
],
"list_ids": [
"04fe9a97-a579-43c5-bb1a-58ed29bf0a6a"
],
"sms_permission_to_send": "explicit"
}Response
Request successful. Activity queued for processing.
Example response
{
"activity_id": "86b90820-cc52-11ea-9dad-fa163e3d9194",
"state": "initialized",
"started_at": "2016-01-23T13:48:40.108Z",
"completed_at": "2016-01-23T13:48:44.108Z",
"created_at": "2016-01-23T13:48:44.108Z",
"updated_at": "2016-01-23T13:48:44.108Z",
"source_file_name": "2016-21-04-contact_import.xls",
"percent_done": 75,
"activity_errors": [
"Message describing the error condition."
],
"status": {
"items_total_count": 87,
"person_count": 20,
"error_count": 1,
"correctable_count": 1,
"cannot_add_to_list_count": 1
},
"_links": {
"self": {
"href": "/v3/activities/04fe9a97-a579-43c5-bb1a-58ed29bf0a6a"
}
}
}