{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/knoxcall/json-schema/knoxcall-client-credential-created-schema.json",
  "title": "ClientCredentialCreated",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/knoxcall-clients-api-openapi.yml#/components/schemas/ClientCredentialCreated",
  "allOf": [
    {
      "$ref": "#/$defs/ClientCredential"
    },
    {
      "type": "object",
      "properties": {
        "reveal": {
          "type": "object",
          "description": "One-shot PEM bundle, present only for `mtls_thumbprint` with `mode: issue`. **Returned exactly once and never stored.**",
          "properties": {
            "certificate_pem": {
              "type": "string",
              "description": "The issued client certificate (PEM)."
            },
            "private_key_pem": {
              "type": "string",
              "description": "The certificate's private key (PEM). **Shown only in this response.**"
            },
            "ca_chain_pem": {
              "type": "string",
              "description": "The issuing CA chain (PEM)."
            }
          }
        }
      }
    }
  ],
  "$defs": {
    "ClientCredential": {
      "type": "object",
      "description": "A credential attached to a client. Secret material (HMAC secrets, private keys) is redacted from `data`.",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "client_id": {
          "type": "string",
          "format": "uuid",
          "description": "The client this credential belongs to."
        },
        "tenant_id": {
          "type": "string",
          "format": "uuid"
        },
        "kind": {
          "type": "string",
          "enum": [
            "ip",
            "mtls_thumbprint",
            "signature_hmac",
            "signature_ed25519",
            "machine_id",
            "workload_identity"
          ],
          "description": "The credential kind. Creatable in v1: `ip` and `mtls_thumbprint`."
        },
        "label": {
          "type": [
            "string",
            "null"
          ],
          "description": "Human-readable label."
        },
        "data": {
          "type": "object",
          "additionalProperties": true,
          "description": "Kind-specific data. Secret fields (`secret_ct`, `private_key_pem`) are stripped from responses."
        },
        "enabled": {
          "type": "boolean"
        },
        "expires_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "Expiry timestamp (set automatically for issued mTLS certificates)."
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time"
        },
        "last_matched_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "When this credential last matched an incoming request."
        }
      }
    }
  }
}