### TTD Workflows Integration Examples in Python Source: https://context7.com/context7/ttd-workflows_apidocumentation/llms.txt Demonstrates how to use the Python SDK for The Trade Desk's Workflows API. Includes examples for initializing the client, creating ad groups, executing GraphQL queries, and checking job statuses. Requires the 'ttd-workflows' library and authentication credentials. ```python from ttd_workflows import WorkflowsClient # Initialize the client client = WorkflowsClient( auth_token="your_security_token_here", base_url="https://ext-api.sb.thetradedesk.com/workflows" ) # Create an ad group ad_group_config = { "primaryInput": { "name": "Holiday_Premium_Display", "channel": "Display", "budget": { "allocationType": "Minimum", "budgetInAdvertiserCurrency": 50000.00 }, "baseBidCPMInAdvertiserCurrency": 2.50, "creativeIds": ["cr-67890"] }, "campaignId": "camp-54321" } response = client.ad_groups.create(ad_group_config) print(f"Created ad group: {response['adGroupId']}") # Query campaign performance query = """ query GetCampaignPerformance($campaignId: String!) { campaign(id: $campaignId) { id name impressions clicks conversions } } """ result = client.graphql.query( query=query, variables={"campaignId": "camp-78901"} ) print(f"Campaign impressions: {result['data']['campaign']['impressions']}") # Check job status job_status = client.jobs.get_status("job-bulk-12345") print(f"Job status: {job_status['status']}") print(f"Processed: {job_status['processedItems']}/{job_status['totalItems']}") ``` -------------------------------- ### Go SDK Usage Source: https://context7.com/context7/ttd-workflows_apidocumentation/llms.txt Examples for creating ad groups, executing GraphQL queries, and managing bulk jobs with the Go SDK. ```APIDOC ## Go SDK Usage ### Create Ad Group This example shows how to create a new ad group using the Go SDK. ### Method ```go client.AdGroups.Create(ctx, adGroup) ``` ### Request Body Example ```json { "primaryInput": { "name": "Holiday_Premium_Display", "channel": "Display", "budget": { "allocationType": "Minimum", "budgetInAdvertiserCurrency": 50000.00 }, "baseBidCPMInAdvertiserCurrency": 2.50, "creativeIDs": ["cr-67890"] }, "campaignID": "camp-54321" } ``` ### Response Example ```json { "adGroupID": "ag-98765" } ``` ### Execute GraphQL Query This example demonstrates executing a GraphQL query to retrieve campaign performance data. ### Method ```go client.GraphQL.Query(ctx, query, variables) ``` ### Request Example ```graphql query GetCampaignPerformance($campaignId: String!) { campaign(id: $campaignId) { id name impressions clicks } } ``` ### Variables Example ```json { "campaignId": "camp-78901" } ``` ### Response Example ```json { "data": { "campaign": { "id": "camp-78901", "name": "Example Campaign", "impressions": 100000, "clicks": 500 } } } ``` ### Submit Bulk Ad Group Creation Job This example shows how to initiate a bulk job for creating multiple ad groups. ### Method ```go client.AdGroups.BulkCreate(ctx, bulkJob) ``` ### Request Body Example ```json { "jobName": "Q4_AdGroup_Bulk_Creation", "adGroups": [ // ... ad group configurations ... ] } ``` ### Response Example ```json { "jobID": "job-fghij" } ``` ### Poll Job Status This example demonstrates polling the status of a bulk job. ### Method ```go client.Jobs.GetStatus(ctx, jobId) ``` ### Response Example ```json { "jobID": "job-fghij", "status": "Completed", "processedItems": 100, "totalItems": 100 } ``` ``` -------------------------------- ### Java SDK Usage Source: https://context7.com/context7/ttd-workflows_apidocumentation/llms.txt Examples demonstrating how to use the Java SDK to create campaigns and submit first-party data. ```APIDOC ## Java SDK Usage ### Create Campaign This example shows how to create a new campaign using the Java SDK. ### Method ```java client.campaigns().create(campaign) ``` ### Request Body Example ```json { "name": "Q4_2025_Holiday_Campaign", "advertiserId": "adv-54321", "budget": { "budgetInAdvertiserCurrency": 500000.00 }, "startDate": "2025-11-01T00:00:00Z", "endDate": "2025-12-31T23:59:59Z", "objective": "Conversions" } ``` ### Response Example ```json { "campaignId": "camp-12345" } ``` ### Submit First-Party Data This example demonstrates submitting first-party data for a segment using the Java SDK. ### Method ```java client.dmp().submitFirstPartyData(dataJob) ``` ### Request Body Example ```json { "jobName": "Customer_List_Upload_October", "advertiserId": "adv-54321", "segmentName": "High_Value_Customers", "members": [ {"email": "email@example.com", "type": "Email", "action": "Add"} ], "ttlInDays": 180 } ``` ### Response Example ```json { "jobId": "job-abcde" } ``` ### Poll Job Status This example shows how to poll the status of a job until it is completed. ### Method ```java client.jobs().getStatus(jobId) ``` ### Response Example ```json { "status": "Completed" } ``` ``` -------------------------------- ### Get Campaign Version via API Source: https://context7.com/context7/ttd-workflows_apidocumentation/llms.txt Retrieve version information for a specific campaign using its campaign ID. This is a GET request to the campaign version endpoint, requiring authentication. ```bash curl -X GET https://ext-api.sb.thetradedesk.com/workflows/campaign/camp-78901/version \ -H "TTD-Auth: your_security_token_here" ``` -------------------------------- ### Submit Generic REST Request via API Source: https://context7.com/context7/ttd-workflows_apidocumentation/llms.txt Execute a generic REST API request to The Trade Desk platform. This flexible endpoint allows for various HTTP methods (GET, POST, etc.) and custom paths, query parameters, and headers for interacting with different platform resources. Requires authentication. ```bash curl -X POST https://ext-api.sb.thetradedesk.com/workflows/restrequest \ -H "Content-Type: application/json" \ -H "TTD-Auth: your_security_token_here" \ -d '{ "method": "GET", "path": "/v3/advertiser", "queryParameters": { "PageStartIndex": "0", "PageSize": "100" }, "headers": { "Accept": "application/json" } }' ``` -------------------------------- ### GET /campaign/{id}/version Source: https://ttd-workflows.apidocumentation.com/reference Retrieves a specific version of a campaign. ```APIDOC ## GET /campaign/{id}/version ### Description Retrieves a specific version of a campaign. ### Method GET ### Endpoint /campaign/{id}/version ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the campaign. #### Query Parameters - **version** (string) - Required - The version of the campaign to retrieve. #### Request Body None ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) (Type: object) - Details of the specified campaign version. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Go SDK: Create Ad Group, Execute GraphQL, and Bulk Jobs Source: https://context7.com/context7/ttd-workflows_apidocumentation/llms.txt Illustrates initializing the Go SDK client, creating an ad group, executing a GraphQL query to retrieve campaign performance data, and submitting a bulk job for ad group creation. Includes polling for job completion. ```go package main import ( "context" "fmt" "log" "time" "github.com/thetradedesk/workflows-go" ) func main() { // Initialize client client := workflows.NewClient( workflows.WithAuthToken("your_security_token_here"), workflows.WithBaseURL("https://ext-api.sb.thetradedesk.com/workflows"), ) ctx := context.Background() // Create ad group adGroup := &workflows.AdGroupCreateInput{ PrimaryInput: workflows.AdGroupPrimary{ Name: "Holiday_Premium_Display", Channel: "Display", Budget: workflows.Budget{ AllocationType: "Minimum", BudgetInAdvertiserCurrency: 50000.00, }, BaseBidCPMInAdvertiserCurrency: 2.50, CreativeIDs: []string{"cr-67890"}, }, CampaignID: "camp-54321", } result, err := client.AdGroups.Create(ctx, adGroup) if err != nil { log.Fatal(err) } fmt.Printf("Created ad group: %s\n", result.AdGroupID) // Execute GraphQL query query := ` query GetCampaignPerformance($campaignId: String!) { campaign(id: $campaignId) { id name impressions clicks } } ` variables := map[string]interface{}{ "campaignId": "camp-78901", } graphqlResult, err := client.GraphQL.Query(ctx, query, variables) if err != nil { log.Fatal(err) } campaign := graphqlResult.Data["campaign"].(map[string]interface{}) fmt.Printf("Campaign: %s, Impressions: %.0f\n", campaign["name"], campaign["impressions"]) // Submit bulk job and poll for completion bulkJob := &workflows.AdGroupBulkCreateJob{ JobName: "Q4_AdGroup_Bulk_Creation", AdGroups: []workflows.AdGroupCreateInput{ // ... ad group configs }, } jobResponse, err := client.AdGroups.BulkCreate(ctx, bulkJob) if err != nil { log.Fatal(err) } // Poll for completion for { status, err := client.Jobs.GetStatus(ctx, jobResponse.JobID) if err != nil { log.Fatal(err) } fmt.Printf("Job %s: %s (%d/%d processed)\n", status.JobID, status.Status, status.ProcessedItems, status.TotalItems) if status.Status == "Completed" || status.Status == "Failed" { break } time.Sleep(5 * time.Second) } } ``` -------------------------------- ### GET /graphqlbulkjob/{id} Source: https://ttd-workflows.apidocumentation.com/reference Retrieves the status of a bulk GraphQL job. ```APIDOC ## GET /graphqlbulkjob/{id} ### Description Retrieves the status of a bulk GraphQL job. ### Method GET ### Endpoint /graphqlbulkjob/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the bulk GraphQL job. #### Query Parameters None #### Request Body None ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) (Type: object) - The status of the bulk GraphQL job. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### GET /standardjob/{id}/status Source: https://ttd-workflows.apidocumentation.com/reference Retrieves the status of a standard job. ```APIDOC ## GET /standardjob/{id}/status ### Description Retrieves the status of a standard job. ### Method GET ### Endpoint /standardjob/{id}/status ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the standard job. #### Query Parameters None #### Request Body None ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) (Type: object) - The status of the standard job. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Java SDK: Create Campaign and Submit First-Party Data Source: https://context7.com/context7/ttd-workflows_apidocumentation/llms.txt Demonstrates initializing the Java SDK client, creating a new campaign with specified details, and submitting first-party data for an advertiser. It includes error handling and polling for job completion status. ```java import com.thetradedesk.workflows.WorkflowsClient; import com.thetradedesk.workflows.models.*; // Initialize the client WorkflowsClient client = new WorkflowsClient.Builder() .authToken("your_security_token_here") .baseUrl("https://ext-api.sb.thetradedesk.com/workflows") .build(); // Create campaign Campaign campaign = new Campaign.Builder() .name("Q4_2025_Holiday_Campaign") .advertiserId("adv-54321") .budget(new Budget.Builder() .budgetInAdvertiserCurrency(500000.00) .build()) .startDate("2025-11-01T00:00:00Z") .endDate("2025-12-31T23:59:59Z") .objective("Conversions") .build(); CampaignResponse response = client.campaigns().create(campaign); System.out.println("Created campaign: " + response.getCampaignId()); // Submit first-party data FirstPartyDataJob dataJob = new FirstPartyDataJob.Builder() .jobName("Customer_List_Upload_October") .advertiserId("adv-54321") .segmentName("High_Value_Customers") .addMember(new Member("email@example.com", "Email", "Add")) .ttlInDays(180) .build(); JobResponse jobResponse = client.dmp().submitFirstPartyData(dataJob); System.out.println("Job ID: " + jobResponse.getJobId()); // Poll job status until complete JobStatus status; do { Thread.sleep(5000); status = client.jobs().getStatus(jobResponse.getJobId()); System.out.println("Status: " + status.getStatus()); } while (!status.getStatus().equals("Completed")); ``` -------------------------------- ### POST /campaign Source: https://ttd-workflows.apidocumentation.com/reference Creates a new campaign. ```APIDOC ## POST /campaign ### Description Creates a new campaign. ### Method POST ### Endpoint /campaign ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body (Type: object) - Required - CampaignCreateWorkflowInput: Object containing the details for creating a new campaign. ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) (Type: object) - Details of the created campaign. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### POST /workflows/campaign Source: https://context7.com/context7/ttd-workflows_apidocumentation/llms.txt Create a new advertising campaign with targeting and budget configuration. ```APIDOC ## POST /workflows/campaign ### Description Create a new advertising campaign with targeting and budget configuration. ### Method POST ### Endpoint https://ext-api.sb.thetradedesk.com/workflows/campaign ### Parameters #### Headers - **Content-Type** (string) - Required - application/json - **TTD-Auth** (string) - Required - your_security_token_here #### Request Body - **name** (string) - Required - The name of the campaign. - **advertiserId** (string) - Required - The ID of the advertiser. - **budget** (object) - Required - The overall budget for the campaign. - **budgetInAdvertiserCurrency** (number) - Required - The total budget amount in the advertiser's currency. - **dailyTargetInAdvertiserCurrency** (number) - Optional - The daily target spend in the advertiser's currency. - **startDate** (string) - Required - The start date and time of the campaign (ISO 8601 format). - **endDate** (string) - Required - The end date and time of the campaign (ISO 8601 format). - **objective** (string) - Required - The objective of the campaign (e.g., "Conversions"). - **flights** (array) - Optional - A list of flights within the campaign. - **name** (string) - Required - The name of the flight. - **startDate** (string) - Required - The start date and time of the flight (ISO 8601 format). - **endDate** (string) - Required - The end date and time of the flight (ISO 8601 format). - **budgetInAdvertiserCurrency** (number) - Required - The budget for the flight in the advertiser's currency. ### Request Example ```json { "name": "Q4_2025_Holiday_Campaign", "advertiserId": "adv-54321", "budget": { "budgetInAdvertiserCurrency": 500000.00, "dailyTargetInAdvertiserCurrency": 16666.67 }, "startDate": "2025-11-01T00:00:00Z", "endDate": "2025-12-31T23:59:59Z", "objective": "Conversions", "flights": [ { "name": "Black_Friday_Week", "startDate": "2025-11-24T00:00:00Z", "endDate": "2025-11-30T23:59:59Z", "budgetInAdvertiserCurrency": 150000.00 }, { "name": "Cyber_Monday_Week", "startDate": "2025-12-01T00:00:00Z", "endDate": "2025-12-07T23:59:59Z", "budgetInAdvertiserCurrency": 120000.00 } ] } ``` ### Response #### Success Response (200) - **campaignId** (string) - The ID of the created campaign. - **status** (string) - The status of the campaign creation (e.g., "Created"). - **flightIds** (array) - A list of IDs for the created flights. #### Response Example ```json { "campaignId": "camp-78901", "status": "Created", "flightIds": [98765, 98766] } ``` ``` -------------------------------- ### GET /workflows/graphqlbulkjob/{jobId} Source: https://context7.com/context7/ttd-workflows_apidocumentation/llms.txt Retrieves the status and results of a previously submitted GraphQL bulk query job. Use the jobId obtained from the submission response. ```APIDOC ## GET /workflows/graphqlbulkjob/{jobId} ### Description Check the status and results of a GraphQL bulk query job. ### Method GET ### Endpoint https://ext-api.sb.thetradedesk.com/workflows/graphqlbulkjob/{jobId} ### Parameters #### Path Parameters - **jobId** (string) - Required - The ID of the GraphQL bulk job. #### Headers - **TTD-Auth** (string) - Required - Your security token ### Response #### Success Response (200) - **jobId** (string) - The unique identifier for the job. - **status** (string) - The current status of the job (e.g., "Completed", "Processing", "Failed"). - **totalQueries** (integer) - The total number of queries in the job. - **completedQueries** (integer) - The number of queries that have completed. - **failedQueries** (integer) - The number of queries that failed. - **results** (array) - An array of results for each query. - **queryId** (string) - The ID of the query. - **status** (string) - The status of the individual query ("Success", "Failed"). - **data** (object) - The data returned by the GraphQL query if successful. - **error** (object) - Error details if the query failed. - **completedAt** (string) - The timestamp when the job was completed. #### Response Example ```json { "jobId": "job-graphql-12351", "status": "Completed", "totalQueries": 3, "completedQueries": 3, "failedQueries": 0, "results": [ { "queryId": "query-1", "status": "Success", "data": { "campaign": { "id": "camp-10001", "impressions": 5000000, "clicks": 50000 } } }, { "queryId": "query-2", "status": "Success", "data": { "campaign": { "id": "camp-10002", "impressions": 6000000, "clicks": 60000 } } }, { "queryId": "query-3", "status": "Success", "data": { "campaign": { "id": "camp-10003", "impressions": 4000000, "clicks": 40000 } } } ], "completedAt": "2025-10-11T14:35:00Z" } ``` ``` -------------------------------- ### Authentication Configuration Source: https://context7.com/context7/ttd-workflows_apidocumentation/llms.txt Instructions for configuring authentication using environment variables, curl, and configuration files for different languages. ```APIDOC ## Authentication Configuration ### Using Environment Variables with Curl Set your authentication token as an environment variable and use it in curl requests. #### Command ```bash export TTD_AUTH_TOKEN="your_security_token_here" curl -X GET https://ext-api.sb.thetradedesk.com/workflows/campaign/camp-78901/version \ -H "TTD-Auth: $TTD_AUTH_TOKEN" ``` ### Configuration File (config.json) Create a JSON configuration file to specify authentication and other settings. #### File Content ```json { "authToken": "your_security_token_here", "baseUrl": "https://ext-api.sb.thetradedesk.com/workflows", "timeout": 30000, "retryAttempts": 3 } ``` ### Python Configuration (~/.ttd_workflows/config.yaml) Configure Python SDK settings using a YAML file in the user's home directory. #### File Content ```yaml auth_token: your_security_token_here base_url: https://ext-api.sb.thetradedesk.com/workflows timeout: 30 retry_attempts: 3 log_level: INFO ``` ``` -------------------------------- ### POST /workflows/standardjob/campaign/bulk Source: https://context7.com/context7/ttd-workflows_apidocumentation/llms.txt Submit a job to create multiple campaigns in batch. ```APIDOC ## POST /workflows/standardjob/campaign/bulk ### Description Submit a job to create multiple campaigns in batch. ### Method POST ### Endpoint https://ext-api.sb.thetradedesk.com/workflows/standardjob/campaign/bulk ### Parameters #### Headers - **Content-Type** (string) - Required - application/json - **TTD-Auth** (string) - Required - your_security_token_here #### Request Body - **jobName** (string) - Required - The name of the job. - **campaigns** (array) - Required - A list of campaign objects to create. - **name** (string) - Required - The name of the campaign. - **advertiserId** (string) - Required - The ID of the advertiser. - **budget** (object) - Required - The budget for the campaign. - **budgetInAdvertiserCurrency** (number) - Required - The budget amount in the advertiser's currency. - **startDate** (string) - Required - The start date and time of the campaign (ISO 8601 format). - **endDate** (string) - Required - The end date and time of the campaign (ISO 8601 format). ### Request Example ```json { "jobName": "Regional_Campaigns_Launch", "campaigns": [ { "name": "East_Coast_Campaign", "advertiserId": "adv-54321", "budget": { "budgetInAdvertiserCurrency": 200000.00 }, "startDate": "2025-11-01T00:00:00Z", "endDate": "2025-12-31T23:59:59Z" }, { "name": "West_Coast_Campaign", "advertiserId": "adv-54321", "budget": { "budgetInAdvertiserCurrency": 250000.00 }, "startDate": "2025-11-01T00:00:00Z", "endDate": "2025-12-31T23:59:59Z" } ] } ``` ### Response #### Success Response (200) - **jobId** (string) - The ID of the job created. - **status** (string) - The status of the job (e.g., "Queued"). - **totalItems** (integer) - The total number of items in the job. - **statusUrl** (string) - A URL to check the status of the job. #### Response Example ```json { "jobId": "job-bulk-12347", "status": "Queued", "totalItems": 2, "statusUrl": "/standardjob/job-bulk-12347/status" } ``` ``` -------------------------------- ### GET /workflows/campaign/{campaignId}/version Source: https://context7.com/context7/ttd-workflows_apidocumentation/llms.txt Retrieves detailed version information for a specific campaign, including its last modification date and the user who made the changes. ```APIDOC ## Get Campaign Version Retrieve version information for a specific campaign. ### Method GET ### Endpoint `/workflows/campaign/{campaignId}/version` ### Parameters #### Path Parameters - **campaignId** (string) - Required - The ID of the campaign to retrieve version information for. ### Response #### Success Response (200) - **campaignId** (string) - The ID of the campaign. - **version** (integer) - The current version number of the campaign. - **lastModified** (string) - The timestamp of the last modification (ISO 8601 format). - **modifiedBy** (string) - The email address of the user who last modified the campaign. #### Response Example ```json { "campaignId": "camp-78901", "version": 5, "lastModified": "2025-10-11T14:30:00Z", "modifiedBy": "user@example.com" } ``` ``` -------------------------------- ### Authentication Configuration for TTD Workflows API Source: https://context7.com/context7/ttd-workflows_apidocumentation/llms.txt Provides methods to configure authentication for the TTD Workflows API. Includes setting the auth token via environment variables for curl requests and creating configuration files for Python. ```bash # Set authentication token as environment variable export TTD_AUTH_TOKEN="your_security_token_here" # Use in curl with environment variable curl -X GET https://ext-api.sb.thetradedesk.com/workflows/campaign/camp-78901/version \ -H "TTD-Auth: $TTD_AUTH_TOKEN" # Configuration file example (config.json) cat > config.json << EOF { "authToken": "your_security_token_here", "baseUrl": "https://ext-api.sb.thetradedesk.com/workflows", "timeout": 30000, "retryAttempts": 3 } EOF # Python configuration # ~/.ttd_workflows/config.yaml cat > ~/.ttd_workflows/config.yaml << EOF auth_token: your_security_token_here base_url: https://ext-api.sb.thetradedesk.com/workflows timeout: 30 retry_attempts: 3 log_level: INFO EOF ``` -------------------------------- ### GET /workflows/standardjob/{jobId}/status Source: https://context7.com/context7/ttd-workflows_apidocumentation/llms.txt Checks the status of standard jobs, such as campaign bulk, ad group bulk, or data jobs. This endpoint is useful for monitoring the progress of these operations. ```APIDOC ## GET /workflows/standardjob/{jobId}/status ### Description Check the status of any standard job (campaign bulk, ad group bulk, data jobs). ### Method GET ### Endpoint https://ext-api.sb.thetradedesk.com/workflows/standardjob/{jobId}/status ### Parameters #### Path Parameters - **jobId** (string) - Required - The ID of the standard job. #### Headers - **TTD-Auth** (string) - Required - Your security token ### Response #### Success Response (200) - **jobId** (string) - The unique identifier for the job. - **jobName** (string) - The name of the job. - **status** (string) - The current status of the job (e.g., "Completed", "Processing", "Failed"). - **totalItems** (integer) - The total number of items processed by the job. - **processedItems** (integer) - The number of items that have been processed. - **successfulItems** (integer) - The number of items that were processed successfully. - **failedItems** (integer) - The number of items that failed during processing. - **results** (array) - Details about the processing of each item. - **itemIndex** (integer) - The index of the item. - **status** (string) - The processing status for the item ("Success", "Failed"). - **adGroupId** (string) - The ID of the ad group if applicable. - **message** (string) - A message describing the outcome for the item. - **startedAt** (string) - The timestamp when the job started. - **completedAt** (string) - The timestamp when the job completed. #### Response Example ```json { "jobId": "job-bulk-12345", "jobName": "Q4_AdGroup_Bulk_Creation", "status": "Completed", "totalItems": 2, "processedItems": 2, "successfulItems": 2, "failedItems": 0, "results": [ { "itemIndex": 0, "status": "Success", "adGroupId": "ag-20001", "message": "Ad group created successfully" }, { "itemIndex": 1, "status": "Success", "adGroupId": "ag-20002", "message": "Ad group created successfully" } ], "startedAt": "2025-10-11T14:30:00Z", "completedAt": "2025-10-11T14:32:30Z" } ``` ``` -------------------------------- ### Get GraphQL Bulk Job Status via API Source: https://context7.com/context7/ttd-workflows_apidocumentation/llms.txt Retrieve the status and results of a previously submitted GraphQL bulk query job. This endpoint is used to poll for job completion and fetch the processed data. Requires the job ID and authentication. ```bash curl -X GET https://ext-api.sb.thetradedesk.com/workflows/graphqlbulkjob/job-graphql-12351 \ -H "TTD-Auth: your_security_token_here" ``` -------------------------------- ### POST /workflows/standardjob/adgroup/bulk Source: https://context7.com/context7/ttd-workflows_apidocumentation/llms.txt Submit a job to create multiple ad groups simultaneously. ```APIDOC ## POST /workflows/standardjob/adgroup/bulk ### Description Submit a job to create multiple ad groups simultaneously. ### Method POST ### Endpoint https://ext-api.sb.thetradedesk.com/workflows/standardjob/adgroup/bulk ### Parameters #### Headers - **Content-Type** (string) - Required - application/json - **TTD-Auth** (string) - Required - your_security_token_here #### Request Body - **jobName** (string) - Required - The name of the job. - **adGroups** (array) - Required - A list of ad group objects to create. - **primaryInput** (object) - Required - Primary input for the ad group. - **name** (string) - Required - The name of the ad group. - **channel** (string) - Required - The channel for the ad group (e.g., "Display"). - **budget** (object) - Required - The budget for the ad group. - **allocationType** (string) - Required - The budget allocation type (e.g., "Minimum"). - **budgetInAdvertiserCurrency** (number) - Required - The budget amount in the advertiser's currency. - **baseBidCPMInAdvertiserCurrency** (number) - Required - The base bid CPM in the advertiser's currency. - **creativeIds** (array) - Required - A list of creative IDs to associate with the ad group. - **creativeId** (string) - Required - The ID of a creative. - **campaignId** (string) - Required - The ID of the campaign to which the ad group belongs. ### Request Example ```json { "jobName": "Q4_AdGroup_Bulk_Creation", "adGroups": [ { "primaryInput": { "name": "Display_Premium_Desktop", "channel": "Display", "budget": { "allocationType": "Minimum", "budgetInAdvertiserCurrency": 30000.00 }, "baseBidCPMInAdvertiserCurrency": 3.00, "creativeIds": ["cr-10001"] }, "campaignId": "camp-54321" }, { "primaryInput": { "name": "Display_Premium_Mobile", "channel": "Display", "budget": { "allocationType": "Minimum", "budgetInAdvertiserCurrency": 20000.00 }, "baseBidCPMInAdvertiserCurrency": 2.50, "creativeIds": ["cr-10002"] }, "campaignId": "camp-54321" } ] } ``` ### Response #### Success Response (200) - **jobId** (string) - The ID of the job created. - **status** (string) - The status of the job (e.g., "Queued"). - **totalItems** (integer) - The total number of items in the job. - **statusUrl** (string) - A URL to check the status of the job. #### Response Example ```json { "jobId": "job-bulk-12345", "status": "Queued", "totalItems": 2, "statusUrl": "/standardjob/job-bulk-12345/status" } ``` ``` -------------------------------- ### Get Standard Job Status via API Source: https://context7.com/context7/ttd-workflows_apidocumentation/llms.txt Check the status of standard jobs, such as campaign bulk or ad group bulk operations. This endpoint provides details on job progress, item counts, and specific results for each processed item. Requires the job ID and authentication. ```bash curl -X GET https://ext-api.sb.thetradedesk.com/workflows/standardjob/job-bulk-12345/status \ -H "TTD-Auth: your_security_token_here" ``` -------------------------------- ### POST /standardjob/campaign/bulk Source: https://ttd-workflows.apidocumentation.com/reference Performs bulk operations on campaigns. ```APIDOC ## POST /standardjob/campaign/bulk ### Description Performs bulk operations on campaigns. ### Method POST ### Endpoint /standardjob/campaign/bulk ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body (Type: object) - Required - CampaignBulkCreateWorkflowInputWithValidation: Object containing details for bulk campaign operations. ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) (Type: object) - Details of the bulk job. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### POST /standardjob/firstpartydata Source: https://ttd-workflows.apidocumentation.com/reference Submits a job for first-party data processing. ```APIDOC ## POST /standardjob/firstpartydata ### Description Submits a job for first-party data processing. ### Method POST ### Endpoint /standardjob/firstpartydata ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body (Type: object) - Required - Object containing details for first-party data processing. ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) (Type: object) - Details of the submitted job. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Submit Third-Party Data Job via API Source: https://context7.com/context7/ttd-workflows_apidocumentation/llms.txt Configure third-party data segment targeting by submitting a job that includes advertiser and data provider IDs, along with a list of segments to add, including their external IDs and CPM pricing. ```bash curl -X POST https://ext-api.sb.thetradedesk.com/workflows/standardjob/thirdpartydata \ -H "Content-Type: application/json" \ -H "TTD-Auth: your_security_token_here" \ -d '{ \ "jobName": "Third_Party_Audience_Sync", \ "advertiserId": "adv-54321", \ "dataProviderId": "dp-67890", \ "segments": [ \ { \ "segmentId": "seg-external-111", \ "action": "Add", \ "cpmPriceInAdvertiserCurrency": 0.50 \ }, \ { \ "segmentId": "seg-external-222", \ "action": "Add", \ "cpmPriceInAdvertiserCurrency": 0.75 \ } \ ] \ }' ``` -------------------------------- ### POST /workflows/graphqlbulkqueryjob Source: https://context7.com/context7/ttd-workflows_apidocumentation/llms.txt Submits multiple GraphQL queries as a batch job for execution. This endpoint allows for efficient processing of several queries simultaneously. ```APIDOC ## POST /workflows/graphqlbulkqueryjob ### Description Execute multiple GraphQL queries as a batch job. ### Method POST ### Endpoint https://ext-api.sb.thetradedesk.com/workflows/graphqlbulkqueryjob ### Parameters #### Headers - **Content-Type** (string) - Required - Application JSON - **TTD-Auth** (string) - Required - Your security token #### Request Body - **jobName** (string) - Required - A name for the batch job. - **queries** (array) - Required - An array of query objects. - **query** (string) - Required - The GraphQL query string. - **queryId** (string) - Required - A unique identifier for the query within the batch. - **outputFormat** (string) - Required - The desired format for the output (e.g., JSON). ### Request Example ```json { "jobName": "Daily_Performance_Report", "queries": [ { "query": "query { campaign(id: \"camp-10001\") { id impressions clicks } }", "queryId": "query-1" }, { "query": "query { campaign(id: \"camp-10002\") { id impressions clicks } }", "queryId": "query-2" }, { "query": "query { campaign(id: \"camp-10003\") { id impressions clicks } }", "queryId": "query-3" } ], "outputFormat": "JSON" } ``` ### Response #### Success Response (200) - **jobId** (string) - The unique identifier for the submitted job. - **status** (string) - The initial status of the job (e.g., "Processing"). - **totalQueries** (integer) - The total number of queries submitted in the job. - **statusUrl** (string) - The URL to check the status of the job. #### Response Example ```json { "jobId": "job-graphql-12351", "status": "Processing", "totalQueries": 3, "statusUrl": "/graphqlbulkjob/job-graphql-12351" } ``` ``` -------------------------------- ### Submit First-Party Data Job via API Source: https://context7.com/context7/ttd-workflows_apidocumentation/llms.txt Upload first-party audience data to The Trade Desk platform. This job requires advertiser and data provider IDs, segment details, member data with identifiers and actions, and a time-to-live (TTL) in days. ```bash curl -X POST https://ext-api.sb.thetradedesk.com/workflows/standardjob/firstpartydata \ -H "Content-Type: application/json" \ -H "TTD-Auth: your_security_token_here" \ -d '{ \ "jobName": "Customer_List_Upload_October", \ "advertiserId": "adv-54321", \ "dataProviderId": "dp-12345", \ "segmentName": "High_Value_Customers", \ "memberData": [ \ { \ "identifier": "email@example.com", \ "identifierType": "Email", \ "action": "Add" \ }, \ { \ "identifier": "hashed_email_sha256_here", \ "identifierType": "EmailSHA256", \ "action": "Add" \ }, \ { \ "identifier": "mobile-advertising-id-here", \ "identifierType": "MAID", \ "action": "Add" \ } \ ], \ "ttlInDays": 180 \ }' ``` -------------------------------- ### POST /campaign/archive Source: https://ttd-workflows.apidocumentation.com/reference Archives a campaign. ```APIDOC ## POST /campaign/archive ### Description Archives a campaign. ### Method POST ### Endpoint /campaign/archive ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body (Type: object) - Required - Object containing campaign IDs to archive. ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) (Type: object) - Confirmation of archiving. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Bulk Create Campaigns API Call Source: https://context7.com/context7/ttd-workflows_apidocumentation/llms.txt Submit a job to create multiple campaigns in batch. This POST request requires a TTD-Auth token and a JSON payload containing the job name and a list of campaign objects to be created. It returns a job ID and status URL. ```bash curl -X POST https://ext-api.sb.thetradedesk.com/workflows/standardjob/campaign/bulk \ -H "Content-Type: application/json" \ -H "TTD-Auth: your_security_token_here" \ -d '{ "jobName": "Regional_Campaigns_Launch", "campaigns": [ { "name": "East_Coast_Campaign", "advertiserId": "adv-54321", "budget": { "budgetInAdvertiserCurrency": 200000.00 }, "startDate": "2025-11-01T00:00:00Z", "endDate": "2025-12-31T23:59:59Z" }, { "name": "West_Coast_Campaign", "advertiserId": "adv-54321", "budget": { "budgetInAdvertiserCurrency": 250000.00 }, "startDate": "2025-11-01T00:00:00Z", "endDate": "2025-12-31T23:59:59Z" } ] }' ```