{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/fwozen-com/json-schema/fwozen-com-api-key-page-schema.json",
  "title": "ApiKeyPage",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/fwozen-com-api-keys-api-openapi.yml#/components/schemas/ApiKeyPage",
  "type": "object",
  "properties": {
    "data": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ApiKey"
      }
    },
    "nextCursor": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "data",
    "nextCursor"
  ],
  "additionalProperties": false,
  "$defs": {
    "Actor": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "user",
            "api_key",
            "slack_user",
            "scheduler",
            "system",
            "github_user"
          ]
        },
        "id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "displayName": {
          "type": "string"
        },
        "githubLogin": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "slackUserId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "impersonatorId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "apiKeyKind": {
          "default": null,
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "human",
                "agent"
              ]
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "type",
        "id",
        "displayName",
        "githubLogin",
        "slackUserId",
        "impersonatorId",
        "apiKeyKind"
      ],
      "additionalProperties": false
    },
    "ApiKey": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^key_[1-9A-HJ-NP-Za-km-z]{16}$"
        },
        "name": {
          "type": "string"
        },
        "keyPrefix": {
          "type": "string"
        },
        "scopes": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "freeze:read",
              "freeze:write",
              "schedule:read",
              "schedule:write",
              "exception:read",
              "exception:write",
              "repo:read",
              "repo:write",
              "audit:read",
              "billing:read",
              "billing:write"
            ]
          }
        },
        "environment": {
          "type": "string",
          "enum": [
            "live",
            "test"
          ]
        },
        "kind": {
          "type": "string",
          "enum": [
            "human",
            "agent"
          ]
        },
        "createdBy": {
          "$ref": "#/$defs/Actor"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
        },
        "expiresAt": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
            },
            {
              "type": "null"
            }
          ]
        },
        "lastUsedAt": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
            },
            {
              "type": "null"
            }
          ]
        },
        "revokedAt": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
            },
            {
              "type": "null"
            }
          ]
        },
        "rotatedAt": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
            },
            {
              "type": "null"
            }
          ]
        },
        "replacesKeyId": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^key_[1-9A-HJ-NP-Za-km-z]{16}$"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "name",
        "keyPrefix",
        "scopes",
        "environment",
        "kind",
        "createdBy",
        "createdAt",
        "expiresAt",
        "lastUsedAt",
        "revokedAt",
        "rotatedAt",
        "replacesKeyId"
      ],
      "additionalProperties": false
    }
  }
}