{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/knoxcall/json-schema/knoxcall-vault-schema.json",
  "title": "Vault",
  "description": "A tokenization vault with its own encryption key.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/knoxcall-vaults-api-openapi.yml#/components/schemas/Vault",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "tenant_id": {
      "type": "string",
      "format": "uuid"
    },
    "name": {
      "type": "string"
    },
    "token_format": {
      "type": "string",
      "enum": [
        "generic",
        "pan",
        "ssn",
        "email"
      ],
      "description": "Token shape: `generic` (`tok_` Crockford base32) or a format-preserving format."
    },
    "crypto_key_id": {
      "type": "string",
      "format": "uuid",
      "description": "The vault's dedicated encryption key."
    },
    "custody_mode": {
      "type": "string",
      "enum": [
        "managed",
        "dual"
      ],
      "description": "`managed` — KnoxCall holds the key; `dual` — tokens are `kc:` ciphertexts requiring both parties to detokenize."
    },
    "default_ttl_seconds": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Default token lifetime. Null means tokens never expire by default."
    },
    "metadata_jsonb": {
      "type": "object",
      "additionalProperties": true,
      "description": "Free-form vault metadata."
    },
    "description": {
      "type": [
        "string",
        "null"
      ]
    },
    "enabled": {
      "type": "boolean"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    },
    "created_by": {
      "type": [
        "string",
        "null"
      ],
      "description": "The API key or user that created the vault."
    },
    "sandbox": {
      "type": "boolean",
      "description": "Whether this vault lives in Test (sandbox) mode."
    },
    "allowed_destinations": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string"
      },
      "description": "Destination binding. `null` means unrestricted. A non-empty array is the set of upstream hosts this vault's values may be sent to via `POST /v1/proxy` or a Route; a send to any other host is refused with `403 vault_destination_refused` before the value is decrypted. Each entry is an exact hostname or a `*.suffix` wildcard. A wildcard is a suffix test: `*.stripe.com` matches `api.stripe.com` but not the bare apex `stripe.com` and not `api.stripe.com.evil.com`. **Required (non-empty) for `token_format` `pan`**, which additionally refuses every plain-read path — a card number leaves a `pan` vault only through detokenize-and-send."
    }
  }
}