Upload and parse a contact list file
POST/api/partner-gateway/contacts/upload
Imports the rows of a CSV, text or Excel file as contacts of your account.
- How to send it: as
multipart/form-data, with the file infileand its original name infileName. The format is detected from the extension offileName. - Formats:
.csvand.txtfiles delimited by commas, semicolons, pipes or tabs (detected automatically), and Excel.xlsand.xlsxfiles. For VCard files, usePOST /contacts/upload/vcard. - Columns are mapped automatically from the header names the platform recognises, such as
firstName,lastName,phoneNumberandemail. SendremoveHead=truewhen the first row holds column headers, so that it is not imported as a contact. - Create or update: new contacts are created, and a contact already in your account, matched by mobile phone number or by email address (compared after normalisation), is updated. If the phone number and the email match two different contacts, the one matched by email is updated.
- List: with
listId, every contact imported is added to that contact list. - Consents: the file cannot carry consents. The optional
consentsform field gives the same consents to every imported contact; the rules are on the field.
Large files are imported in the background. For 50,000 rows or more (a lower threshold applies in test environments) the call answers
200at once withnumContact,addedContact,updatedContactandnumErrorset to-1andlistIdandlistNamenull. The final counts arrive only in the import-completed email sent to the user the API key belongs to. Do not upload the file again when you get-1: that would run the import a second time.
Request
Responses
- 200
- 400
- 401
- 404
- 500
File imported: the counts of added, updated and failed contacts, all -1 when the import continues in the background.
file or fileName is missing, the file is empty, the extension of fileName is not csv, txt, xls or xlsx, or consents is not a JSON object or carries consents that cannot be stored.
The API key is missing, invalid, or lacks the CONTACTS operation.
listId is not a contact list of your account.
Unexpected server error during the import, including a file whose content cannot be parsed.