Links

A consent link is a pre-authenticated URL that creates a consent event when it gets accessed from a browser. Consent links can be used to send users links that they can click to update their consent status. This includes use cases like unsubscribing from all communications in an email, sending a confirmation email with an action button, etc.

The /consents/actions/links endpoint of the API can be used to create consent links. For a full reference of the endpoint and the resources that it returns, visit https://api.didomi.io/docs/.

Create a consent link

To create a consent token for a user, send a POST request to https://api.didomi.io/consents/actions/links?organization_id=<ID of your organization> and specify the following parameters in the body:

Property

Description

organization_user_id

Organization user ID that a consent event should be created for when the link gets executed

action

Action to execute when a user loads the consent link in a browser. Must be event.create for now.

event

The consent event to create when a user loads the consent link in a browser.

redirect_url

The URL to redirect the user to after loading the consent link. This allows the user to end up on a page that you own.

lifetime

Lifetime of the consent link in seconds. The consent link automatically expires after that duration. Defaults to 1 hour.

Example:

POST https://api.didomi.io/consents/actions/links?organization_id=<ID of your organization>
{
"organization_user_id": "<User ID>",
"action": "event.create",
"event": {
"consents": {
"purposes": [
...Update to purposes
]
}
},
"redirect_url": "https://www.ourwebsite.com"
}

The API will respond with the created link in the url field:

{
"organization_user_id": "<User ID>",
"action": "event.create",
"event": {
"consents": {
"purposes": [
...Update to purposes
]
}
},
"redirect_url": "https://www.ourwebsite.com",
"url": "https://api.privacy-center.org/consents/execute/..."
}