SMS
Consent (CASL)
Under CASL you must record consent before sending a commercial message. The API refuses sends to numbers without valid consent (HTTP 451).
CASL Consent (required before sending)
Under CASL, you must record consent before sending a commercial message to any recipient. The API will block sends to phone numbers without valid consent (HTTP 451).
const { error } = await honkio.consents.create({
phoneNumber: '+1613XXXXXXX',
consentType: 'express',
sourceDescription: 'Website opt-in form',
sourceIp: '203.0.113.1',
})
if (error) throw new Error(error.message)curl -X POST https://api.honkio.ca/v1/compliance/consents \
-H "Authorization: Bearer mk_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "+1613XXXXXXX",
"consent_type": "express",
"source_description": "Website opt-in form",
"source_ip": "203.0.113.1"
}'Implied consent for an existing customer, with the clock running from their last transaction:
const { data, error } = await honkio.consents.create({
phoneNumber: '+1613XXXXXXX',
consentType: 'implied',
relationshipType: 'purchase',
lastTransactionDate: '2025-11-04',
})
if (error) throw new Error(error.message)
console.log(data.expires_at) // '2027-11-04T00:00:00.000Z'curl -X POST https://api.honkio.ca/v1/compliance/consents \
-H "Authorization: Bearer mk_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "+1613XXXXXXX",
"consent_type": "implied",
"relationship_type": "purchase",
"last_transaction_date": "2025-11-04"
}'
# → { "status": "recorded", "phone_number": "+1613XXXXXXX", "expires_at": "2027-11-04T00:00:00.000Z" }Express consent never expires. Implied consent expires after 2 years per CASL §10(9). Pass last_transaction_date so the two-year clock runs from the real relationship rather than from the day you record it, or set expires_at outright when you have already worked out the expiry. The response echoes expires_at so you can verify it.
HonkIO