{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/policyforge-co/json-schema/policyforge-co-consent-create-request-schema.json",
  "title": "ConsentCreateRequest",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/policyforge-co-openapi.json#/components/schemas/ConsentCreateRequest",
  "type": "object",
  "required": [
    "user_id",
    "policy_version",
    "consents"
  ],
  "properties": {
    "user_id": {
      "type": "string",
      "description": "Your website visitor's unique identifier"
    },
    "policy_version": {
      "type": "string",
      "description": "Version of the privacy policy the consent applies to"
    },
    "consents": {
      "type": "object",
      "additionalProperties": {
        "type": "boolean"
      },
      "description": "Map of consent categories to accepted/rejected status"
    },
    "ip_address": {
      "type": "string",
      "description": "Visitor's IP address (for audit trail)"
    },
    "user_agent": {
      "type": "string",
      "description": "Visitor's browser user agent (for audit trail)"
    },
    "policy_id": {
      "type": "string",
      "format": "uuid",
      "description": "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=...`."
    }
  }
}