Skip to content

Create consent link

POST /api/v1/external/public/consent-link

Use this endpoint to generate a magic consent link for a data principal. The link directs the user to a hosted consent flow where they verify their identity via OTP and submit their consent preferences.

Authentication

Both headers are required.

HeaderTypeRequiredDescription
X-Org-IdstringYesYour organization slug
X-API-KeystringYesYour tenant API key

Query parameters

ParameterTypeRequiredDescription
asset_idstringYesThe asset ID to associate this consent link with

Body

FieldTypeRequiredDescription
collectionPointIdstringYesUUID or display_id of the collection point. Also accepted as collection_point_id.
phonestringYesThe data principal’s phone number in E.164 format (for example, +917299424311). Receives the OTP during the consent flow.
emailstringNoIf provided, a branded consent email with the magic link is sent to this address. The address is deleted immediately after sending.
expiryHoursintegerNoHow long the link remains valid. Between 1 and 24. Default: 24. Also accepted as expiry_hours.

Response

201 Created

FieldTypeDescription
requestIdstringStable identifier for this consent request. Use to check status, duplicate, or correlate consent outcomes.
eventIdstringUnique identifier for this specific link instance. Each duplication produces a new eventId while preserving the same requestId.
consentLinkstringThe magic link URL to share with the data principal.
expiresAtstringISO 8601 timestamp of when the link expires.
deliveryStatusobjectOutcome of any delivery attempts made during link creation.

deliveryStatus fields:

FieldTypeDescription
emailstringPresent when email was provided. Either "sent" or "failed".

Errors

StatusDescription
400X-Org-Id could not be resolved, or collectionPointId is missing or invalid
401X-API-Key is invalid or missing
403API key lacks the admin scope
404No collection point found matching collectionPointId
422Request body failed validation
500Internal server error

Example

Terminal window
curl --request POST \
--url 'https://truapi-dev.truconsent.io/api/v1/external/public/consent-link?asset_id=ast_xxxxxxxxxxxx' \
--header 'X-Org-Id: acme' \
--header 'X-API-Key: tck_live_xxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data '{
"collectionPointId": "cp_onboarding_v2",
"phone": "+917299424311",
"email": "priya.sharma@example.com",
"expiryHours": 12
}'
{
"requestId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"eventId": "f9e8d7c6-b5a4-3210-fedc-ba9876543210",
"consentLink": "https://collect.truConsent.io/acme/cp_onboarding_v2/f9e8d7c6-b5a4-3210-fedc-ba9876543210",
"expiresAt": "2026-04-21T20:30:00+00:00",
"deliveryStatus": {
"email": "sent"
}
}