Get Consent Audit Trail
Consent
Get Consent Audit Trail
Retrieve paginated audit log of all consent changes for a user
GET
Get Consent Audit Trail
Overview
Retrieves the complete audit trail of all consent changes for a user. Essential for compliance reporting, regulatory audits, and investigating consent history.The audit trail is immutable - all consent changes are permanently recorded with complete before/after snapshots for regulatory compliance.
Endpoint
Headers
| Header | Required | Description |
|---|---|---|
x-client-key | ✅ | Your public API key |
x-us-env | ❌ | Set to true for US region routing |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
userId | string | ✅ | User identifier to retrieve audit trail for |
Query Parameters
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
limit | integer | ❌ | Number of records per page (max 100) | 50 |
offset | integer | ❌ | Starting position for pagination | 0 |
Response
Audit Record Structure
| Field | Type | Description |
|---|---|---|
auditId | string | Unique identifier for this audit record |
action | string | Action type: created, updated, revoked |
timestamp | string (ISO 8601) | When the change occurred |
consentSetId | string (UUID) | Consent set containing this change |
changes.before | object|null | State before change (null for creation) |
changes.after | object | State after change |
metadata | object | Additional context (IP, user agent, etc.) |
Action Types
| Action | Description | Before State | After State |
|---|---|---|---|
created | Initial consent creation | null | Consent record |
updated | Consent status changed | Original status | New status |
revoked | Consent was revoked | granted status | revoked status |
Pagination
Uselimit and offset to paginate through large audit trails:
Code Examples
TypeScript - Basic Audit Retrieval
TypeScript - Export for Compliance
Python
cURL
Use Cases
Regulatory Audits
Regulatory Audits
Generate comprehensive audit reports for regulators:
Data Subject Access Requests (DSAR)
Data Subject Access Requests (DSAR)
Fulfill user requests for their consent history:
Consent Timeline Visualization
Consent Timeline Visualization
Display user’s consent history in UI:
Legal Defense
Legal Defense
Prove consent was properly obtained:
Best Practices
Performance: For large audit trails, use pagination and process records in batches rather than loading all at once.
Related Endpoints
Get User Consent Status
Check current consent status
Revoke Consent
Create revocation audit records
Compliance Guide
Regulatory compliance best practices
Implementation Guide
Full integration guide