Send an Audience to The Trade Desk

Use Case

  • Send any Delivr audience to your Trade Desk advertiser, and keep it fresh on a schedule
  • See your Trade Desk campaigns in Delivr next to the campaigns Delivr runs, with the figures The Trade Desk reports

You connect your Trade Desk advertiser to a project once. After that, an export sends an audience to it on each run, and Delivr imports the advertiser's campaigns once a day.

Prerequisites

  • An organization API key and secret pair (Authentication).
  • A project id.
  • An audience id. Any Delivr audience can be sent, such as an intent, contact or lookalike audience, or a list or dataset audience built from your own data.
  • From The Trade Desk, the credentials in the next table.

The Credentials and What Each Is For

FieldRequiredWhat Delivr does with it
advertiser_idYesNames the advertiser that receives the audiences. Delivr returns it in config.settings.advertiser_id.
advertiser_secretYesSigns each audience upload. Find it under Advertiser Preferences in The Trade Desk.
api_tokenYes, to send audiencesReads the impressions The Trade Desk serves on your audiences, which is what Delivr bills. It also reads your campaigns and their daily reports. Your Trade Desk account team enables API access.

Delivr encrypts advertiser_secret and api_token and never returns them. You can save the integration without api_token, but Delivr does not send audiences to it. Creating or updating an export to the integration answers 400 until it holds an api_token that its last test did not refuse.


Steps

1. Connect Your Advertiser

curl -X POST "https://api.delivr.ai/api/v1/integrations?project_id=YOUR_PROJECT_ID" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "X-Api-Secret: YOUR_API_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "the_trade_desk",
    "name": "Our Trade Desk advertiser",
    "advertiser_id": "YOUR_ADVERTISER_ID",
    "advertiser_secret": "YOUR_ADVERTISER_SECRET",
    "api_token": "YOUR_API_TOKEN"
  }'
import { Configuration, IntegrationsApi, TheTradeDeskConnectionTypeEnum } from "@delivrai/sdk";

const config = new Configuration({
  apiKey: (header) =>
    header === "X-Api-Key" ? process.env.DELIVR_API_KEY! : process.env.DELIVR_API_SECRET!,
});
const result = await new IntegrationsApi(config).createIntegration({
  projectId: "YOUR_PROJECT_ID",
  integrationConnection: {
    type: TheTradeDeskConnectionTypeEnum.THE_TRADE_DESK,
    name: "Our Trade Desk advertiser",
    advertiser_id: "YOUR_ADVERTISER_ID",
    advertiser_secret: "YOUR_ADVERTISER_SECRET",
    api_token: "YOUR_API_TOKEN",
  },
});
import os
from delivr_sdk import Configuration, IntegrationsApi, IntegrationConnection
from delivr_sdk.api_client import ApiClient

config = Configuration(api_key={
    "ApiKey": os.environ["DELIVR_API_KEY"],
    "ApiSecret": os.environ["DELIVR_API_SECRET"],
})
result = IntegrationsApi(ApiClient(config)).create_integration(
    project_id="YOUR_PROJECT_ID",
    integration_connection=IntegrationConnection.from_dict({
        "type": "the_trade_desk",
        "name": "Our Trade Desk advertiser",
        "advertiser_id": "YOUR_ADVERTISER_ID",
        "advertiser_secret": "YOUR_ADVERTISER_SECRET",
        "api_token": "YOUR_API_TOKEN",
    }),
)

The response is the new integration. Note its id.

To check the credentials, send POST /api/v1/integrations/{id}/test. The answer gives a result for each credential: verified, rejected, unverified or not_provided. If The Trade Desk rejects api_token, save a working token and test again before you send an audience.

2. Send an Audience

Create an export from your audience to the integration from step 1. The destination takes only the integration, because the connection decides what is sent.

curl -X POST "https://api.delivr.ai/api/v1/exports" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "X-Api-Secret: YOUR_API_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "project_id": "YOUR_PROJECT_ID",
    "name": "Customer list to The Trade Desk",
    "query": {
      "sourceType": "audience",
      "sourceId": "YOUR_AUDIENCE_ID"
    },
    "schedule": "daily",
    "run_time": "06:00",
    "destination": {
      "type": "the_trade_desk",
      "integration_id": "YOUR_INTEGRATION_ID"
    }
  }'
import { ExportsApi, TheTradeDeskDestinationTypeEnum } from "@delivrai/sdk";

// Reuses the config from the first TypeScript example on this page.
const result = await new ExportsApi(config).createExport({
  createExportRequest: {
    project_id: "YOUR_PROJECT_ID",
    name: "Customer list to The Trade Desk",
    query: { sourceType: "audience", sourceId: "YOUR_AUDIENCE_ID" },
    schedule: "daily",
    run_time: "06:00",
    destination: {
      type: TheTradeDeskDestinationTypeEnum.THE_TRADE_DESK,
      integration_id: "YOUR_INTEGRATION_ID",
    },
  },
});
from delivr_sdk import ExportsApi, CreateExportRequest
from delivr_sdk.api_client import ApiClient

# Reuses the config from the first Python example on this page.
result = ExportsApi(ApiClient(config)).create_export(
    create_export_request=CreateExportRequest.from_dict({
        "project_id": "YOUR_PROJECT_ID",
        "name": "Customer list to The Trade Desk",
        "query": {"sourceType": "audience", "sourceId": "YOUR_AUDIENCE_ID"},
        "schedule": "daily",
        "run_time": "06:00",
        "destination": {
            "type": "the_trade_desk",
            "integration_id": "YOUR_INTEGRATION_ID",
        },
    }),
)

What Each Run Sends

  • Each run uploads the audience's UID2s to one segment in your advertiser, named delivr_audience_ and the audience id.
  • Segment memberships expire after 7 days. A person stays in the segment for 7 days after the last run that sent them, so a daily export keeps current members in the segment.
  • A rename of the audience keeps the same segment, because the name uses the audience id.

Billing

Audiences you send are uploaded to your Trade Desk advertiser and used under your Trade Desk terms. Delivr bills $2.00 per 1,000 impressions The Trade Desk serves on them, or the rate in your agreement. Sending or refreshing an audience bills nothing for the people sent. If the audience uses partner data, each run still bills that dataset's rate. See Partner data.

If a usage limit, budget or payment refusal applies to your organization, Delivr pauses the sync and removes the segments from your seat.


Your Trade Desk Campaigns in Delivr

With the integration's api_token, Delivr imports the advertiser's campaigns once a day. Each import also reads the daily impressions, clicks and spend for the last 7 days.

  • Where a campaign runs. Every campaign carries runs_on. delivr means Delivr runs it, and the_trade_desk means The Trade Desk runs it. A Trade Desk campaign also carries external_campaign_id, its id in The Trade Desk.
  • Filter by platform. Send runs_on with project_id to GET /api/v1/campaigns, for example ?project_id=YOUR_PROJECT_ID&runs_on=the_trade_desk. Any other value answers 400 and names the valid values.
  • Read only. You change a Trade Desk campaign in The Trade Desk. Every write to it in Delivr answers 409 with a plain-text message that names the platform.
  • Figures. GET /api/v1/campaigns/{id}/performance returns the figures The Trade Desk reported, one row per UTC day. The response carries runs_on and day_time_zone.

Null Means Not Reported

A figure The Trade Desk does not report is null, never 0. Today the import reads impressions, clicks and spend. So wins, bids, win_rate and viewability are null for a Trade Desk campaign. CTR, CPM and CPC use only the days that reported both of their parts. Read a null as "not reported", not as zero.

In GET /api/v1/campaigns/performance-summary, project totals add The Trade Desk's figures to Delivr's. A total is null only when no campaign reported it. Trade Desk days are UTC and Delivr days are Pacific time, so the response carries platform_day_time_zone.


Notes

  • One Trade Desk integration connects one advertiser to one project.
  • The project_id and integration_id must both belong to your key's organization.

Next Steps

  • Integrations API: create, test and rotate the credentials of an integration
  • Exports API: create, list, get, update and delete exports
  • Campaigns API: list campaigns, filter by runs_on, and read performance

Did this page help you?