Skip to main content
This guide shows you how to build an unattended integration that uploads an audience to Narrative and delivers it into one advertiser’s own seat at The Trade Desk (TTD). A person signs in once to create an API key, and the integration uses that key from then on. First-party delivery needs no taxonomy and no review by TTD. To list an audience in TTD’s marketplace instead, see Third-party delivery via the API. First-party and third-party delivery compares the two models. Before you start, complete the prerequisites and set up API access.

1. Create the dataset

Your schema decides whether The Trade Desk will accept the audience, so settle it before you upload anything.

Required columns

first_party and third_party_v2 take the same schema. The dataset needs at least one of these identifier columns: Each identifier column is named after its Rosetta Stone attribute, and the connector matches on that column name. A column holds either a plain string or an object. In the dataset schema, declare a string column with "type": "string", and declare an object column with "type": "object" and its properties:
Send an object column as an object in each row:
See your connector’s reference page for the attributes it accepts and their exact shapes. A row with one identifier looks like this:
See Supported identifiers for how The Trade Desk matches each identifier.

Check the schema first

The connector’s validation endpoint takes the schema you plan to use and answers 200 with an empty body when The Trade Desk would accept it. It needs no authorization header, and id can be any number:
A schema with no recognized identifier comes back 400, with one entry for each identifier the connector looked for:

Create it

write_mode is overwrite or append. file_config.type is json for JSON Lines, parquet, or flat for CSV. Record the dataset id from the response.
You do not need to supply UID2. The connector generates UID2 tokens from hashed email addresses automatically.

2. Activate the dataset

Activation locks the schema. You cannot change it afterward, so activate only once the shape is settled.

3. Upload and ingest your file

Each line of the file is one row that matches the schema you declared in step 1. For the columns The Trade Desk accepts and their shapes, see Supported identifiers and Required columns. You can load a file into a dataset over the API in two ways:
  • Signed-URL upload. Your integration uploads one file of up to 3 GB, then asks Narrative to ingest it.
  • Managed S3 bucket. You write files to an S3 bucket that Narrative manages, and Narrative ingests each batch on its own. Use a managed bucket for files larger than 3 GB, or for files that another system delivers on a schedule.

Choose a file format

The dataset’s file_config.type sets the format of every file you load into it. Parquet and JSON Lines both hold object columns, which nest properties inside one column:
  • Parquet (parquet) is the most compatible format for connector datasets. It stores nested struct columns and their types natively, and Narrative matches columns to the schema by name at every level.
  • JSON Lines (json) holds one JSON object per line. Narrative matches each nested object to the schema by name.
CSV datasets (flat) hold only scalar columns, so they can’t carry object columns.

Upload a file with a signed URL

Request an upload URL, then send the file straight to storage:
The upload URL is valid for 30 minutes and carries its own signature, so send no authorization header with the PUT.
Keep the path from the response. Narrative assigns its own storage path, which does not match the name you requested, and the ingest request needs Narrative’s path rather than yours.
Then ingest the file into the dataset, passing that path as source_file:
Ingestion runs in the background. Watch the record count on the dataset to know when it has finished:
The count moves from zero to your row count, typically within a couple of minutes. Each ingested file adds a new snapshot to the dataset, and every active connection on the dataset delivers that snapshot.

Write files to a managed S3 bucket

A managed bucket is an S3 bucket that Narrative creates for your company. You write each batch of files into its own folder under the dataset’s path in the bucket, then write an empty _NIO_COMMIT file into that batch folder. Narrative ingests every file in the batch folder when the commit file appears, so you make no upload or ingest request. A file can be as large as S3 accepts. See Ingesting Files from a Managed S3 Bucket to create the bucket, grant your AWS account access, and lay out the folders.

4. Confirm The Trade Desk accepts the dataset

Before you create a connection, ask Narrative which connector interfaces the dataset satisfies:
The response checks the dataset’s schema against every interface of the connectors your company has installed, and sorts the results into two lists:
  • accepted lists each interface you can connect the dataset to, by the connector’s app_id and the interface_id.
  • errors lists each interface the schema does not satisfy. Its details hold the reason, such as "required property '<column>' not found".
Add ?tags=<tag> to check only the interfaces that carry that tag. When the interface you want is under errors, the dataset’s schema doesn’t meet what the interface needs, for example a missing column or property. Activation locks the schema, so create a new dataset that fixes what the error names. For The Trade Desk, look for "app_id": 11 in accepted, under the interface your delivery model uses: first_party for first-party, third_party_v2 for third-party. See Delivery interfaces for what each interface does.

5. Find your connector profile

Your connector profile holds your Brand ID and Sub-Provider ID, and every delivery names it. The connector’s /profiles endpoint returns it:
Record the profile id. Its status must be enabled. GET /profiles/{profile_id} returns the same record on its own. If you have no profile yet, create one in the Narrative UI under Objects → Installed Apps → Trade Desk Connector and enter your Brand ID there.

6. Register the advertiser

Register each receiving advertiser once. The registration holds the credentials the connector uses to deliver into that advertiser’s seat.
The response is 200 with the registration:
ttd_id is the advertiser’s ID in The Trade Desk. You use the same value in the next step. id is Narrative’s identifier for the registration, which you use only to read, change, or remove it. See Managing advertiser registrations.

7. Deliver the audience

Create a connection joining the dataset, the profile, and the advertiser:
The response is 201 with the connection:
The outer type identifies what you are connecting, and quick_settings.type selects the delivery interface. advertiser_ids takes the advertiser’s Trade Desk ID, the value you registered as ttd_id, not the id Narrative returns for the registration. data_segment_names is the name the segment carries in the advertiser’s seat. It is free text, not a taxonomy element. What the connection does describes every field, its allowed values, and its default, along with what the connection does with existing and new rows. historical_data_enabled takes effect when the connection is created.

8. Confirm the connection

The response lists the first_party connection you created under records. GET /v2/connections/{connection_id} returns it on its own. Once delivery runs, the segment appears in the advertiser’s seat under the name you gave it in data_segment_names, as though the advertiser had uploaded it themselves.

Keeping the audience current

Write new data to the dataset. The connection keeps running, so new rows reach the advertiser’s seat without further calls. Refresh the dataset more often than the membership duration. Members that no delivery renews expire after targeting_time_to_live_in_minutes, and your source dataset must refresh at least every 90 days. advertiser_ids takes a list, so one connection can deliver the audience to several registered advertisers.

Managing advertiser registrations

List your registrations, or read one by its id:
Replace a registration with PUT, for example when the advertiser gives you a new secret key. PUT replaces the whole record, so send all three fields:
Remove a registration you no longer deliver to. Delete the connections that deliver to that advertiser first:

Stopping a delivery

Delete the connection to stop delivering the audience:

Troubleshooting

Dataset and upload problems

Delivery problems

Getting help

Contact your Narrative relationship manager with your company ID, the dataset ID, the connection ID, and the failing request and response. For questions about the advertiser’s seat or credentials, the advertiser’s TTD account representative is the faster path.

Third-party delivery via the API

List an audience in TTD’s marketplace instead

The Trade Desk Connector

Full settings reference, identifiers, and status vocabularies

Connector Interfaces

Why a dataset connects to an interface rather than a connector

API Keys

Create and rotate keys for programmatic access