{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/consentstack-io/json-schema/consentstack-io-post-functions-v1-consent-request-schema.json",
  "title": "PostFunctionsV1ConsentRequest",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_ae-authored/consentstack-io-openapi-generated.yml#/components/schemas/PostFunctionsV1ConsentRequest",
  "type": "object",
  "properties": {
    "site_key": {
      "type": "string",
      "description": "Your public site key."
    },
    "anon_id": {
      "type": "string",
      "description": "A client-generated anonymous visitor ID (max 100 chars). Hashed server-side before storage."
    },
    "categories": {
      "type": "object",
      "description": "A map of category IDs to booleans representing the visitor's consent choices."
    },
    "event_type": {
      "type": "string",
      "description": "One of initial (first interaction), update (changed preferences), or impression (banner was shown)."
    },
    "event_action": {
      "type": "string",
      "description": "The action taken: opt_in, opt_out, partial, or acknowledge."
    },
    "config_version": {
      "type": "number",
      "description": "The config version the visitor saw (for audit trail)."
    },
    "region": {
      "type": "string",
      "description": "The resolved region ID at the time of consent."
    },
    "consent_model": {
      "type": "string",
      "description": "The active consent model: opt_in, opt_out, notice, or notice_required."
    },
    "regulation": {
      "type": "string",
      "description": "The regulation that applied (e.g. gdpr, us_state_laws)."
    },
    "time_to_action_ms": {
      "type": "number",
      "description": "Milliseconds between banner display and visitor action."
    },
    "interaction": {
      "type": "string",
      "description": "How the visitor interacted (e.g. accept_all, reject_all, save_preferences)."
    },
    "preferences_opened": {
      "type": "boolean",
      "description": "Whether the visitor opened the preferences panel before deciding."
    },
    "banner_load_time_ms": {
      "type": "number",
      "description": "Milliseconds the banner took to render."
    },
    "banner_position": {
      "type": "string",
      "description": "Banner layout position (e.g. bottom-full, center-modal)."
    },
    "page_url": {
      "type": "string",
      "description": "The page URL where consent was given."
    },
    "sdk_version": {
      "type": "string",
      "description": "The SDK version that sent the request."
    },
    "language": {
      "type": "string",
      "description": "The visitor's browser language."
    },
    "resolved_language": {
      "type": "string",
      "description": "The language the banner was displayed in."
    }
  },
  "required": [
    "site_key",
    "anon_id",
    "categories",
    "event_type"
  ]
}