{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/github-enterprise/json-schema/github-enterprise-enterprise-token-inventory-item-schema.json",
  "title": "Enterprise Token Inventory Item",
  "description": "A credential or GitHub App installation in an enterprise's token inventory.",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/github-enterprise-enterprise-admin-api-openapi.yml#/components/schemas/enterprise-token-inventory-item",
  "type": "object",
  "required": [
    "inventory_id",
    "item_type",
    "credential_type",
    "credential_state",
    "authorization_state",
    "effective_access_state",
    "enterprise_authorized",
    "authorization_count",
    "authorized_organizations"
  ],
  "properties": {
    "inventory_id": {
      "type": "string",
      "description": "Opaque identifier for retrieving this item within the enterprise. Its value can differ between responses for the same credential."
    },
    "credential_id": {
      "type": [
        "integer",
        "null"
      ],
      "description": "The credential's ID for audit-log correlation, unique only within its `credential_type`. Null for SSH keys, GitHub App installations, and federated credentials."
    },
    "hashed_token": {
      "type": [
        "string",
        "null"
      ],
      "description": "Base64-encoded SHA-256 hash of the token, matching `hashed_token` in audit events. Null when not reported."
    },
    "fingerprint": {
      "type": [
        "string",
        "null"
      ],
      "description": "The SSH key's SHA-256 fingerprint, matching audit events. Null for other credential types."
    },
    "item_type": {
      "type": "string",
      "enum": [
        "credential",
        "token_issuer_principal"
      ]
    },
    "credential_type": {
      "type": "string",
      "enum": [
        "classic_pat",
        "oauth_app_user_token",
        "github_app_user_token",
        "fine_grained_pat",
        "ssh_key",
        "github_app_installation",
        "federated_jti"
      ]
    },
    "display_name": {
      "type": [
        "string",
        "null"
      ]
    },
    "owner": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "id": {
          "type": "integer"
        },
        "login": {
          "type": "string"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "owner_type": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "user",
        "oauth_application",
        "github_app",
        null
      ],
      "description": "The type of credential owner."
    },
    "application": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "id": {
          "type": "integer"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "credential_state": {
      "type": "string",
      "enum": [
        "active",
        "expired",
        "revoked",
        "deleted"
      ]
    },
    "authorization_state": {
      "type": "string",
      "enum": [
        "currently_authorized",
        "member_owned_only"
      ]
    },
    "effective_access_state": {
      "type": "string",
      "enum": [
        "effective",
        "not_effective",
        "unknown"
      ]
    },
    "state_reason": {
      "type": [
        "string",
        "null"
      ]
    },
    "created_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "last_used_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "expires_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "next_expires_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "credential_instance_count": {
      "type": [
        "integer",
        "null"
      ]
    },
    "enterprise_authorized": {
      "type": "boolean",
      "description": "Whether the item is authorized directly at the enterprise level."
    },
    "authorization_count": {
      "type": "integer",
      "description": "Number of authorizing organizations, plus one when `enterprise_authorized` is true."
    },
    "authorized_organizations": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "login": {
            "type": "string"
          }
        }
      }
    },
    "age_days": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Age of the credential in whole days at assembly time."
    },
    "never_expires": {
      "type": "boolean",
      "description": "Whether this is an active credential with no expiration. False for GitHub App installations and credentials with unknown expiration."
    },
    "past_expiration_policy": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "Whether the credential exceeds a configured lifetime limit or an advisory age baseline. Null when not evaluated."
    },
    "past_expiration_policy_basis": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "enforced_limit",
        "proposed_baseline",
        null
      ],
      "description": "The basis for `past_expiration_policy`: an enforced PAT lifetime limit or an advisory age baseline."
    },
    "expiry_unknown": {
      "type": "boolean",
      "description": "Whether the credential's expiration could not be determined."
    },
    "scopes": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string"
      },
      "description": "OAuth scopes recorded for the token. Null when not reported for the credential type."
    },
    "permissions": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "type": "string"
      },
      "description": "Permissions by resource for fine-grained PATs and GitHub App installations. Null when not reported; an empty object means no recorded permissions."
    },
    "repository_selection": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "all",
        "subset",
        "none",
        null
      ],
      "description": "Repository selection for the credential. Null when not reported; `none` means no repositories are selected."
    }
  }
}