Save Consent POST
Records a PDPA consent for a mobile number. Every call appends a new record (existing records are never changed) — if the recipient withdraws consent, save a new record with granted: false.
Authorization
API Key (Authentication) — send the header Authorization: Bearer <API_KEY> (API keys start with smsk_)
HTTP Request
http
POST https://public-api.smsup-plus.com/Consent/saveconsentContent Type
application/json
Parameter Description
| Property | Type | Required | Description |
|---|---|---|---|
mobile | string | Required | Mobile number. Characters other than digits and + are removed; 10–15 digits must remain |
consentType | string | Required | Consent type (e.g. marketing, transactional) |
granted | boolean | Required | true = consented, false = declined / withdrawn |
source | string | Optional | Where the consent was collected (e.g. web, sms-reply) |
note | string | Optional | Free-text note |
Response Description
| Property | Type | Description |
|---|---|---|
status | number | 200 when saved |
description | string | Consent recorded. |
data.consentId | string | Consent record ID (UUID) |
data.createdAt | string | Time the record was saved (ISO 8601, UTC) |
Request Example
bash
curl -X POST 'https://public-api.smsup-plus.com/Consent/saveconsent' \
-H 'Authorization: Bearer <API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"mobile": "0812345678",
"consentType": "marketing",
"granted": true,
"source": "web",
"note": "Subscribed to news on the website"
}'js
const res = await fetch('https://public-api.smsup-plus.com/Consent/saveconsent', {
method: 'POST',
headers: { Authorization: 'Bearer <API_KEY>', 'Content-Type': 'application/json' },
body: JSON.stringify({
mobile: '0812345678',
consentType: 'marketing',
granted: true,
source: 'web',
note: 'Subscribed to news on the website',
}),
})
console.log(await res.json())Response Example
json
{
"status": 200,
"description": "Consent recorded.",
"data": {
"consentId": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
"createdAt": "2026-11-16T03:15:42.512345678Z"
}
}Possible Errors
This endpoint always answers HTTP 200 (except authentication errors) — check the status field in the body.
| HTTP | Response | Cause |
|---|---|---|
| 200 | {"status":400,"description":"mobile, consentType, and granted are required."} | Body is not JSON, or mobile / consentType / granted is missing |
| 200 | {"status":400,"description":"Invalid mobile number."} | Fewer than 10 or more than 15 digits |
| 200 | {"status":500,"description":"Failed to save consent."} | Save failed; retry |
| 200 | {"status":401,"description":"Unauthorized."} | The account could not be resolved from the credentials |
| 401 | {"error":"invalid api key"} | Invalid API key — see Errors |
WARNING
Saving granted: false (withdrawal) may cause later SMS to this number to be rejected, depending on your account's consent settings — it takes effect from the next send.
TIP
- Use the same number format every time, because Check Consent matches numbers exactly.
- The caller's IP address and User-Agent are stored with the record as evidence of consent.
