Used to create new user profiles and/or set attributes for these profiles.

This method is used to import or update the system fields for user profiles as well as any custom profile attributes, similar to importing a CSV using the interface and using the same field names listed in that guide.

Further information on user profiles, device profiles and attributes can be found in the guide on user data.

The attributes being updated are listed in the columns parameter, and the individual values are set in an array of arrays in the rows parameter, keeping the same column order. There are a number of reserved field names you can use in the list of column headers to set system user profile attributes. These are listed in the Attributes guide.

You must set a user_id and if setting email or mobile_number, the email and SMS subscription status must also be set. Custom Profile Attributes can also be set by adding the attribute key name in the list of column headers.

If you are setting a JSON value into a custom attribute, it must be provided as a JSON string, so the value must be escaped.

👍

Record limit

For optimal imports, limit your use of this method to 10,000 records in a single request. If you are importing more records, batch the data into multiple requests.

Asynchronous mode

By default, this method will process records asynchronously, when 100 records or more are given. This allows the API request to respond more quickly, and the import process to be optimised for larger datasets.

For asynchronous imports, a 202 response code is given (both as the HTTP status code and in the JSON response data). The task ID in the response can be used to check the import status using the Task Info method.

Examples

curl --request POST \
  --url https://external-api.xtremepush.com/api/external/import/profile \
  --header 'content-type: application/json' \
  --data '{
    "apptoken": "YOUR_APPTOKEN",
    "columns": ["user_id", "email", "email_subscription", "mobile_number", "sms_subscription", "first_name"],
    "rows": [
      ["fe56bc676be78", "[email protected]", 1, 353850123456, 1, "Sam"],
      ["fe56bc676be79", "[email protected]", 1, 447700900900, 1, "Joe"]
    ]
  }'

If you are not identifying customers or if you want to import data to anonymous profiles in addition to identified user profiles, you can replace your user_id with the Xtremepush device_id:

curl --request POST \
  --url https://external-api.xtremepush.com/api/external/import/profile \
  --header 'content-type: application/json' \
  --data '{
    "apptoken": "YOUR_APPTOKEN",
    "columns": ["device_id", "language", "timezone", "country", "region", "first_name"],
    "rows": [
      ["12345", "en", "Europe/Dublin", "Ireland", "Europe", "Sam"],
      ["12346", "en", "Europe/London", "UK", "Europe", "Joe"]
    ]
  }'

To import an array of values into an array type attribute, the JSON array string must be escaped: Example:

curl --request POST \
  --url https://external-api.xtremepush.com/api/external/import/profile \
  --header 'content-type: application/json' \
  --data '{
    "apptoken": "YOUR_APPTOKEN",
    "columns": ["user_id", "order"],
    "rows": [
      ["user", "[\"frapuccino\", \"iced latte\"]"]
    ]
  }'

To import a JSON object into an array type attribute, the JSON object string must be escaped:

curl --request POST \
  --url https://external-api.xtremepush.com/api/external/import/profile \
  --header 'content-type: application/json' \
  --data '{
    "apptoken": "YOUR_APPTOKEN",
    "columns": ["user_id", "order"],
    "rows": [
      ["user1", "{\"order_total\":12.34, \"item_count\":3, \"item_name\":\"socks\", \"properties\": {\"colour\":\"red\", \"size\":\"M\"}}"]
    ]
  }'
Language
Click Try It! to start a request and see the response here!