Developer REST API & HMAC Webhooks
Consent Shield AI exposes full REST APIs and real-time Webhook feeds for synchronizing consent states with backend databases, CRMs, and data clean rooms.
Generating API Keysโ
- Navigate to Dashboard โ Settings โ API Keys.
- Click Generate New API Secret.
- Copy your key:
cs_live_sec_....
Webhook Event Typesโ
| Event Name | Trigger Condition |
|---|---|
consent.granted | Visitor opted into one or more non-essential categories. |
consent.revoked | Visitor updated preferences to reject tracking. |
gpc.signal_detected | Visitor browser transmitted a Global Privacy Control header. |
tracker.quarantined | A new unclassified script was detected and blocked pre-DOM. |
Verifying Webhook HMAC Signatures (Node.js)โ
const crypto = require('crypto');
function verifyConsentWebhook(payload, signatureHeader, webhookSecret) {
const computedHash = crypto
.createHmac('sha256', webhookSecret)
.update(payload, 'utf8')
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(computedHash),
Buffer.from(signatureHeader)
);
}