{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/tokencanopy-com/json-schema/tokencanopy-com-grant-out-schema.json",
  "title": "GrantOut",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/tokencanopy-com-openapi.json#/components/schemas/GrantOut",
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^grn_[a-f0-9]{16}$",
      "title": "Id"
    },
    "drive_id": {
      "type": "string",
      "pattern": "^drv_[a-f0-9]{16}$",
      "title": "Drive Id"
    },
    "resource_type": {
      "type": "string",
      "enum": [
        "drive",
        "folder",
        "artifact"
      ],
      "title": "Resource Type"
    },
    "resource_id": {
      "type": "string",
      "title": "Resource Id"
    },
    "principal_type": {
      "type": "string",
      "enum": [
        "agent",
        "user",
        "service",
        "workspace",
        "public"
      ],
      "title": "Principal Type"
    },
    "principal_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Principal Id"
    },
    "role": {
      "type": "string",
      "enum": [
        "viewer",
        "editor",
        "manager"
      ],
      "title": "Role"
    },
    "revision": {
      "type": "string",
      "pattern": "^rev_[a-f0-9]{16}$",
      "title": "Revision"
    },
    "state": {
      "type": "string",
      "enum": [
        "active",
        "revoked",
        "expired"
      ],
      "title": "State"
    },
    "expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Expires At"
    },
    "revoked_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Revoked At"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At"
    }
  },
  "type": "object",
  "required": [
    "id",
    "drive_id",
    "resource_type",
    "resource_id",
    "principal_type",
    "principal_id",
    "role",
    "revision",
    "state",
    "expires_at",
    "revoked_at",
    "created_at"
  ]
}