POST /data/thirdparty

The POST /data/thirdparty endpoint enables you to upload third-party data for the specified ID for use in audience targeting.

Setup

Here's what you need to know to use this endpoint:

Request preparation guidelines

Here are some recommendations for preparing requests:

Request example

The following is a POST/data/thirdparty example with different types of IDs in the Items array used for demonstration purposes.

{
   "DataProviderId":"abc1234x",
   "Items":[
      {
         "TDID":"123e4567-e89b-12d3-a456-426652340000",
         "Data":[
            {
               "Name":"ax7m",
               "TimestampUtc": "2023-11-11T10:11:30+5000",
               "TTLInMinutes":43200
            },
            {
               "Name":"bt9q",
               "TimestampUtc": "2023-11-13T09:35:30+5000",
               "TTLInMinutes":43200
            }
         ]
      },
      {
         "DAID":"a9342d1f-69f1-4bf8-bc2b-1f20eb451f21",
         "Data":[
            {
               "Name":"cj3r",
               "TimestampUtc": "2023-08-01T12:10:35+5000",
               "TTLInMinutes":43200
            }
         ]
      },
      {
         "UID2":"48MjlfIUZpOKNAm9nod7/jCLAXUYsnE1tpVHQSDS0uo=",
         "Data":[
            {
               "Name":"dk4s",
               "TimestampUtc": "2023-02-01T15:21:45+5000",
               "TTLInMinutes":43200
            }
         ]
      },
      {
         "UID2Token":"AdvertisingTokenmZ4dZgeuXXl6DhoXqbRXQbHlHhA96leN94U1uavZVspwKXlfWETZ3b/besPFFvJxNLLySg4QEYHUAiyUrNncgnm7ppu0mi6wU2CW6hssiuEkKfstbo9XWgRUbWNTM+ewMzXXM8G9j8Q=",
         "Data":[
            {
               "Name":"el5t",
               "TimestampUtc": "2023-01-04T11:27:22+5000",
               "TTLInMinutes":43200
            }
         ]
      },
      {
         "RampID":"XY1005wXyWPB1SgpMUKIpzA0I3UaLEz-2lg0wFAr1PWK7FMhs", //This is a 49-character RampID example.
         "Data":[
            {
               "Name":"fm6u",
               "TimestampUtc": "2023-07-01T01:15:15+5000",
               "TTLInMinutes":43200
            }
         ]
      },
      {
         "RampID":"Xi1005p_iYcKP7ZlvFwwK9EwR8GKl_VJqIWUhEaAFmHLAjNOQ9b6OQzSkA43XiVFcTYQ9X", // This is a 70-character RampID example.
         "Data":[
            {
               "Name":"gn7v",
               "TimestampUtc": "2023-08-01T13:01:35+5000",
               "TTLInMinutes":43200
            },
            {
               "Name":"am8p",
               "TimestampUtc": "2023-08-01T13:02:55+5000",
               "TTLInMinutes":43200
            }
         ]
      },
      {
         "ID5":"ID5-c62drGF0EC6wsCZVFDbTbZwi33eB0uZTIC8FxJpzsQ", //This must be a decrypted ID5 ID
         "Data":[
            {
               "Name":"hp8w",
               "TimestampUtc": "2023-10-01T12:49:13+5000",
               "TTLInMinutes":43200
            }
         ]
      },
      {
         "netID":"vp3hsuQk0I8gUEh-Y4gm3R6e8Wm7z8vkWrp_kjlXtKgbIYraTgAmKfm5kbo660gMo2lR4w",
         "Data":[
            {
               "Name":"iq9x",
               "TimestampUtc": "2023-10-01T12:49:13+5000",
               "TTLInMinutes":43200
            }
         ]
      },
      {
         "FirstId":"8934d279bba4c7d652a02f624dc334e3",
         "Data":[
            {
               "Name":"jr0y",
               "TimestampUtc":"2023-10-01T12:49:13+5000",
               "TTLInMinutes":43200
            }
         ]
      },
      {
         "UtiqId":"7f3ac21e-0d94-4b8a-9c17-6ee2f0a5d3b1",
         "Data":[
            {
               "Name":"kr1z",
               "TimestampUtc":"2023-10-01T12:49:13+5000",
               "TTLInMinutes":43200
            }
         ]
      }
   ]
}

Request object properties

The following table lists the POST /data/thirdparty request object properties.

Property Required? Data Type Description
DataProviderId Required String The provider ID supplied to you by your Technical Account Manager.
Items Required Object Array You can upload multiple IDs in the same request by listing them as separate items.
IMPORTANT: Only one of the supported IDs is allowed per object in the array.
For object properties, see Item object.

Items object array

The following table lists the properties required for each array object in the Items object array.

Property Required? Data Type Description
ID_TYPE_PLACEHOLDER Required String A supported ID type. Only one ID is allowed per object in the Items array, but the array may contain objects with different ID types.
Data Required Object Array The segments to which to add the specified ID and the amount of time during which the data is to remain active.
For object properties, see Data object.

Supported ID types

The following table lists the ID types currently supported in Items object arrays. Each array object must contain one ID.

Property Data Type Description
TDID GUID The Trade Desk 36-character GUID (including dashes) for this user.
DAID GUID The raw device ID for this user, sent in 36-character GUID format (including dashes). Use the iOS ID for advertisers (IDFA) or Android advertising ID (AAID).
UID2 String The raw UID2 value, also known as UID2. This value is case-sensitive. Raw UID2s are generated and managed using UID2 APIs. See also Unified IDs.
UID2Token String The encrypted UID2 token, also known as an advertising token. This token is case-sensitive. Tokens are generated and managed using UID2 APIs. For details about UID2 APIs, see UID2 Endpoints. For details about UID2 tokens, see Raw IDs vs. tokens.
EUID String The raw European Unified ID value, also known as EUID. This value is case-sensitive. EUID offers user transparency and privacy controls designed to meet market requirements in European regions with the same normalization and encoding of PII as UID2. See also European Unified ID Overview.
EUIDToken String The encrypted EUID token, also known as an advertising token. This token is case-sensitive. For details, see Unified IDs.
RampID String The 49-character or 70-character RampID (previously known as IdentityLink or IDL).
IMPORTANT: This must be a RampID from LiveRamp that is mapped specifically for The Trade Desk. For details about mapping a RampID, see LiveRamp documentation.
ID5 String The ID5 for the user. Data providers holding these IDs should engage with ID5 directly to obtain the necessary decryption keys. For details about ID5, see the ID5 site.
IMPORTANT: The ID5 ID is supported only in Europe and must be in decrypted form.
netID String The user's netID as a 70-character Base64-encoded string. For details about netID, see the netID Developer Zone.
IMPORTANT: This ID is supported only in Europe.
FirstId String The user's First-id, a first-party cookie typically set by publishers in France. For details about First-id, see the First-id site.
IMPORTANT: This ID is supported only in Europe.
UtiqId String The Utiq ID for the user. Data providers holding these IDs should engage with Utiq directly to obtain the necessary decryption keys. For details on Utiq, see the Utiq site.
IMPORTANT: This ID is supported only in Europe and may be uploaded in encrypted or decrypted form.

Data object

The following table lists the Data object properties. The Data object specifies the segments to which to add the specified ID and the amount of time during which the data is to remain active.

Property Required? Data Type Description
Name Required String The name of the segment to which to add this ID. Here's what you need to know:
  • You cannot change the name after you've created the segment.
  • The name must be a unique alphanumeric value, maximum 256 characters.
  • Do not include descriptive words or phrases, such as a specific brand, product name, or audience group. For these values, you can use the DisplayName and Description fields in the Third-Party Data Taxonomy Platform APIs, which are editable. The Name field is your own internal identifier for a segment. We recommend using a sequencing numerical value or alphanumeric identifier.
  • This field maps to the ProviderElementId in the Third-Party Data Taxonomy Platform APIs, thus linking the segment between the two API suites.
TimestampUtc Optional String
(date-time)
The timestamp of when a user is eligible for a segment. If not specified, the timestamp will be assigned based on the time when the data is processed. This timestamp is used to determine a user's recency for targeting and bid adjustments.
TTLInMinutes Optional Integer Time To Live, or the amount of time (in minutes) during which this user is to remain active relative to the TimeStampUtc value. Here's what you need to know about this property:
  • When the TTL has expired, the user will no longer be used for targeting.
  • The maximum TTL is 180 days (259200 minutes), even though a 30-day TTL (43200 minutes) is most commonly used.
  • The default TTL is 90 days (129600 minutes).
  • To remove an inactive user, set this property to 0 for that user.
  • To delete the whole segment, set this property to 0 for all IDs in the segment.
NOTE: To ensure that your data segments get refreshed with the most up-to-date data, The Trade Desk recommends setting a TTL of at least 30 days (43200 minutes).

Timestamp in UTC

The TimestampUtc field serves three purposes:

Relative ordering

When a request is received for an existing user-segment pair, its TimestampUtc value is compared against the value already stored for that pair. The request takes effect if:

The following sections describe additional ordering behavior for closely timed requests and for deletions.

To guarantee ordering for closely spaced requests on the same pair, set their TimestampUtc values at least 2 minutes apart. Requests on the same user-segment pair that are sent within seconds of each other can be applied out of order, regardless of the order in which they are sent.

When two requests on the same pair share the same timestamp, the one with the higher TTLInMinutes value wins.

To preserve request ordering, when a user-segment pair is deleted (TTLInMinutes = 0), its TimestampUtc value is retained for at least 6 hours from the timestamp of the deletion. To re-insert the pair after deletion, set a timestamp newer than the one sent with the deletion, or omit the field.

Expiration

The user-segment pair expires at TimestampUtc + TTLInMinutes with the following limits:

Recency

The TimestampUtc value is the recency date used for resolving the following:

Versioning

Two versions of the Data API are available. The difference is the response format. For details, see API versions. This documentation includes both versions of the response error information.

API versions

Version 2 of the Data API is available, and includes improvements to the API response. Version 1 is fully supported, but is being deprecated. We recommend upgrading as soon as possible.

To use version 2, see Response (v2).

For details on the version timeline, see Data API version 2 with improved error handling and response format.

The following table compares the two versions.

Comparison aspect Version 1 (default) Version 2 (recommended)
HTTP status codes Inconsistent and sometimes not general (for example, 400 BadRequest instead of 401 Unauthorized for an authentication issue) Two types of improvement:
  • Codes are more specific: For example, 401 Unauthorized for an authentication issue.
  • Improved consistency: Failed lines only appear in 200 OK responses.
Deserialization errors Entire request fails Per-item errors surfaced in FailedLines
FailedLines error codes Compact, undocumented Named codes with full reference
FailedLine properties TDID, DataName, ErrorCode, Message Adds ItemNumber
Response message format for failed requests Plain string JSON with ErrorCode and Message fields
Consistency of error responses for failed requests Varies by endpoint Consistent across endpoints
Requires custom header No Yes: see Using the custom header

Using the custom header

To use version 2, add the following custom header:

For example: TTD-Version: 2

NOTE: The custom header is required only if you want to use a version that is not the default. Valid values for this header are 1 or 2, and if you're using the default version, currently version 1, there is no need to include the extra header.

What you need to know

Here's what you need to know about returned responses for both versions:

IMPORTANT: A 200 OK status code does not indicate complete success. Always check the FailedLines array for line-level errors.

Response (v2)

To use version 2, you'll need to:

The following sections provide details about success and failed responses for version 2, including response format, response examples, and error messaging.

Success response (v2)

If the request is successful, the response has an HTTP status code of 200 OK and includes a FailedLines array with details of any items that were not processed.

Success response example (v2)

The following is an example of a success response with one FailedLines entry:

{
  "FailedLines": [
    {
      "ErrorCode": "ItemDeserializationError",
      "Message": "Item number 2: A deserialization error occurred. Could not find member 'xTDID' on object of type 'AdvertiserDataItem'. Path 'Items[1].xTDID', line 14, position 16.",
      "ItemNumber": "2"
    }
  ]
}

Success response object properties

The following table lists the object properties for a successful response.

Property Data type Description
FailedLines Object Array If all lines are successful, this array is returned empty. Otherwise, it lists any lines that failed, which you can use to troubleshoot errors that occurred in your request. For object properties, see Failed Line object properties (v2).

FailedLine object properties (v2)

The following table lists the FailedLine object properties for version 2 of the Data APIs.

Property Data type Description
TDID GUID The Trade Desk 36-character GUID (including dashes) for this user. Included in the response only if applicable.
DataName String The segment name specified for the ID in the request. Included in the response only if applicable.
ItemNumber String The index of the failed item in the request.
ErrorCode String For details, see FailedLine error codes and messages (v2).
Message String For details, see FailedLine error codes and messages (v2).

FailedLine error codes and messages (v2)

The following table lists the error codes that might be returned from this endpoint in a FailedLine entry in the FailedLines object, with the reason for each error. This information is for version 2 of the Data API.

Error code Reason
MissingUserId No TDID could be resolved from the item's identity fields.
UserNotMapped Provided user id cannot be mapped to a TDID.
DataNameTooLong Data Name is too long.
UnauthorisedThirdPartyDataWithBaseBidCPM The provider is not allowed to submit BaseBidCPM.
InvalidTtlInMinutes Invalid TtlInMinutes value provided.
InvalidTimestampUtc Invalid TimestampUtc value provided. See TimestampUtc for proper usage details.
InvalidDataOwnerId Invalid DataOwnerId value provided.
InvalidParameterFormat A parameter on the item is not of expected format.
TargetingDataCreationLimitExceeded The partner has reached the cap on new targeting data segment creation.
TargetingDataCountLimitExceeded The partner has reached the total targeting data element count cap.
TenantRestrictionsExternalData The partner's tenant policy prohibits pushing data to the current cloud provider.
TargetingDataDisabled Targeting data ingestion has been disabled.
ItemDeserializationError A deserialization error occurred while processing the item.
Unknown Empty data name, ReplaceExistingData requests, or any unidentifiable reason for failure.

Failed response (v2)

If the request fails with no lines processed, a failed response is returned.

Failed response example (v2)

The error response is JSON and includes ErrorCode and Message properties. For example, the following response would return a 403 Forbidden HTTP status code:

{
  "ErrorCode": "TargetingDataLimitReached",
  "Message": "The maximum allowed targeting data elements limit for the specified advertiser/data provider has been reached."
}

Failed response object properties (v2)

The following table lists the object properties for a failed response.

Property Data type Description
ErrorCode String For details, see FailedLine error codes and messages (v2).
Message String For details, see FailedLine error codes and messages (v2).

Failed response error codes and messages (v2)

The following table provides a list of common failed response errors and their respective HTTP status codes.

HTTP status code Error code Reason
400 (Bad Request) UnknownRequest The requested resource could not be recognized.
400 (Bad Request) IncorrectContent A field in the request body contains an invalid value.
400 (Bad Request) MissingData A required field in the request body was absent or empty.
400 (Bad Request) SerializationFailed Request body could not be deserialized - verify the JSON is valid and matches the expected schema.
401 (Unauthorized) AuthenticationFailed The provided credentials could not be authenticated - verify credentials.
401 (Unauthorized) InvalidToken The provided token is invalid - verify token.
403 (Forbidden) IncorrectPermissions The provided credentials lack the required permissions for the specified ID.
403 (Forbidden) AdvertiserMisconfigured The provided AdvertiserId is not configured to send data on the requested resource.
403 (Forbidden) DataProviderMisconfigured The provided DataProviderId is not configured to send data on the requested resource.
403 (Forbidden) MerchantMisconfigured The provided MerchantId is not configured to send data on the requested resource.
403 (Forbidden) TargetingDataLimitReached The maximum allowed targeting data elements limit for the specified advertiser/data provider has been reached.
404 (Not Found) EndpointNotConfigured The requested endpoint is not configured to accept this type of request.
413 (Content Too Large) MaxRequestSizeExceeded Request payload exceeds the maximum allowed size.
429 (Too Many Requests) N/A Rate limit for an API endpoint was exceeded.

IMPORTANT: When the rate limit for an API endpoint is exceeded, the server returns a 429 status code and prevents execution. Your code must be able to handle this type of error. For example, upon receiving a 429 error, wait up to one hour before retrying or reduce request volume to remain within rate limits. See also Rate limits.

Response (v1, legacy)

Version 1 is the default. The following sections provide details about error responses for version 1, including response format and error messaging.

Success response object properties

The following table lists the object properties for a successful response.

Property Data Type Description
FailedLines Object Array If all lines are successful, this array is returned empty. Otherwise, it lists any lines that failed, which you can use to troubleshoot errors that occurred in your request. For object properties, see Failed Line object properties (v1).

FailedLine object properties (v1)

The following table lists the FailedLine object properties for version 1 of the Data APIs.

Property Data type Description
TDID GUID The Trade Desk 36-character GUID (including dashes) for this user.
DataName String The segment name specified for the ID in the request.
ErrorCode String A compact code indicating the nature of the error.
Message String A message providing details of the error.

Failed response error codes and messages (v1)

If the request fails with no lines processed, a failed response is returned. In version 1, the error response is a string. The following table provides a list of common errors and their respective HTTP status codes.

ID Error HTTP status code Error message
1 Request sent without any body (empty) 400 Bad Request "Missing request data."
2 Request sent without TTD signature HEADER attribute 400 Bad Request "Requests must have a TtdSignature header value."
3 Request sent with incorrect TTD signature in HEADER 400 Bad Request "The signature does not match the request body for advertiser: 'abcdefgh'. NOTE: [provider for 3rd party endpoint]."
4 Requested advertiser does not have a secret key 400 Bad Request "This advertiser has not been configured to accept data: ‘abcdefgh'. NOTE: [provider for 3rd party endpoint]."
5 Request sent with an empty 'Items attribute' array 400 Bad Request "Items attribute must be a non-empty list."
6 General processing error (possible invalid values in Items) 400 Bad Request "A deserialization error occurred."
7 Failed to parse TDID, DAID, UID2, RampID, EUID, or failed to decrypt UID2Token or EUIDToken 200 OK "Invalid (ID type)" or "Failed to decrypt (token type)"
8 Request rate limited 429 Too Many Requests N/A

IMPORTANT: When the rate limit for an API endpoint is exceeded, the server returns a 429 status code and prevents execution. Your code must be able to handle this type of error. For example, upon receiving a 429 error, wait up to one hour before retrying or reduce request volume to remain within rate limits. See also Rate limits.