{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/knoxcall/json-schema/knoxcall-oauth-client-schema.json",
  "title": "OAuthClient",
  "description": "An OAuth 2.1 client as returned in list responses.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/knoxcall-oauth-clients-api-openapi.yml#/components/schemas/OAuthClient",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "client_id": {
      "type": "string",
      "description": "Public client identifier used in token requests."
    },
    "name": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "enum": [
        "confidential",
        "public"
      ],
      "description": "Confidential clients hold a `client_secret`; public clients do not."
    },
    "grant_types": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "client_credentials",
          "authorization_code",
          "refresh_token",
          "urn:ietf:params:oauth:grant-type:token-exchange",
          "urn:ietf:params:oauth:grant-type:device_code"
        ]
      },
      "description": "Enabled OAuth grant types."
    },
    "allowed_scopes": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "redirect_uris": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Registered redirect URIs (authorization-code flow). Loopback URIs (http://127.0.0.1/... or http://[::1]/...) match on any port per RFC 8252 §7.3."
    },
    "system_role": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "cli",
        null
      ],
      "description": "Set to `cli` on the tenant's auto-provisioned KnoxCall CLI client (created by `knoxcall login`). System clients cannot be updated or deleted via the API."
    },
    "require_dpop": {
      "type": "boolean",
      "description": "Whether tokens minted for this client must be DPoP-bound."
    },
    "require_pkce": {
      "type": "boolean",
      "description": "Whether the authorization-code flow requires PKCE."
    },
    "token_format": {
      "type": "string",
      "enum": [
        "opaque"
      ],
      "description": "Format of access tokens minted for this client. Always `opaque` (random `kc_` tokens checked against KnoxCall on every call). The RFC 9068 `jwt` format was withdrawn: no KnoxCall resource server ever accepted it."
    },
    "active": {
      "type": "boolean"
    },
    "revoked_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "last_used_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "source_api_key_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "The API key this client was mirrored from, if it was auto-created alongside a key."
    },
    "source_key_type": {
      "type": [
        "string",
        "null"
      ],
      "description": "Key type of the source API key, if any."
    }
  }
}