Consent Docs

Hosted page links

The endpoints that issue a link to a person's consent portal and a one-click unsubscribe link, with parameters, examples and errors.

Reference2 min readFor developers calling the REST API

These endpoints issue links to two hosted pages that are opened with a signed token. Paths are relative to https://console.dpconsent.com/consent/sdk/v1. What each page shows is in Hosted pages.

Endpoints#

POST /pages/consent-portal-links#

Returns a link to the page where a person sees every consent they gave, withdraws any of them and downloads a copy.

Key Scope Idempotency-Key Webhook sent
Secret consent:write Ignored None

Parameters

Name Type Required Description
subjectId string Yes The person's identifier.
subjectType string No EMAIL, PHONE, USER_ID, DEVICE_ID, SESSION_ID or COOKIE_ID. Without it, a value that contains @ is treated as an email address.

Request

cURLShell
curl -X POST https://console.dpconsent.com/consent/sdk/v1/pages/consent-portal-links \
  -H "Authorization: Bearer $PIEDAP_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "subjectId": "usr_8f2K1xQz", "subjectType": "USER_ID" }'
Node.jsJavaScript
const { url, expiresOn } = await client.consentPortalLink(
  'usr_8f2K1xQz',
  'USER_ID',
);
Python
link = client.consent_portal_link("usr_8f2K1xQz", "USER_ID")
url, expires_on = link["url"], link["expiresOn"]

Response

200:

JSON
{
  "url": "https://console.dpconsent.com/consent/sdk/v1/pages/my-consents?token=…",
  "expiresOn": "2026-10-01T10:12:03.000Z"
}
Field Type Description
url string The link to give the person. Anyone who holds it can withdraw that person's consents.
expiresOn time When the link stops working, seven days after it was made.

The page shows live records only.

Errors

Status Code When
401 None. The message is Unauthorized The call was made with a publishable key.
400 None. The message is subjectId is required subjectId is missing or empty.

Also the errors every call can return.

POST /pages/unsubscribe-links#

Returns a one-click unsubscribe link for one consent record, with the headers to add to your messages.

Key Scope Idempotency-Key Webhook sent
Secret None Ignored None

Parameters

Name Type Required Description
consentId string Yes The record the link withdraws.

Request

cURLShell
curl -X POST https://console.dpconsent.com/consent/sdk/v1/pages/unsubscribe-links \
  -H "Authorization: Bearer $PIEDAP_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "consentId": "cns_91b7d0c4a2e64f0f8d3c5a7b9e1f2c60" }'
Node.jsJavaScript
const { url, headers } = await client.unsubscribeLink(consentId);
Python
import json
import os
import urllib.request

request = urllib.request.Request(
    "https://console.dpconsent.com/consent/sdk/v1/pages/unsubscribe-links",
    data=json.dumps({"consentId": consent_id}).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {os.environ['PIEDAP_SECRET_KEY']}",
        "Content-Type": "application/json",
    },
)
with urllib.request.urlopen(request, timeout=10) as response:
    link = json.load(response)

The Python package has no helper for this call.

Response

200:

JSON
{
  "consentId": "cns_91b7d0c4a2e64f0f8d3c5a7b9e1f2c60",
  "url": "https://console.dpconsent.com/consent/sdk/v1/pages/unsubscribe?token=…",
  "headers": {
    "List-Unsubscribe":
      "<https://console.dpconsent.com/consent/sdk/v1/pages/unsubscribe?token=…>",
    "List-Unsubscribe-Post": "List-Unsubscribe=One-Click"
  }
}
Field Type Description
consentId string The record the link withdraws.
url string The link for the message body. Opened in a browser, it asks the person to confirm. It does not expire.
headers object List-Unsubscribe and List-Unsubscribe-Post. Add both to the message as they are. A mail client's one-click POST withdraws the record at once.

Using the link withdraws the record and sends consent.withdrawn.

Errors

Status Code When
401 None. The message is Unauthorized The call was made with a publishable key.
404 None. The message is Consent record not found No record in the project has this consentId.

Also the errors every call can return.

Hosted page addresses#

All addresses start with https://console.dpconsent.com/consent/sdk/v1.

Page Address Where the link comes from
Privacy notice /pages/<publishable key>/privacy You build it from your publishable key
Rights request form /pages/<publishable key>/request You build it from your publishable key
Request confirmation /pages/verify-request?token=… The subject_request.received event
Your consents /pages/my-consents?token=… POST /pages/consent-portal-links
Unsubscribe /pages/unsubscribe?token=… POST /pages/unsubscribe-links
Email confirmation /email-consent/verify?token=… POST /email-consent

Add ?lang= or &lang= and a language code, such as hi, to open a page in that language. It works on every page except the email confirmation.

↑↓ to move, Enter to open