Consent

Record user consent

Record a website visitor's consent preferences. Use this to track which cookie/data categories a visitor has accepted or rejected. The consent record is stored and can be retrieved later for compliance audits.

post/api/v1/consent

Request

  • Base URL: https://policyforge.co
  • URL: https://policyforge.co/api/v1/consent
  • Auth: HTTP bearer

Request body

user_idstring required

Your website visitor's unique identifier

policy_versionstring required

Version of the privacy policy the consent applies to

consentsobject required

Map of consent categories to accepted/rejected status

ip_addressstring

Visitor's IP address (for audit trail)

user_agentstring

Visitor's browser user agent (for audit trail)

policy_idstring uuid

Optional. UUID of a PolicyForge policy this consent ties to. Must be a policy owned by the same account as the API key, or the request returns 404. Setting this lets the consent show up under the policy's analytics card and be filterable via GET /api/v1/consent?policy_id=....

Example request

{
  "user_id": "visitor_abc123",
  "policy_version": "v2.1",
  "consents": {
    "essential": true,
    "analytics": true,
    "marketing": false
  }
}

Response

Consent recorded

idstring
user_idstring
policy_versionstring
policy_idstring uuid nullable

Echoes the policy_id from the request, or null if none was provided.

consentsobject
recorded_atstring date-time
statusstring

Example response

{
  "status": "recorded"
}

Changes

No recorded changes to this operation across all 1 revision of this API.