{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/policyforge-co/json-schema/policyforge-co-consent-record-schema.json",
  "title": "ConsentRecord",
  "description": "A single consent record as returned by the list endpoint.",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/policyforge-co-openapi.json#/components/schemas/ConsentRecord",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "user_id": {
      "type": "string",
      "description": "End-user / visitor identifier (this is `end_user_id` in the database)."
    },
    "policy_version": {
      "type": "string",
      "description": "Policy version stamp captured at consent time."
    },
    "consents": {
      "type": "object",
      "additionalProperties": {
        "type": "boolean"
      }
    },
    "ip_address": {
      "type": [
        "string",
        "null"
      ]
    },
    "user_agent": {
      "type": [
        "string",
        "null"
      ]
    },
    "source": {
      "type": "string",
      "enum": [
        "banner",
        "api"
      ],
      "description": "`banner` = recorded via the embeddable cookie banner. `api` = recorded via POST /api/v1/consent or a hosted-policy 'I Agree' click."
    },
    "banner_config_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "Set when `source` is `banner`. `null` for API-recorded consents."
    },
    "policy_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "Set when the consent is tied to a specific PolicyForge policy (cookie banner with a linked policy, hosted-policy 'I Agree', or API consent that included a policy_id)."
    },
    "recorded_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}