Register Marketing Consent
Register or revoke marketing consent for a phone number. Use this endpoint to maintain GDPR-compliant records of consent obtained through your website, app, or other channels.
Marketing consent can also be registered when sending SMS by including marketing_consent: true in the send request.
Path Parameters
Language code (e.g., lt, en)
Authentication
API key from Partners Portal
API secret from Partners Portal
Request Body
Required Fields
Phone number to register consent for. E.164 format recommended. Example: "+37061234567"
true - Register consent (opt-in)
false - Revoke consent (opt-out)
Optional Fields (Recommended for GDPR)
Source/channel where consent was obtained. Examples: "website_form", "pos", "app", "phone_call"
The actual IP address of the end user who gave consent. Important for GDPR compliance. Example: "192.168.1.100"Do NOT send your server’s IP address. Send the actual end user’s IP.
Browser/device user agent string of the person who gave consent. Example: "Mozilla/5.0 (Windows NT 10.0; Win64; x64)..."
URL of the page/form where consent was obtained. Example: "https://example.com/newsletter-subscribe"
Response
Whether the consent was registered successfully
When consent was given (for opt-in)
When consent was revoked (for opt-out)
cURL - Register Consent (Opt-in)
cURL - Revoke Consent (Opt-out)
JavaScript - Website Form Integration
PHP - Server-side Form Handler
Python
curl -X POST "https://api.loyalty.lt/lt/sms/consent" \
-H "Content-Type: application/json" \
-H "X-API-Key: your_api_key" \
-H "X-API-Secret: your_api_secret" \
-d '{
"phone_number": "+37061234567",
"consent_given": true,
"consent_source": "website_form",
"client_ip": "192.168.1.100",
"client_user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
"consent_page_url": "https://example.com/newsletter"
}'
Consent Registered (200)
Consent Revoked (200)
Validation Error (422)
{
"success" : true ,
"message" : "Marketing consent registered successfully" ,
"data" : {
"phone_number" : "+37061234567" ,
"consent_given" : true ,
"consent_source" : "website_form" ,
"consent_date" : "2025-01-15T10:30:00Z"
},
"code" : 200
}
GDPR Best Practices
Collect Client Information
Always capture the end user’s IP address and user agent when obtaining consent. Do not use your server’s IP.
Record Consent Source
Use descriptive consent_source values like website_form, checkout_page, mobile_app, pos_terminal.
Include Page URL
Record consent_page_url to prove where consent was obtained.
Handle Opt-Outs
Immediately process opt-out requests by calling this endpoint with consent_given: false.
GDPR Compliance Note You are responsible for ensuring your consent collection process meets GDPR requirements:
Clear and unambiguous consent request
Separate consent for different purposes
Easy way to withdraw consent
Keep records of when and how consent was obtained