Skip to main content

EUID SDK for C++ (Server-Side) Reference Guide

You can use the EUID SDK for C++ (Server-Side) to facilitate decrypting of EUID tokens to access the raw EUID.


The functions outlined here define the information that you'll need to configure or can retrieve from the library. The parameters and property names defined below are pseudocode. Actual parameters and property names vary by language but will be similar to the information outlined here.


This SDK simplifies integration with EUID for any DSPs who are using C++ for their server-side coding. The following table shows the functions it supports.

Encrypt Raw EUID to EUID TokenDecrypt EUID TokenGenerate EUID Token from Personal DataRefresh EUID Token
SupportedSupportedNot supportedNot supported


The SDK requires C++ version 11.

GitHub Repository/Binary

This SDK is in the following open-source GitHub repository:

Release tags are available in the following GitHub location, but you must build your own binaries:


The initialization function configures the parameters necessary for the SDK to authenticate with the EUID service. It also allows you to configure retry intervals in the event of errors.

ParameterDescriptionRecommended Value
endpointThe endpoint for the EUID service.N/A
authKeyThe authentication token that belongs to the client. For access to EUID, see Contact Info.N/A


The interface allows you to decrypt EUID advertising tokens and return the corresponding raw EUID.

NOTE: When you use an SDK, you do not need to store or manage decryption keys.

If you're a DSP, for bidding, call the interface to decrypt an EUID advertising token and return the EUID. For details on the bidding logic for handling user opt-outs, see DSP Integration Guide.

The following is the decrypt method in C++:

#include <uid2/uid2client.h>
using namespace uid2;

const auto client = EUIDClientFactory::Create(baseUrl, apiKey, secretKey);
client->Refresh(); //Note that Refresh() should be called once after create(), and then once per hour
const auto result = client->Decrypt(adToken);

Response Content

Available information returned through the SDK is outlined in the following table.

GetStatus()The decryption result status. For a list of possible values and definitions, see Response Statuses.
GetUid()The raw EUID for the corresponding EUID advertising token.
GetEstablished()The timestamp indicating when a user first established the EUID with the publisher.

Response Statuses

SuccessThe EUID advertising token was decrypted successfully and a raw EUID was returned.
NotAuthorizedForKeyThe requester does not have authorization to decrypt this EUID advertising token.
NotInitializedThe client library is waiting to be initialized.
InvalidPayloadThe incoming EUID advertising token is not a valid payload.
ExpiredTokenThe incoming EUID advertising token has expired.
KeysNotSyncedThe client has failed to synchronize keys from the EUID service.
VersionNotSupportedThe client library does not support the version of the encrypted token.


For a list of frequently asked questions for DSPs, see FAQs for DSPs.