Sync segments and profiles (API v2)

Overview  

With the API described in this article, audience data providers can synch segments and profiles with Equativ.

About the audience data batch file integration

As an alternative to the API integration described in this article, data providers can also use Equativ's batch file integration method to sync audience data. For more information, see Sync segments and profiles (batch file).

Integration process

Here are the integration steps:

  1. Sign contract: Sign contractual agreements with Equativ, if applicable.
  2. Fill in form: Fill in Equativ’s onboarding form for audience data providers.
  3. Consult documentation: this article, Sync users, API documentation (Swagger).
  4. Set up user synchronization: Synchronize user identifiers of data providers with Equativ and host a matching table. For more information, see Sync user.
  5. Get sandbox account: your account manager at Equativ will ask you for account parameters and provide you with credentials for developing and testing your implementation of this API on Equativ’s sandbox environment
  6. Test on sandbox:
    1. Test the API and construct your data synchronization application using your sandbox credentials.
    2. Perform unit testing and low-volume streaming tests only. the sandbox environment is not provisioned for high, production-level volumes.
    3. Test token management, pushing and pulling low volumes of segments and profiles to confirm success.
    4. Perform short runs to test uploading long-running updates.
    5. Don't push more than 1 million unique profiles or exceed profile operation rate limits.
  7. Validate sandbox: Sync with your account manager and technical contacts at Equativ to get support and validate your sandbox testing.
  8. Obtain production account: Once validated, request your production credentials from your account manager.
  9. Test in production: Notify your Equativ contacts about your testing strategy and volumes. When authorized by Equativ's infrastructure team, proceed with pushing samples of your production data to production endpoints and check with your Equativ contacts on volumes and results.
  10. Activate the integration: Notify your Equativ contacts about your sync strategy and volumes. When authorized by Equativ's infrastructure team, proceed with moving to full production mode and pushing/activating the segments you plan to use.

User synchronization

Audience data providers must synchronize their user identifiers with Equativ and host a matching table which contains the data provider's user Ids and the matching Equativ user Ids. For more information, see Sync users.

Endpoints

Equativ provides dedicated endpoints by region (to enable data synchronization) and by environment (production/sandbox).

Region API Environment Endpoint
All Audience data Sandbox* https://datasync.eqtv.st/v2
All OAuth Production https://login.eqtv.io
All OAuth Sandbox* https://login.eqtv.io (sandbox authentication endpoint identical to production; only credentials (client_id, client_secret) and requested API target (target-entity) are different)
Americas Audience data Production https://datasync-us.eqtv.io/v2
APAC Audience data Production https://datasync-apac.eqtv.io/v2
EU Audience data Production https://datasync-eu.eqtv.io/v2

* The sandbox runs on a development database. Equativ may erase sandbox data once integration tests are completed.

The most recent API version is also available at the root path of any endpoint; for instance, at this time, https://datasync.eqtv.st/ and https://datasync.eqtv.st/v2 are synonymous.

 

Profiles are only identified and targetable if the region from which the ad call originates matches with the production regional endpoint on which the profile was created. Segments are available in all regions, no matter on which production regional endpoint they were created.

 

Authorization

The audience data integration uses the Client Credential Grant flow with the authorization provider FusionAuth (see documentation).

Equativ will provide you with the client_id and client_secret once you are declared as a new data provider in Equativ’s system.

Parameters

Parameter Description
client_id The authorization ID you receive from Equativ. It is the equivalent of a user name. Its value differs depending on the environment (sandbox vs. production)
client_secret The client secret you receive from Equativ. It is the equivalent of a password. Its value differs depending on the environment (sandbox vs. production).
grant_type Needs to be provided as is: client_credentials. It tells Equativ’s authentication provider (FusionAuth) which method of authentication to use

POST parameters have to be in the body (using --data-raw).

 

Scope

You need to explicitly state the scope you require for your requests. The scope consists of the target-entity and the permissions.

Target-entity UUIDs:

  • For test/sandbox: 232d959c-7786-4d47-8418-48a847c52cfa
  • For production: 99d73062-ff3e-4b23-a283-ab98cdd57c22

Permissions (provided as a comma separated string with the following possible values):

  • Read profiles: dmp_profile_read 
  • Write/create profiles: dmp_profile 
  • Read segments: dmp_segment_read
  • Write/create segments: dmp_segment 

Example request

POST /oauth2/token HTTP/2
Host: login.eqtv.io
content-type: application/x-www-form-urlencoded
 
grant_type=client_credentials&client_id=11111111-2222-3333-4444-555555555555&client_secret=abc_123_def&scope=target-entity:232d959c-7786-4d47-8418-48a847c52cfa:dmp_profile_read,dmp_profile,dmp_segment_read,dmp_segment

Example response

200 OK

{
    "access_token": "YOUR_TOKEN",
    "token_type": "bearer",
    "expires_in": 3599
}

The "expires_in": 3599 property in the response indicates the token’s time to live in seconds (3599 seconds = 1 hour). Once a token expires, a new token must be created. To avoid any issues due to expiry, make sure you refresh the token with a refresh interval of less than 1 hour.

Token in authorization header

Include the token in the Authorization header as follows:

GET /segmentproviders/PROVIDER_ID/segments/SEGMENT_ID HTTP/1.1
Host: datasync.eqtv.st
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN

Segment provider Id

Your Equativ account manager will provide you with the segmentProviderId, which is a unique ID to be included in each API call. With the authorization token, the segmentProviderId grants access to the segments/profiles of a specific Equativ publisher account (network) or of a specific Maestro curator account. If you need to access the segments/profiles of multiple Equativ publisher accounts (networks) or of multiple Maestro curator accounts, you will get a dedicated, unique segmentProviderId for each of them.

Example Segment API call with segmentProviderId:

GET http://datasync.eqtv.st/segmentproviders/8A254C22-0213-4059-A9BE-05D76DF01C47/segments/{id}

Example Profile API call with segmentProviderId:

GET http://datasync.eqtv.st/segmentproviders/8A254C22-0213-4059-A9BE-05D76DF01C47/profiles/{profileId}

Segment API

A segment represents an audience. An audience is a defined group of end-users. An end-user can be associated to one or multiple segments.

Segment API fields

Field Type Description
active boolean A boolean indicating if the segment is active.
creationDate integer The creation date of the segment.
description string (max. 1000 characters) A human readable description of the segment that is displayed to end users in Equativ's platform.
metaSegmentIds array of strings The meta segment IDs this segment belongs to, for example in a media marketplace, such as the European Media Marketplace (EUMM). Equativ provides you with these IDs. A non-empty list replaces the previous mapping. If you leave the field out or send an empty list, the current mapping stays as it is. Duplicate IDs are removed. The same characters as in segmentId are forbidden.
name string (max. 255 characters) The segment name (label). Campaign managers will see this name in Equativ's platform. UTF-8 encoded. Max. 100 characters.
price number The flat price of the segment, as a CPM in the agreed currency, invoiced to the data provider for transactions using the segment. You can leave it out if you set relativePrice.
relativePrice number The price of the segment as a share of the media price of the deal. It must be between 0 (included) and 1 (excluded), for example 0.15 for 15%. Values with more than 6 decimals are rounded to 6 decimals. When you also set price, the relative price is capped at price. Set it to 0 to remove relative pricing.
removeAllMetaSegments boolean Set it to true to remove all meta segment mappings of the segment. It takes priority over metaSegmentIds.
segmentId string (max. 100 characters) The segment Id, defined by the data provider.
segmentProviderId string The audience data provider (partner) that synchronizes segments with Equativ publishers. For more details, see section “Segment provider Id” earlier in this document.
selectable boolean A boolean indicating if the segment is targetable (selectable=1). Not targetable segments (selectable=0) are declared only to build the hierarchy.
ttl integer The default time to live of a profile/segment relation (in minutes). The value must be between 1 and 2147483647. Any values outside of this range will result in the transaction being rejected. Default: 43200.

Segment API operations

The Swagger API documentation provides documentation of all operations as well as a composer to build requests.

Meta segments and relative price

The following behaviors apply when working with meta segments and relative price:

  • Update without the relativePrice field: If you leave relativePrice out of a PUT request, the stored value stays as it is. On a POST request, it defaults to no relative price.
  • Invalid values: A relativePrice outside the accepted range, or a metaSegmentIds entry with a forbidden character, returns 400 Bad Request. Nothing is saved.
  • Mapping not applied: Your account must be enabled for the meta taxonomy by Equativ. If it is not enabled, or if a meta segment ID is unknown, the request still succeeds but the mapping is not applied.

Segment API examples

GET Segment request

/segmentproviders/{segmentProviderId}/segments/{id}

GET Segment response 

200 OK
{
  "segmentProviderId": "8A254C22-0213-4059-A9BE-05D76DF01C47",
  "segmentId": "segmentexample",
  "name": "Segment example",
  "ttl": 43200,
  "creationDate": 1542639922787,
  "price": 2.5,
  "relativePrice": 0.15,
  "description": "This is my segment",
  "active": true,
  "metaSegmentIds": ["eumm_automotive"]
}

PUT Segment request 

/segmentproviders/{segmentProviderId}/segments/{id}
{
  "name": "Segment example",
  "ttl": 43200,
  "price": 2.5,
  "relativePrice": 0.15,
  "description": "This is my segment",
  "active": true,
  "metaSegmentIds": ["eumm_automotive"]
}

PUT Segment response

200 OK
{
  "segmentProviderId": "11704d0c-48c6-4b53-b552-6e99265159d0",
  "segmentId": "segmentexample",
  "name": "Segment example",
  "ttl": 43200,
  "creationDate": 1639142515220,
  "price": 2.5,
  "relativePrice": 0.15,
  "description": "This is my segment",
  "active": true,
  "metaSegmentIds": ["eumm_automotive"]
}

PUT request that removes all meta segment mappings

{ "removeAllMetaSegments": true }

POST Segment request

/segmentproviders/{segmentProviderId}/segments
{
  "name": "Segment example",
  "ttl": 43200,
  "price": 2.5,
  "relativePrice": 0.15,
  "description": "This is my segment",
  "active": true,
  "metaSegmentIds": ["eumm_automotive"]
}

POST Segment response

200 Created
{
  "segmentProviderId": "11704d0c-48c6-4b53-b552-6e99265159d0",
  "segmentId": "segmentexample",
  "name": "Segment example",
  "ttl": 43200,
  "creationDate": 1639142515220,
  "price": 2.5,
  "relativePrice": 0.15,
  "description": "This is my segment",
  "active": true,
  "metaSegmentIds": ["eumm_automotive"]
}

Profile API

Profiles are end-users associated with segments.

Profile API fields

Fields Type Description
eidProvider string

Optional. The alternative ID provider that identifies the source of an encrypted alternative ID (extended ID, eid). Equativ is able to decrypt these internally, using the respective provider's API, eliminating the need for pre-decryption on your end.

Supported values (sources):

  • utiq.com (for encrypted Utiq AdTech IDs)
  • id5-sync.com (for encrypted ID5 IDs)

For more information, see section “Encrypted alternative IDs (eids)”, later in this document.

id string

The identifier of the user (profile). Ids are case sensitive and UTF-8 encoded. Equativ supports any id type, such as:

  • Equativ's cookie ID, to initiate a cookie sync with Equativ, as explained in Sync users.
  • Mobile advertising ID (MAID)
  • Publisher provided ID
  • alternative ID (extended ID, eid). For more information, see see section “Encrypted alternative IDs (eids)”.
  • IP address, frequently used to target Connected TVs or to match users with households. IP address formats must follow the standards. Overlapping or truncated IPs will be ignored and not processed. For example: IPv4 translated to IPv6 as ::ffff:202.124.87.3.
  • Postal code (ZIP code), used for geo targeting. Format: two-letter (ISO 2) or three-letter (ISO 3) country codes, followed by a colon and the postal code, for example, FR:75001. For more information, see List of ISO 3166 country codes.
profileIdSource string

The identity source (ID graph) the associated profileId belongs to. Used when onboarding profiles that have been resolved through an external identity graph in order to inform Equativ about the id origin.

Sending the profileIdSource is optional and requires back-end activation by Equativ. Please coordinate with your Equativ representative to have it enabled prior to implementation. If it is not activated, the value is ignored and profiles are still ingested as usual.

segmentProviderId string The audience data provider (partner) that synchronizes segments with Equativ publishers. For more details, see section “Segment provider Id”.
segments   The list of segments linked to the profile.
segments.<id> string The segment Id linked to the profile. The expected segment Ids are the ones created by the data provider through the segment API.
segments.<id>.expiration string The date when the link between segment and profile will expire.

Profiles without any update for over 14 days are deleted automatically: the profile expires.

 

Encrypted alternative IDs (eids)

Equativ can process encrypted alternative IDs (eids) from the providers Utiq and ID5 without prior decryption. Equativ manages the decryption process internally using the respective provider's APIs.

To enable Equativ to perform this decryption, you must include the eidProvider field and set it to utiq.com (for encrypted Utiq AdTech IDs) or id5-sync.com (for ID5 IDs).

The following is a POST profile request using an encrypted Utiq profileId. Note the inclusion of the required eidProvider field.

[
 {
   "profileId": "profile_ID_encrypted_123",
   "eidProvider": "utiq.com",
   "segmentIdsToAdd": [
     "f1dgrd4e-ehdz-fkkd-383k-1jshwzduflau"
   ],
   "segmentIdsToRemove": [
     "dgeh8d4e-81ed-4cc7-aae6-80300b18e22d"
   ],
   "segmentIdsToSet": [
     "fsjexd4e-8sad-9ec8-kklw-827dhhg8e2zw"
   ]
 }
]

Profile API operations

The Swagger API documentation provides documentation of all operations as well as a composer to build requests.

Profile API examples

PUT Profile request

The PUT operation creates/updates the entire profile. In case of updating, the provided list will replace the previous list: all previously declared segments will be lost and the ttl of all segments will be reset to the values previously set as default for each segment. 

/segmentproviders/{segmentProviderId}/profiles/{profileId}

{
  "profileIdSource": "string",
  "segments": [
    {
      "id": "segmentId1"
    },
    {
      "id": "segmentId2"
    }
  ]
}

The profileIdSource is optional and requires back-end activation by Equativ. Please coordinate with your Equativ representative to have it enabled prior to implementation. If it is not activated, the value is ignored and profiles are still ingested as usual.

 

PUT Profile response

200 OK

The 200 OK status for PUT Profile means the API has processed the request, but the profile might not yet be created/updated. This is an asynchronous process in Equativ's servers with a latency of up to 4 hours between a profile push and it being created/updated. The profile is to be considered created/updated when the GET Profile method returns 200 OK with the profile ID.

 

POST Profile request

See section “Profile API batch requests example" below

POST Profile response

See section “Profile API batch requests example" below

GET Profile request

The GET operation retrieves the segments associated with a given profile.

/segmentproviders/brc95dfd-c5xa-4c48-bz64-b0aqc7esb7c/profiles/profile123

GET Profile response

The GET Profile response contains the segments associated with the given profile, including the expiration, indicating the date/time when the association between the segment and the profile expires.

200 OK 

{
  "id": "profile123",
  "segmentProviderId": "brc95dfd-c5xa-4c48-bz64-b0aqc7esb7c",
  "segments": [
    {
      "expiration": ""2024-01-11T08:21:05Z",
      "id": "12345"
    }
  ]
}

Profile API batch requests

You can batch requests to limit bandwidth usage and accelerate treatment time using the API requests described below.

Profile API batch requests fields

Field Description
profileId The profile Id. Case sensitive and UTF8-encoded.
profileIdSource

The identity source (ID graph) the associated profileId belongs to. Used when onboarding profiles that have been resolved through an external identity graph in order to inform Equativ about the profileId origin.

Sending the profileIdSource is optional and requires back-end activation by Equativ. Please coordinate with your Equativ representative to have it enabled prior to implementation. If it is not activated, the value is ignored and profiles are still ingested as usual.

segmentIdsToAdd The list of segments to add to the profile Id. Equativ will create the profileId automatically if it is not yet known to Equativ.
segmentIdsToRemove The list of segments to remove from the profileId. When removeAllSegments has a value TRUE in the request, Equativ will remove all segmentIds for the associated profileId.
segmentIdsToSet The list of segments to define for the profileId (full refresh). Equativ will create the profileId automatically if it is not yet known to Equativ.

To be valid, an object must contain at least one of the properties segmentIdsToAdd, segmentIdsToSet or segmentIdsToRemove.

 

Profile API batch requests operations

The Swagger API documentation provides documentation of all operations as well as a composer to build requests (see: POST /segmentproviders/{segmentProviderId}/profiles).

Profile API batch requests example

POST Profile request

POST https://datasync.eqtv.st/segmentproviders/8A254C22-0213-4059-A9BE-05D76DF01C47/profiles

[
  {
    "profileId": "profileIdString",
    "profileIdSource": "profileIdSourceAsString",
    "segmentIdsToSet": [
      "mysegmentid1",
      "mysegmentid2"
    ]
  },
  {
    "profileId": "profileIdString",
    "profileIdSource": "profileIdSourceAsString",
    "segmentIdsToAdd": [
      "mysegmentid1",
      "mysegmentid2"
    ]
  },
  {
    "profileId": "profileIdString",
    "profileIdSource": "profileIdSourceAsString",
    "segmentIdsToRemove": [
      "mysegmentid6",
      "mysegmentid7"
    ]
  },
  {
    "profileId": "profileIdString",
    "profileIdSource": "profileIdSourceAsString",
    "segmentIdsToAdd": [
      "mysegmentid1",
      "mysegmentid2"
    ],
    "segmentIdsToRemove": [
      "mysegmentid4"
    ]
  }
]

The profileIdSource is optional and requires back-end activation by Equativ. please coordinate with your Equativ representative to have it enabled prior to implementation. If it is not activated, the value is ignored and profiles are still ingested as usual.

 

POST Profile response

200 OK

The 200 OK status for POST Profile means the API has processed the request, but the profile might not yet be created. This is an asynchronous process in Equativ's servers with a latency of up to 4 hours between a profile push and it being created. The profile is to be considered created when the GET Profile method returns 200 OK with the profile ID.

 

Error response codes

HTTP status code Description
400 Bad Request Returned if the requested payload was invalid.
401 Unauthorized Returned for requests without any token or with an invalid token.
403 Forbidden Returned if a token does not have the requested scope to execute the request.
404 Not Found Returned in case of malformed URL, invalid format id or unknown resource.
420 Daily or Pacing Window Limit Exceeded Returned if the daily payload limit or the payload limit per pacing window was exceeded.
429 Too Many Requests Returned in case of the queue on Equativ's server being full. Uploads must be slowed down or paced to mitigate the issue.
500 Internal Server Error Returned in the case of unexpected errors which might have occurred in the system.

API rate limits

If these limits are exceeded, the source IP will be banned for 5 minutes.

 

Per segmentProviderId, the following rate limits apply for any read or write API operation (GET, PUT, PATCH, POST).

  • Segment API: 1000 requests per day
  • Profile API: 1000 requests per second; in the case of batched requests, one batch is counted as one request
  • One batch request is limited to 1MB

Specific headers in the response header of each API call indicate the state of the current rate limit.

Provided headers:

  • Time left until the rate limit reset: X-RateLimit-Reset 
  • Remaining calls before reaching the limit: X-RateLimit-Remaining 
  • The maximum rate limit: X-RateLimit-Limit 

Payload limit

The maximum daily payload (data) a segment provider can push is 30 GB.

To prevent large bursts of usage, a pacing system distributes the daily limit evenly across 288 pacing windows (duration of one pacing window: 5 minutes). The pacing window limit equals 104 MB (30 GB divided by 288).

A minimum of 1 MB per pacing window is guaranteed to prevent zero limits.