Page tree
Skip to end of metadata
Go to start of metadata

You can import specific catalog item data into a dataset using the Interaction Studio API. This is useful if you want to add catalog items from your database to your Interaction Studio dataset directly instead of waiting for them populate with specific events. You can also use catalog item upserts to update a specific catalog already in your dataset. These import are called "upserts" because if the catalog item is already known to Interaction Studio it is updated, otherwise it is inserted. This data must be constructed very precisely and submitted to Interaction Studio as a .CSV (Comma Separated Value) file. These files can be created in any spreadsheet program such as MS Excel or Google Sheets. Spreadsheet, etc.).

Deprecated API

This API is deprecated. Customers that continue to leverage this API should be aware that support troubleshooting and bug fixes for this API are no longer available. We recommend leveraging the productized feeds outlined here.

This Article Explains

This section details how to import user and account data into a dataset using the Interaction Studio API.

Sections in this Article


Here is the basic structure for the Users Upsert API, assuming your account name with Interaction Studio is "account" and your dataset is "engage"
Users can be updated in batch. Data is sent in array form and must include the user's unique ID, and if the dataset is setup to track accounts, it must also include the matching accountName.

Here is the basic structure for the Accounts Upsert API, assuming your account name with Interaction Studio is "account" and your dataset is "engage"

Example JSON file format for User Upsert

The following is example JSON that can be posted to the user upsert path to update user attributes. 

This example updates the user attributes "age" and "state" respectively. All attributes must be sent as strings.

    { "name": "", "attributes": { "age": "33", "state": "MA" }, "accountName": "the aes corporation" },
    { "name": "", "attributes": { "age": "19", "state": "VA" }, "accountName": "the company com" }

Example JSON file format for Account Upsert

The following is example JSON that can be posted to the account upsert path to update account attributes. 

This example updates the account attribute "accountStatus". All attributes must be sent as strings.
    { "name": "the aes corporation", "attributes": { "accountStatus": "Paid" } },
    { "name": "the company com", "attributes": { "accountStatus": "Free" } }

Example CSV file format for Updates

See CSV Users and Accounts Import for a detailed document on how the CSV file should look.

Update Language Examples

For all examples, we will be using the following values:

Interaction Studio Account Key (this is the subdomain you use to login to Interaction Studio with, if your account is "", then use "testaccount"):


Interaction Studio Dataset (by default this is "engage"):


API Token Key ID (the ID of the API token you are using to authenticate and authorize the request)


API Token Secret Key (the API key secret for the designated API token


Authorization Value (for some examples, this is the HTTP Basic encoding of your API Token key ID and  secret key.

Basic QUFDRUE4RTAtMUE0My00MTRDLTk3RTAtRkQ4MzU3NDg1Q0Y3OndkcnNaNGFTd0oxemt4Y1Z1eUx5QnN0Z00tazZoTDdoNDk2N1BBUVc3eGc=

File name.  When using file names (CURL), we assume you've named your files fileName.json and fileName.csv (for JSON and CSV formats respectively):

fileName.json / fileName.csv

CURL Example for User Upsert

Upserting data through CURL on the command line can be done with both CSV and JSON files.

The syntax is slightly different for both formats, so be sure to use the correct command depending on the format of your data.

For both commands you will need a few key values. In the commands listed below be sure to replace the accountKey, datasetNameapiTokenand fileName fields to their correct values. The account token value is available under  the API Tokens Settings.


curl -k -X POST -d @fileName.json -H "Content-Type:application/json" -H "Authorization: Basic QUFDRUE4RTAtMUE0My00MTRDLTk3RTAtRkQ4MzU3NDg1Q0Y3OndkcnNaNGFTd0oxemt4Y1Z1eUx5QnN0Z00tazZoTDdoNDk2N1BBUVc3eGc=" ""


curl -k -X POST -F "file=@fileName.csv" -H "Authorization: Basic QUFDRUE4RTAtMUE0My00MTRDLTk3RTAtRkQ4MzU3NDg1Q0Y3OndkcnNaNGFTd0oxemt4Y1Z1eUx5QnN0Z00tazZoTDdoNDk2N1BBUVc3eGc=" ""

Java Example for User Upsert


import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
import java.util.HashMap;
import java.util.Map;

public class RestCustomerUpdateToolMap {
    public static void main(String[] args) {
        Client client = Client.create();
        String evergageAccount = "testaccount";
        String dataset = "engage";
        String apiTokenId = "AACEA8E0-1A43-414C-97E0-FD8357485CF7";
		// in practice, never hard-code this secret!
		String apiTokenSecret = "";
		client.addFilter(new HTTPBasicAuthFilter(apiTokenId, apiTokenSecret));

        URI uri = UriBuilder.fromUri(
                "https://" + evergageAccount + "" + dataset + "/users/upsert")
                .queryParam("_at", apiToken).queryParam("_ak", evergageAccount).build();
        WebResource webResource = client.resource(uri);

        Map<String, Object> user = new HashMap<String, Object>();
        user.put("name", "");
        user.put("accountName", "the aes corporation");
        Map<String, String> userAttributes = new HashMap<String, String>();
        userAttributes.put("age", "37");
        user.put("attributes", userAttributes);

        ClientResponse response = webResource.type("application/json").post(ClientResponse.class, new Object[]{user});

        int status = response.getStatus();
        if (status >= 300) {
            System.out.println("Output from Server .... \n");
            String output = response.getEntity(String.class);
            throw new RuntimeException("Failed : HTTP error code : " + response.getStatus());
        } else {
            System.out.println("Updates sent.... \n");
            String output = response.getEntity(String.class);

PHP Example for User Upsert

User update  Example (PHP) 
<!doctype html>

function UpdateEvergageData($evergageAccount, $dataset)
    $requestURI = "https://" . $evergageAccount . ""
        . $dataset . "/users/upsert";

    // Set Request Options $session = curl_init();

    $session = curl_init();
    curl_setopt($session, CURLOPT_FAILONERROR, false);
    curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($session, CURLOPT_FOLLOWLOCATION, false);
    curl_setopt($session, CURLOPT_HEADER, true);
    curl_setopt($session, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($session, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($session, CURLOPT_POST, true);
    curl_setopt($session, CURLOPT_CUSTOMREQUEST, "POST");
    curl_setopt($session, CURLOPT_URL, $requestURI);

    //Set Headers

    $headers = array('Accept: application/json', 'Content-Type: application/json', 'Authorization: Basic 			QUFDRUE4RTAtMUE0My00MTRDLTk3RTAtRkQ4MzU3NDg1Q0Y3OndkcnNaNGFTd0oxemt4Y1Z1eUx5QnN0Z00tazZoTDdoNDk2N1BBUVc3eGc=');

    curl_setopt($session, CURLOPT_HTTPHEADER, $headers);

    // Construct User Data

    $data = array(
        array("name" => "", "accountName" => "the aes corporation", "attributes" => array("age" => "38")),
        array("name" => "", "accountName" => "agco corporation", "attributes" => array("age" => "40"))

    $data_string = json_encode($data);
    curl_setopt($session, CURLOPT_POSTFIELDS, $data_string);

    $response = curl_exec($session);

    $info = curl_getinfo($session);

    $responseCode = $info["http_code"];
    if ($responseCode >= 300) {
        print("Error loading data:" . $responseCode . "");
    } else {
        $body = substr($response, $info['header_size']);
        $decoded_result = json_decode($body, true);


    return $decoded_result;

UpdateEvergageData("testaccount", "engage");


Python Example for User Upsert

import json
import urllib2

data = [{"name":"kevin", "attributes":{"AlexTest":"success"}}]
req = urllib2.Request("")
req.add_header("Content-Type", "application/json")
req.add_header("Authorization", "Authorization: Basic 			QUFDRUE4RTAtMUE0My00MTRDLTk3RTAtRkQ4MzU3NDg1Q0Y3OndkcnNaNGFTd0oxemt4Y1Z1eUx5QnN0Z00tazZoTDdoNDk2N1BBUVc3eGc=")
response = urllib2.urlopen(req, json.dumps(data))