Skip to content

User banners

GET /banners/user/{user_id}

Use this endpoint to retrieve the consent banners that a specific user has already interacted with. Unlike GET /banners, which returns all banners with a default status of "declined", this endpoint filters to collection points where the user has a recorded consent log entry and overlays each purpose with the user’s actual consent status.

If the user has no consent history, the response is an empty array.

Path parameters

ParameterTypeRequiredDescription
user_idstringYesThe identifier of the user whose consent history should be retrieved

Headers

HeaderTypeRequiredDescription
X-API-KeystringYesYour tenant API key

Response

200 OK — an array of BannerMeta objects. The structure matches GET /banners with two differences:

  • The array contains only collection points where the user has a consent log entry.
  • Each purpose’s consented field reflects the user’s actual recorded status instead of the default "declined".

An empty array [] is returned when the user has no consent records — this is not an error.

FieldTypeDescription
banner_idstringUUID of the collection point
collection_pointstringUUID of the collection point
titlestringDisplay name of the collection point
assetobject or nullAsset associated with the collection point, or null
purposesarrayPurposes with the user’s actual consent status applied
data_elementsarrayData elements linked across all purposes
legal_entitiesarrayLegal entities linked across all purposes
shown_to_principalbooleantrue if the user’s most recent action for this collection point was "approved"

purposes[] fields:

FieldTypeDescription
idstringUUID of the purpose
namestringDisplay name
is_mandatorybooleanWhether acceptance is mandatory
expiry_periodstring or nullHuman-readable expiry period
consentedstringThe user’s recorded consent status: "approved", "declined", or "pending". Defaults to "pending" if no matching entry is found.
relationshipsobjectRaw relationship maps to data elements, legal entities, and other entities

Errors

StatusDescription
400Tenant context could not be resolved from the provided API key
500Unexpected server error

Example

Terminal window
curl --request GET \
--url https://api.truConsent.io/banners/user/usr_abc123 \
--header "X-API-Key: YOUR_API_KEY"

User has consent records:

[
{
"banner_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"collection_point": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"title": "Website Sign-up Consent",
"asset": {
"id": "f1e2d3c4-b5a6-7890-abcd-123456789012",
"name": "Marketing Website",
"description": null,
"asset_type": "website"
},
"purposes": [
{
"id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"name": "Marketing Communications",
"is_mandatory": false,
"expiry_period": "1 Year",
"consented": "approved",
"relationships": {
"data_elements": ["de-uuid-1"],
"legal_entities": ["le-uuid-1"]
}
}
],
"data_elements": [
{ "id": "de-uuid-1", "name": "Email Address" }
],
"legal_entities": [
{ "id": "le-uuid-1", "name": "Acme Corp Ltd" }
],
"shown_to_principal": true
}
]

User has no consent records:

[]