You can write job results from Treasure Data directly to AdRoll API.


An AdRoll application must be created and then approved by AdRoll prior to Treasure Data connector use. See for more details. (You must login to see the information.)

Use the TD Console to Create Your Connection

Create a New Connection

In Treasure Data, you must create and configure the data connection prior to running your query. As part of the data connection, you provide authentication to access the integration.

1. Open TD Console.
2. Navigate to Integrations Hub  Catalog.
3. Click the search icon on the far-right of the Catalog screen, and enter AdRoll.
4. Hover over the AdRoll connector and select Create Authentication.

The following dialog opens.

Username and password are the same values required to log into

API Key is the same as the Client ID that is generated as part of an AdRoll application.

Configure Export Results in Your Data Connection

In this step, you create or reuse a query. In the query, you configure the data connection.

Note: Sometimes you need to define the column mapping in the query.

Configure the Connection by Specifying the Parameters

Go to the TD Console. Go to Data Workbench > Queries. Access the query that you plan to use to export data.

Select Export Results located at top of your query editor. The Choose Integration dialog opens. Type the connection name in the search box to filter and select your connection.


  • Advertiser ID (required): The ID used to group audiences under.

  • Retry Limit (optional): Number of times to attempt a network operation. Default: 7

  • Connect Timeout in Seconds(optional): The time, in seconds, to wait until aborting a connection operation. Default: 300, which is equivalent to 5 minutes.

  • Read Timeout in Seconds (optional): The time, in seconds, to wait until aborting a read operation. Default: 900, which is equivalent to 15 minutes.

  • Write Timeout in Seconds (optional): The time, in seconds, to wait until aborting a write operation. Default: 900, which is equivalent to 15 minutes.

  • Skip on invalid records? (optional): Checkbox to either continue processing if one or more invalid records are encountered (checked) or otherwise terminate processing (unchecked).

 The following is a sample configuration: 

Example of a Query to Populate AdRoll

From Treasure Data, run the following query with Export Results into a connection for AdRoll:

Code Example

SELECT type, data, segment_id, segment_name FROM your_table;

Optionally Schedule the Query Export Jobs

You can use Scheduled Jobs with Result Export to periodically write the output result to a target destination that you specify.

1. Navigate to Data Workbench > Queries.
2. Create a new query or select an existing query.
3. Next to Schedule, select None.

4. In the drop-down, select one of the following schedule options:

Drop-down ValueDescription
Custom cron...

Review Custom cron... details.

@daily (midnight)Run once a day at midnight (00:00 am) in the specified time zone.
@hourly (:00)Run every hour at 00 minutes.
NoneNo schedule.

Custom cron... Details

Cron Value


0 * * * *

Run once an hour.

0 0 * * *

Run once a day at midnight.

0 0 1 * *

Run once a month at midnight on the morning of the first day of the month.


Create a job that has no scheduled run time.

 *    *    *    *    *
 -    -    -    -    -
 |    |    |    |    |
 |    |    |    |    +----- day of week (0 - 6) (Sunday=0)
 |    |    |    +---------- month (1 - 12)
 |    |    +--------------- day of month (1 - 31)
 |    +-------------------- hour (0 - 23)
 +------------------------- min (0 - 59)

The following named entries can be used:

  • Day of Week: sun, mon, tue, wed, thu, fri, sat.

  • Month: jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec.

A single space is required between each field. The values for each field can be composed of:

Field ValueExampleExample Description

A single value, within the limits displayed above for each field.

A wildcard ‘*’ to indicate no restriction based on the field. 

‘0 0 1 * *’ Configures the schedule to run at midnight (00:00) on the first day of each month.
A range ‘2-5’, indicating the range of accepted values for the field.‘0 0 1-10 * *’ Configures the schedule to run at midnight (00:00) on the first 10 days of each month.
A list of comma-separated values ‘2,3,4,5’, indicating the list of accepted values for the field.

0 0 1,11,21 * *’

Configures the schedule to run at midnight (00:00) every 1st, 11th, and 21st day of each month.
A periodicity indicator ‘*/5’ to express how often based on the field’s valid range of values a schedule is allowed to run.

‘30 */2 1 * *’

Configures the schedule to run on the 1st of every month, every 2 hours starting at 00:30. ‘0 0 */5 * *’ configures the schedule to run at midnight (00:00) every 5 days starting on the 5th of each month.
A comma-separated list of any of the above except the ‘*’ wildcard is also supported ‘2,*/5,8-10’‘0 0 5,*/10,25 * *’Configures the schedule to run at midnight (00:00) every 5th, 10th, 20th, and 25th day of each month.
5.  (Optional) You can delay the start time of a query by enabling the Delay execution.

Execute the Query

Save the query with a name and run, or just run the query. Upon successful completion of the query, the query result is automatically imported to the specified container destination.

Scheduled jobs that continuously fail due to configuration errors may be disabled on the system side after several notifications.

Optionally Configure Export Results in Workflow

Within Treasure Workflow, you can specify the use of a data connector to export data.

Learn more at Using Workflows to Export Data with the TD Toolbelt.

timezone: UTC

    database: sample_datasets

  td>: queries/sample.sql
  result_connection: your_connections_name
    advertiser_id: 12345
    request_retries: 7
    request_connect_timeout: 300
    request_read_timeout: 900
    request_write_timeout: 900
    skip_invalid: true

You can read more about using data connectors in Workflows to export data.

FAQ for Export into AdRoll

What happens if both segment ID and segment name are provided for a row?

If segment ID is non-NULL, then the data represented by the row is used to update an existing segment that matches the segment ID provided. If segment ID is NULL, then the data represented by the row is used to create a new segment.

Note that AdRoll does not support unique segment names, so there can be multiple segments with the same segment name.

Are there any resource limits imposed by the AdRoll API?

  • Yes, AdRoll has several resource limits. AdRoll API calls can only be executed a total of 10,000 times per day. Each AdRoll API call payload cannot exceed 10MB in size. Each advertiser organization can only support 100 CRM type segments. Exceeding any of these limits results in an error.

  • Note that these limits can be increased by contacting AdRoll.

Is there a difference in AdRoll API behavior between CRM and Custom segments?

The AdRoll API presents the following differences and limitations:

  • CRM segments require at least 100 data items to either create or update. Custom segments have no limits on the number of data items.

  • There is a limit on the number of CRM segments that can exist within an advertiser organization (default 100). There is no limit to the number of Custom segments.

  • During update operations, where the segment ID is provided, CRM segment data is entirely replaced and not appended to, while Custom segment data is appended to the existing data.

FAQ for Log Messages

Too many CRM segments created for the organization <id> (max 100 segments)

  • The create CRM segment limit has been exceeded. Either delete some existing CRM segments or contact AdRoll to increase the limit.

Minimum requirement of 100 valid plain-text emails or MD5 hashed emails not met. Only 1 valid emails or MD5 hashes found

  • This error only affects CRM segments. CRM segments require at least 100 data items.

We are currently in a scheduled maintenance window, please try again later. See for more information

  • This is a message from AdRoll indicating that the API is temporarily unavailable. 

Missing or incorrect credentials

  • The user or password entered do not grant access to the AdRoll API.

Something went wrong

  • The AdRoll API returns this generic message: Your guess is as good as ours. 

Column Naming

Data exported to AdRoll must follow the AdRoll schema. Supported column names are:

  • type : The operation (CRM or custom) to perform on an segment

  • data : The data (email or cookie id) to add to a segment

  • segment_id : The segment ID

  • segment_name : The segment name

  • No labels