For Developers & CTOs

Consent System Architecture

A deep-dive technical blueprint based on official Business Requirement Documents (BRDs). Learn how to architect your API workflows, Webhooks, and Audit databases to ensure absolute compliance with the DPDP Act.

1. Immutable Audit Logging

The Act requires every consent-related action (Grant, Update, Withdraw, Validate) to be securely logged. Relational databases with standard UPDATE/DELETE capabilities are insufficient without cryptographic tamper-proofing.

Required Metadata per Log Entry:

Log ID: UUID/Snowflake
User ID: Data Principal ID
Purpose ID: Mapping to specific policy
Action Type: ENUM (Grant/Withdraw/etc.)
Timestamp: UTC ISO 8601
Consent Status: Active/Expired/Revoked
Initiator: System / User / API
Source IP: IPv4/v6 Address
Audit Hash: SHA-256 cryptographic hash of the entire row to detect tampering.

2. Event Acknowledgement Framework

When a Data Principal withdraws consent, it is not enough to simply update the database. A highly available Event Framework must broadcast this change to all downstream Data Processors (e.g., stopping an email campaign in Mailchimp) and ensure the processor acknowledges the cessation.

sequenceDiagram participant User as Data Principal participant CMS as Consent Manager (CMP) participant API as Data Processor API User->>CMS: Triggers 'Withdraw Consent' CMS->>CMS: 1. Update status to 'Revoked' CMS->>CMS: 2. Generate Audit Hash CMS->>API: 3. Webhook Alert (Stop Processing User X) alt Processor Acknowledges API-->>CMS: 200 OK (Action Halted) CMS->>CMS: 4. Log Completion Evidence else Processor Fails/Timeouts API-->>CMS: 500 Error / Timeout CMS->>CMS: 4. Log Failure & Queue Retry CMS-->>CMS: 5. Escalate to DPO Dashboard (SLA breach) end

Note: This framework must be reused for Data Grievances, Erasure Requests, and Consent Renewals.

3. Consent Validation Engine

Before executing any data processing task (e.g., running a marketing cron job), internal systems must query a centralized Validation API. Relying on local cache is dangerous if consent was withdrawn mid-session.

// Required API Endpoint:
POST /api/v1/consent/validate

// Payload Payload:
{
  "user_id": "u_987654321",
  "purpose_id": "marketing_emails",
  "processing_context": "monthly_newsletter"
}

// Expected Output Constraints:
- Verify if consent exists
- Verify if timestamp is valid (not expired)
- Verify if status == "Active"
- Verify if Purpose aligns (Granular validation)

// Response:
{
  "valid": true,
  "validation_token": "chk_abc123" // For auditing the validation event
}