POST /data/advertiser (External Provider)
The POST /data/advertiser endpoint enables you, as an external provider, to upload first-party data on behalf of the specified advertiser ID for use in audience targeting.
Setup
Here's what you need to know to use this endpoint:
- This endpoint uses the data integration environment.
- Some IDs, such as raw UID2s, raw EUIDs, and their respective tokens, are case sensitive. Pass all IDs and tokens without changing the case. Mismatched IDs can cause ID parsing or token decryption errors.
NOTE: If you are using signature header authentication instead of token authentication, encode the body of your request with your secret key using the
TtdSignatureandTtdSignature-dpheader.
Request preparation guidelines
Here are some recommendations for preparing requests:
- The total request size may not exceed 2.5 MB, which is approximately 10,000 IDs. If needed, split large requests into several smaller requests that meet the size requirements.
- The
BaseBidCPMandTTLInMinutes(time-to-live in minutes) values must be non-negative. - You can upload multiple IDs in the same request by listing them as separate objects in the
Itemsarray. - Only one of the supported ID types is allowed per object in the
Itemsarray, but the array may contain objects with different ID types. - If your data comes from the European Economic Area, the United Kingdom (under the UK GDPR), or Switzerland, collectively GDPR Regions, it might be subject to policy restrictions.
Special requirements
If you are an advertiser in the Medical Health industry category, make sure the audience data you upload complies with the following requirements:
- It must not contain data about individuals in Washington or Nevada.
- It must include only the following data:
- Consented data: You have affirmative consent from the individual to use and disclose data about their health for advertising purposes.
- Modeled data: Identifiers are associated with individuals for whom you have no knowledge or evidence suggesting specific health conditions.
Request example
The following is a POST/data/advertiser example with an external provider and different types of IDs in the Items array used for demonstration purposes.
{
"DataProviderId": "PROVIDER_ID_PLACEHOLDER",
"AdvertiserId": "ADVERTISER_ID_PLACEHOLDER",
"Items": [
{
"TDID": "123e4567-e89b-12d3-a456-426652340000",
"Data": [
{
"Name": "1210",
"TimestampUtc": "2023-11-11T10:11:30+5000",
"TTLInMinutes": 43200,
"BaseBidCPM": 5,
"BidFactor": 1.5
},
{
"Name": "1160",
"TimestampUtc": "2023-11-13T09:35:30+5000",
"TTLInMinutes": 43200
}
]
},
{
"DAID": "a9342d1f-69f1-4bf8-bc2b-1f20eb451f21",
"Data": [
{
"Name": "1150",
"TimestampUtc": "2023-08-01T12:10:35+5000",
"TTLInMinutes": 43200
}
]
},
{
"UID2": "48MjlfIUZpOKNAm9nod7/jCLAXUYsnE1tpVHQSDS0uo=",
"Data": [
{
"Name": "1630",
"TimestampUtc": "2023-02-01T15:21:45+5000",
"TTLInMinutes": 43200
}
]
},
{
"UID2Token": "AdvertisingTokenmZ4dZgeuXXl6DhoXqbRXQbHlHhA96leN94U1uavZVspwKXlfWETZ3b/besPFFvJxNLLySg4QEYHUAiyUrNncgnm7ppu0mi6wU2CW6hssiuEkKfstbo9XWgRUbWNTM+ewMzXXM8G9j8Q=",
"Data": [
{
"Name": "1845",
"TimestampUtc": "2023-01-04T11:27:22+5000",
"TTLInMinutes": 43200
}
]
},
{
"RampID": "XY1005wXyWPB1SgpMUKIpzA0I3UaLEz-2lg0wFAr1PWK7FMhs", //This is a 49-character RampID example.
"Data": [
{
"Name": "1130",
"TimestampUtc": "2023-07-01T01:15:15+5000",
"TTLInMinutes": 43200
}
]
},
{
"RampID": "Xi1005p_iYcKP7ZlvFwwK9EwR8GKl_VJqIWUhEaAFmHLAjNOQ9b6OQzSkA43XiVFcTYQ9X", // This is a 70-character RampID example.
"Data": [
{
"Name": "1170",
"TimestampUtc": "2023-08-01T13:01:35+5000",
"TTLInMinutes": 43200
},
{
"Name": "1140",
"TimestampUtc": "2023-08-01T13:02:55+5000",
"TTLInMinutes": 43200
}
]
},
{
"ID5": "ID5-c62drGF0EC6wsCZVFDbTbZwi33eB0uZTIC8FxJpzsQ", //This must be a decrypted ID5 ID
"Data": [
{
"Name": "1800",
"TimestampUtc": "2023-10-01T12:49:13+5000",
"TTLInMinutes": 43200
}
]
},
{
"netID": "vp3hsuQk0I8gUEh-Y4gm3R6e8Wm7z8vkWrp_kjlXtKgbIYraTgAmKfm5kbo660gMo2lR4w",
"Data": [
{
"Name": "1345",
"TimestampUtc": "2023-10-01T12:49:13+5000",
"TTLInMinutes": 43200
}
]
},
{
"FirstId": "8934d279bba4c7d652a02f624dc334e3",
"Data": [
{
"Name": "1810",
"TimestampUtc": "2023-10-01T12:49:13+5000",
"TTLInMinutes": 43200
}
]
},
{
"UtiqId": "7f3ac21e-0d94-4b8a-9c17-6ee2f0a5d3b1",
"Data": [
{
"Name": "1850",
"TimestampUtc": "2023-10-01T12:49:13+5000",
"TTLInMinutes": 43200
}
]
}
]
}
Request object properties
The following table lists the POST /data/advertiser request object properties.
| Property | Required? | Data Type | Description |
|---|---|---|---|
DataProviderId |
Required | String | The provider ID supplied to you by your Technical Account Manager. |
AdvertiserId |
Required | String | The advertiser ID for the partner on whose behalf you are uploading data. The ID can be looked up on the advertiser preferences page in the platform UI. |
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. Maximum 256 characters. |
TimestampUtc |
Optional | String (date-time) |
Controls the relative ordering of requests for the same user-segment pair and determines the expiration and recency of the pair when evaluating targeting exclusions and bid adjustments. If the TimestampUtc field is omitted (recommended), the request receipt time is used. For details, see TimestampUtc.NOTE: The Trade Desk recommends omitting the TimestampUtc field. Use it only when necessary and after fully understanding its behavior, as incorrect values can produce unintended results. |
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:
43200 minutes). |
BaseBidCPM |
Optional | Decimal | The base bid value to use for auctions in relation to the user segment. For details and FAQs, see Optional optimization properties. NOTE: If not specified, bids default to the BaseBidCPM.amount value specified in the ad group. |
BidFactor |
Optional | Decimal | The multiplier for bid adjustments. Values range from 0.5 to 100. The default value is 1. For details and FAQs, see Optional optimization properties. |
Timestamp in UTC
The TimestampUtc field serves three purposes:
- Relative ordering: It determines whether an incoming operation takes effect relative to what is already stored for that user-segment pair.
- Expiration: It is the reference point from which the
TTLInMinutesvalue is measured to determine when the user-segment pair expires. - Recency: It determines the recency of the user-segment pair for evaluating its targeting exclusion and bid adjustments.
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 timestamp is newer than the stored value.
- The timestamp equals the stored value, but its
TTLInMinutesvalue is higher. - No record of the pair exists.
The following sections describe additional ordering behavior for closely timed requests and for deletions.
- Ordering guarantees
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.
- Ordering with deletions
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:
- A timestamp whose expiration (
TimestampUtc+TTLInMinutes) is more than 1 hour in the past is not supported. - A timestamp more than 1 hour in the future is not supported.
Recency
The TimestampUtc value is the recency date used for resolving the following:
- Whether a targeting exclusion applies to the user-segment pair. For details, see RecencyExclusionWindowInMinutes.
- Which bid adjustment bracket applies to the user-segment pair. For details, see RecencyWindowInMinutes.
Optional optimization properties
You can include bid factors and base bid values in the upload request.
IMPORTANT: Be aware of the following interactions with other properties in the Platform API.
The following table lists the interactions with other optimizations.
| Optimization | Description | Example |
|---|---|---|
| Bid Lists | The bid factor stacks with bid line adjustments. If a user is also present in bid lines, then the bid is multiplied by both factors. NOTE: The resulting bid caps out at the MaxBidCPM defined in the ad group. |
A base bid of $10 with a bid line adjustment of 2 and bid factor of 3, results in a multiplier of 6 and final bid value of $60. |
| Cross-Device Targeting | The base bids and bid factors apply to all associated IDs in Cross-Device graph, so your changes apply to all related identifiers for the data segment on a household or individual level. | When Cross-Device finds a match included in the segment, then all users in the household graph use that new bid factor and base bid. |
| Koa Optimizations | Koa Optimizations bid factors apply to the user bid factors. TIP: If you don't want Koa to apply additional bid factors, turn off Koa Optimizations for the ad group. |
N/A |
For details on Platform API interactions, see FAQs.
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:
|
| 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:
- Header name:
TTD-Version - Value:
2
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
1or2, 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:
- If the entire request fails with no items processed, an error response is returned.
- If the request succeeds, any items that failed appear in the
FailedLinesarray. All other items are processed. - If the
FailedLinesarray is empty, all items succeeded. - Successfully processed data becomes targetable within 15–30 minutes.
IMPORTANT: A
200 OKstatus code does not indicate complete success. Always check theFailedLinesarray for line-level errors.
Response (v2)
To use version 2, you'll need to:
- Use a new custom header. For details, see Using the custom header.
- Update how you parse error responses. The new responses are in JSON format.
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 |
|---|---|
BaseBidCPMMetadataTooLong |
The BaseBidCPMMetadata string on a data element exceeds 36 characters. |
MissingUserId |
No TDID could be resolved from the item's identity fields. |
UserNotMapped |
Provided user id cannot be mapped to a TDID. |
InvalidBidFactor |
Provided BidFactor is invalid. |
DataNameTooLong |
Data Name is too long. |
InvalidTTLInMinutes |
Invalid TTLInMinutes value provided. |
InvalidTimestampUtc |
Invalid TimestampUtc value provided. See TimestampUtc for proper usage details. |
InvalidBaseBidCPM |
Invalid BaseBidCPM value provided. |
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)" |
FAQs
The following is a list of commonly asked questions about segments.
What's the difference between version 1 and version 2?
The difference is that version 2 includes improvements to the response format and error handling. The rest of the API is the same: there are no changes to the request format or payload. The improvements yield better results, and we recommend upgrading as soon as possible. For details, see API versions.
How do I remove a user from a segment?
To remove a user from a segment, set the TTLInMinutes property to 0.
If you are looking to support opt-out or deletion requests and you want to delete the user from your segments, you must use the POST /data/deletion-optout/advertiser (External Provider) ID deletion opt-out endpoint.
What happens if a user is in two segments with different bid factors?
When a user is in segments with different bid factors, the multiplier uses the highest value.
What is the minimum and maximum bid that can be placed for a segment?
At minimum, a bid must be at least half of the BaseBidCPM.amount value set in the ad group, or the BaseBidCPM property for the segment. The maximum bid for a segment is set in the MaxBidCPM property in the ad group.
How do I default a segment back to ad group settings?
To disable bid factor changes, you can upload a new segment with the same identifiers and set the
BidFactorproperty to1.To use the
BaseBidad group settings, you must delete the segment with the POST /data/deletion-optout/advertiser (External Provider) endpoint.