{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/orq/json-schema/orq-piiredaction-plugin-schema.json",
  "title": "PII redaction plugin",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/orq-completions-api-openapi.yml#/components/schemas/PIIRedactionPlugin",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "enum": [
        "pii_redaction"
      ],
      "description": "PII redaction plugin."
    },
    "language": {
      "type": "string",
      "description": "Detector language. Accepts \"auto\" to detect the language per request; GET /v2/pii/capabilities lists the concrete languages and does not include \"auto\". Omitting the field defaults to \"auto\"."
    },
    "regions": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Region codes selecting whole regions of coverage (e.g. \"nl\", \"gb\"). Every entity type those regions cover is redacted, alongside the base catalog. [\"all\"] is exclusive, and leaving both this and entities empty also runs every region, so selecting nothing is the widest request rather than the narrowest. Combines with entities: the two selections are unioned, so entities adds types on top of the region coverage."
    },
    "entities": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "The entity types to redact. A named type is redacted even when it belongs to a region, so a region's types can be selected individually without naming the region. On its own this is a strict allowlist; alongside regions it adds to the region coverage. See GET /v2/pii/capabilities for valid types."
    },
    "entity_thresholds": {
      "type": "object",
      "additionalProperties": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      },
      "description": "Per-entity confidence cutoff overrides in [0,1]. Tunes confidence only and never changes which types are redacted, so every key must also appear in entities."
    },
    "threshold": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "description": "Baseline confidence cutoff applied to every entity type without a per-entity override."
    },
    "on_failure": {
      "type": "string",
      "enum": [
        "block",
        "passthrough"
      ],
      "description": "Behaviour when detection fails."
    }
  },
  "required": [
    "id"
  ],
  "additionalProperties": false
}