Prompt
How do I store consent timestamps and versions for audits?
Latest observation
Oct 29, 2026
OpenAI APIWeb search: off
For auditability, store consent as an event record rather than just a yes/no flag.
What to store
At minimum, capture:
- User/subject ID
- Consent type/purpose
e.g. marketing emails, data sharing, analytics - Consent status
granted / withdrawn / denied - Timestamp of the event
- Consent version
version of the policy/text the user saw and agreed to - Source/channel
web, mobile app, email, paper form, call center - Locale/language shown to the user
- Proof metadata
IP address, user agent, device ID, form/page ID, or document ID - Actor
the user, admin, or system action that recorded it - Revocation timestamp and reason, if withdrawn
Recommended data model
Use an append-only table like:
consent_events (
id UUID PRIMARY KEY,
user_id UUID NOT NULL,
consent_type VARCHAR(100) NOT NULL,
status VARCHAR(20) NOT NULL, -- granted, withdrawn, denied
consent_version VARCHAR(50) NOT NULL,
occurred_at TIMESTAMP WITH TIME ZONE NOT NULL,
source VARCHAR(50),
language_code VARCHAR(10),
ip_address INET,
user_agent TEXT,
document_hash TEXT,
recorded_by UUID,
created_at TIMESTAMP WITH TIME ZONE DEFAULT now()
)
Then you can derive the current state from the latest event per consent type.
Best practices
- Never overwrite old consent records; append new events instead.
- Version the consent text itself, and store the version or hash the user accepted.
- Keep immutable audit logs separate from business-state tables.
- Record withdrawals as explicit events, not deletions.
- Link to the exact text displayed (URL, document ID, or content hash).
- Use UTC timestamps with timezone info.
- Protect integrity with restricted access, write-once storage, or signing/hashing if needed.
Example audit trail
2026-01-10T14:22:31Z— granted marketing consent, versionv3, web, IP203.0.113.102026-03-02T09:11:05Z— withdrawn marketing consent, versionv3, mobile app
If you want stronger audit evidence
Consider storing:
- a SHA-256 hash of the consent text
- a PDF snapshot of the form or policy
- a digital signature or tamper-evident log entry
If you want, I can give you:
- a PostgreSQL schema,
- an event-sourcing design, or
- a GDPR/CCPA-oriented consent audit checklist.