Aptrinsic Data Loader

Updated 2 months ago by Angelo Matheou

Utility script to update Aptrinsic user and account data using the Aptrinsic REST API. Requires active Aptrinsic subscription and an Aptrinsic API key (see below for details). An input file containing either user or account data in CSV format is used to update and optionally insert the corresponding records into Aptrinsic. If any errors are encountered during the process, they are logged to the screen and the process continues.



Download script to your local computer using this link: aptrinsic_loader

Depends on python (>= v2.7) being installed locally and being present in the path. Most Macs already have Python installed.

There is an install script that will perform the remaining steps on OSX/Mac, download here: install.sh

Run install script:

bash ./install.sh


Download script to your local computer using this link: aptrinsic_loader

Python (>= 2.7.9) should be installed, see here if it is not: https://www.python.org/downloads/windows/

Install the "requests" library using pip

python -m pip install requests


aptrinsic_loader [--insertMissing] [--verbose] [--dryRun] config.json USER|ACCOUNT input.csv

  • Data type (second argument) should either be USER or ACCOUNT
  • If insertMissing is specfied, will insert missing records. Default behavior is to update records that areaptrinsic_loader found
  • If verbose is specified, each operation is logged to stdout
  • If dryRun is specified, no data is changed, inputs are parsed
Mac Example:
./aptrinsic_loader --updateOnly config.json USER users.csv
Windows Example:
aptrinsic_loader --updateOnly config.json USER users.csv

CSV File Example:


CSV details:

* Date values are specified as milliseconds since the Unix epoch

* String values can optionally be surrounded with double quotes to escape commas

Config File Example:

"productKey": "AP-XXXXXXXXXXXX-2",
"fieldMapping": {
"USER": {
"identifyId": "id",
"title": "title",
"phone": "telephone",
"location.city": "city",
"location.stateCode": "state",
"location.coordinates.latitude": "latitude",
"location.coordinates.longitude": "longitude",
"customAttributes.strtmp1": "strtmp1",
"customAttributes.acceptDate": "acceptDate"
"id": "id",
"name": "account_name"

Field Mapping Details:

  • apiKey: From the Aptrinsic Settings/REST API/New API Key screen
  • productKey: From the Aptrinsic Settings/Products screen
  • fieldMapping:
  • Specifies which Aptrinsic fields will be used as targets for the data in the input file.
  • The first field name (the key of the fieldMapping map) is the aptrinsic name, the second (the value) is the name in the CSV input file.
  • The unique identifier field is required for both users (identifyId) and account (id)
  • To specify nested fields, use periods as separators (see location and customAttributes examples above)

How did we do?