Users
Consent users represent end users of your applications or websites that Didomi is storing consent and preferences information for.
The User entity represents the latest consent status of an end user as well as additional metadata. That's the entity that you should query when you want to check if you have consent for a specific data processing or purpose.
The /consents/users endpoint of the API exposes the users managed by Didomi for your organizations. For a full reference of the endpoint and the resources that it returns, visit https://api.didomi.io/docs/.

Create a consent user

You can create a user by calling the POST /consents/users endpoint and providing basic information on the user as well as custom metadata that you want to associate with the user.
You can provide following information on users:
  • Organization user ID: a free-form user ID that is specific to your organization and that is used to identify the user within your organization. This could be an email address, a CRM ID, etc. It can be used to query users and events.
  • Metadata: a free-form object with any custom metadata that you want to associate with the user
  • Consents: the consent status of the user for purposes, preferences, channels and vendors
While you can specify a consent status for a user when you create it, we recommend using consent events instead for registering the user consent status as you will benefit from automated consent history and updates.
Example
1
POST /consents/users?organization_id={organization_id}
2
3
BODY
4
{
5
"organization_user_id": "[email protected]",
6
7
"metadata": {
8
... free-form object with user metadata
9
}
10
}
Copied!

Query a consent user

You can query consent users that belong to your organization, and filter by user ID or organization user ID.
Users are returned by pages of 100 and every query returns a cursor value that can be used to get the next page of results. You can iterate through pages of results by specifying the $cursor query-string parameter from the previous query. The returned cursor is null when there is no more result available.

Paginate through users

Get the first 100 users that belong to an organization:
1
GET /consents/users?organization_id={organization_id}
2
3
RESPONSE
4
{
5
"data": [
6
...list of 100 users
7
],
8
"limit": 100, // Number of users in the current page
9
"cursor": ... // Cursor to use for querying the next page of results
10
}
Copied!
Get the following 100 users:
1
GET /consents/users?organization_id={organization_id}&$cursor={cursor from previous query}
2
3
RESPONSE
4
{
5
"data": [
6
...list of 100 users
7
],
8
"limit": 100, // Number of users in the current page
9
"cursor": ... // Cursor to use for querying the next page of results
10
}
Copied!

Get a user by its organization user ID

1
GET /consents/users?organization_id={organization_id}&organization_user_id={organization_user_id}
2
3
RESPONSE
4
{
5
"data": [
6
{
7
"id": "0cc784a0-4425-45ca-a62f-00dd588d1526",
8
"organization_user_id": "organization_user_id",
9
"consents": {
10
...
11
}
12
}
13
],
14
"limit": 100,
15
"cursor": null
16
}
Copied!

Status propagation

The user choice at a specific level automatically propagates to elements at the lower level.
For instance, if a user sets enabled to false at the purpose level, it overrides lower-level enabled values (for preferences and channels) that will also be set to false automatically.
A practical example is that enabled at the purpose level can be used to implement Subscribe to all / Unsubscribe to all features where a user can subscribe to / unsubscribe from all preferences (current and future) by setting enabled to false on the purpose. Future preferences under that purpose will automatically get enabled set to false.
For instance, if you are pushing the following consent status to the API:
1
{
2
"purposes": [
3
{
4
"id": "purpose-1",
5
"enabled": false,
6
"preferences": [
7
{
8
"id": "preference-1",
9
"enabled": true
10
}
11
]
12
}
13
],
14
15
"vendors": { ... }
16
}
Copied!
This status from the event indicates that the user has disabled the purpose but enabled the preference. When updating the user status from the event, the status from the purpose will be propagated down to the preference and the API will store:
1
{
2
"purposes": [
3
{
4
"id": "purpose-1",
5
"enabled": false,
6
"preferences": [
7
{
8
"id": "preference-1",
9
"enabled": false
10
}
11
]
12
}
13
],
14
15
"vendors": { ... }
16
}
Copied!

User Schema

Users have the following schema:
1
{
2
/**
3
* The Didomi user ID
4
* A random UUID for users encountered on websites and an IDFA/ADID for
5
* users from mobile apps.
6
*/
7
id: 'string',
8
9
/**
10
* A unique user ID in your organization
11
* This could be an email, a phone number, an internal client ID, etc.
12
* It is used to link Didomi users to your internal systems.
13
* Multiple Didomi users can be associated with one organization user ID.
14
*/
15
organization_user_id: 'string',
16
17
/**
18
* Version number of the user record
19
* User for optimistic locking
20
*/
21
version: Number,
22
23
/**
24
* Creation date of the user record
25
*/
26
created_at: 'ISO8601 date',
27
28
/**
29
* Last update date of the user record
30
*/
31
updated_at: 'ISO8601 date',
32
33
/**
34
* Free-form metadata object on the user
35
*/
36
metadata: Object,
37
38
/**
39
* Two-letter ISO code of the user's country.
40
* `null` if no value is provided. This property is never set automatically by Didomi.
41
*/
42
country: 'string',
43
44
/**
45
* Two-letter ISO country code of the last consent event for the user.
46
* The country of a consent event might differ from the initial
47
* user's country. This property stores the last seen country from
48
* the user's consent events.
49
* Auto-filled for Didomi SDK events.
50
*/
51
last_seen_country: 'string',
52
53
/**
54
* Consent status of the user
55
*/
56
consents: {
57
/**
58
* Channels that the user made choices for
59
*/
60
channels: [
61
{
62
/**
63
* Unique channel ID
64
*/
65
id: 'string',
66
67
/**
68
* Whether the user has enabled this channel or not
69
* A null value indicates that the user has not made a specific
70
* choice for the channel
71
*/
72
enabled: boolean | null,
73
74
/**
75
* Free-form metadata object
76
*/
77
metadata: Object,
78
}
79
],
80
81
/**
82
* Purposes that the user has made choices for
83
*/
84
purposes: [
85
{
86
/**
87
* Unique purpose ID
88
*/
89
id: 'string',
90
91
/**
92
* Whether the user has given consent to this purpose or not
93
* A null value indicates that the user has not made a specific
94
* choice for the purpose but might have made choices for
95
* preferences or channels
96
*/
97
enabled: boolean | null,
98
99
/**
100
* Channels that the user made choices for
101
*/
102
channels: [
103
{
104
/**
105
* Unique channel ID
106
*/
107
id: 'string',
108
109
/**
110
* Whether the user has enabled this channel or not
111
* A null value indicates that the user has not made a specific
112
* choice for the channel
113
*/
114
enabled: boolean | null,
115
116
/**
117
* Free-form metadata object
118
*/
119
metadata: Object,
120
}
121
],
122
123
/**
124
* Extra preferences expressed for the purpose
125
*/
126
preferences: [
127
{
128
/**
129
* Unique preference ID
130
*/
131
id: 'string',
132
133
/**
134
* Whether the user has enabled this preference or not
135
* A null value indicates that the user has not made a specific
136
* choice for the preference but might have made choices for
137
* channels
138
*/
139
enabled: boolean | null,
140
141
/**
142
* Channels
143
*/
144
channels: [
145
{
146
/**
147
* Unique channel ID
148
*/
149
id: 'string',
150
151
/**
152
* Whether the user has enabled this channel or not
153
* A null value indicates that the user has not made a specific
154
* choice for the channel
155
*/
156
enabled: boolean | null,
157
158
/**
159
* Free-form metadata object
160
*/
161
metadata: Object,
162
}
163
],
164
165
166
167
/**
168
* Free-form metadata object on the preference
169
*/
170
metadata: Object,
171
}
172
]
173
},
174
...
175
],
176
177
/**
178
* Vendors that the user has made choices for
179
*/
180
vendors: {
181
/**
182
* List of vendor IDs that the user has given consent to
183
*/
184
enabled: ['string', ...],
185
186
/**
187
* List of vendor IDs that the user has denied consent to
188
*/
189
disabled: ['string', ...]
190
},
191
192
/**
193
* TCF consent string for the user
194
* (if it was available or generated at the time of consent collection)
195
*/
196
tcfcs: 'string'
197
}
198
}
Copied!
Last modified 5mo ago