Import user properties from CSV

Asynchronously imports user properties from CSV-file.

URL

POST https://api.dashly.app/users/import

Parameters

Authentification parameters.

Parameter Type Description
app ID ID of your application in Dashly. You can set $self_app in order to use token data
file File CSV-file in utf-8 encoding, less than 30 Mbytes
merge_field string Can be either $user_id (default) or $email
delimiter string Column delimiter in CSV-file. Can be one of ,, |, ;, \t (tab, default), (space)
tags string Tag names array to be set to every imported users. Every name must be JSON-encoded

Notes

Property names are taken from first line of CSV-file.
System property names should be set as system keys (starting with $ character). You can get system keys from our knowledge base.

File must have UTF-8 encoding and size less than 30 Mbytes.

During import we search for existing users by import key property. Those, we find, are updated. Not found users are created. You can use multiple fields as import key:

  • User ID in your system
    When importing by User ID, CSV-file must have $user_id column. User ID is the same key you use while merging users with carrotquest.auth method.

  • Email user property
    When importing by Email, CSV-file must have $email column. If multiple existing users have same email, only the user with the most recent "Last activity" property would be updated.

As soon as import finishes, you will get notification in admin panel showing import summary.

Important! Be accurate while filling your source CSV-file. It should not contain extra space or invisible characters in column names or property values, especially in key columns.

Response

{
  "meta": {
    "status": 200
  },
  "data": {
    "row_errors": {1: "Error in string 1", 33: "Error in string 33", ...},
    "updates_planned": 123
  }
}
  • row_errors - A dictionary of errors, found during CSV-file validation. Dictionary key is a number of string in file. Value represents error text.
  • updates_planned - Number of records which were scheduled for import. Note that there can be errors during import process. In this case number of really imported users would not match.

Examples

Import file: 2 users are searched by User ID and update there system property "Name" ($name) and custom property "Action".

"$user_id";"$name";"Action"
777;"Harry Potter";"catches golden snitch"
246;"Severus Snape";"casts a spell"

Request example. Note that tags are surrounded by " character - this is a result of JSON-encoding.

curl -X POST \
  --data "file=@/path/to/database.csv" \
  --data-urlencode "app={ID}" \
  -H "Authorization: Token XXX" \
  --data-urlencode "merge_field=$user_id" \
  --data-urlencode "delimiter=;" \
  --data-urlencode 'tags="super_tag","import_tag_2"' \
  https://api.dashly.app/users/import