Bulk inserts can be done using the /imports endpoint. The endpoint supports the extended import functionality known from the user interface, such as duplicate checks and enrichment of existing contacts. To better understand the possibilities with the data importer, you may have a look at the article explaining how to upload leads through the UI.

An import is initiated by sending a POST request to the create /imports endpoint, for example:

{  "poolId": 25528,  "match":   {       "fields": [           2       ],       "blacklist": []   },  "updateFields": [      1, 2, 3  ],  "callbackUrl": "https://your-custom-callback-url.dev"}

In this case, we are instructing the importer to insert contacts in the pool with id 25528. This is the only required parameter if you're doing an upload only. If you want to utilize more features such as duplicate control, a few more parameters must be added:

  • Check against import duplicates: Define the $.match.fields with the ids, of which you want to run the duplicate check. You can include any existing contacts in the duplicate check by adding one or multiple pool ids to $.match.blacklist.

  • If you want to enrich existing contacts instead of entirely skipping them during the duplicate check, allowed fields for data enrichment is to be defined in $.updateFields.

  • Since this is an asynchronous process, a callback can be necessary while integrating into external systems. The URL can be added to $.callbackUrl.

For more information, please refer to the official documentation page.

The request will return a response containing the importer id, for example:

{   "id": 523231,   "state": "init",   "match": {       "fields": [           2       ],       "blacklist": [           25528       ]   },   "updateFields": [       1, 2, 3   ],   "poolId": 25528}

The returned ID is now used for populating records to the import request by calling the /imports/{id}/insert endpoint; in this case /imports/523231/insert. The request should include your contact records in the body, according to the documentation.

[   {       "data": {           "1": "Peter",           "2": "12345678",           "3": "8000"       }   },   {       "data": {           "1": "Martin",           "2": "87654321",           "3": "9000"       }   }]

Lastly, initiate the import request by calling /imports/{id}/start.

Did this answer your question?