Skip to content

Create consent link

POST /api/outside-app/consent-link/create

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

Body

FieldTypeRequiredDescription
collection_point_idstringYesUUID or display_id of the collection point for this consent request
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.
expiry_hoursintegerNoHow long the link remains valid. Between 1 and 24. Default: 24.
send_smsbooleanNoWhether to deliver the link via SMS. Default: true.
success_messagestringNoCustom message shown to the data principal after they submit consent.
data_collection_timestampstringNoISO 8601 timestamp recording when the underlying data was collected.

Response

201 Created

FieldTypeDescription
request_idstringStable identifier for this consent request. Use to check status, regenerate, or correlate consent outcomes.
event_idstringUnique identifier for this specific link instance. Each regeneration produces a new event_id while preserving the same request_id.
consent_linkstringThe magic link URL to share with the data principal.
expires_atstringISO 8601 timestamp of when the link expires.
delivery_statusobjectOutcome of any delivery attempts made during link creation.

delivery_status fields:

FieldTypeDescription
emailstringPresent when email was provided. Either "sent" or "failed".
smsstringPresent when send_sms is true. Value is "pending" while the SMS is being dispatched.

Errors

StatusDescription
400Tenant context could not be resolved from the provided token
404No collection point found matching collection_point_id
422Request body failed validation. The response includes a details array describing each invalid field.
500Unexpected internal error

Example

Terminal window
curl --request POST \
--url https://api.truConsent.io/api/outside-app/consent-link/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"collection_point_id": "cp_onboarding_v2",
"phone": "+917299424311",
"email": "priya.sharma@example.com",
"expiry_hours": 12,
"send_sms": true,
"success_message": "Thank you for providing your consent.",
"data_collection_timestamp": "2026-04-21T08:30:00Z"
}'
{
"request_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"event_id": "f9e8d7c6-b5a4-3210-fedc-ba9876543210",
"consent_link": "https://collect.truConsent.io/acme/cp_onboarding_v2/f9e8d7c6-b5a4-3210-fedc-ba9876543210",
"expires_at": "2026-04-21T20:30:00+00:00",
"delivery_status": {
"email": "sent",
"sms": "pending"
}
}