{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/arena-predictions-com/json-schema/arena-predictions-com-key-list-response-schema.json",
  "title": "KeyListResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/arena-predictions-com-api-keys-api-openapi.yml#/components/schemas/KeyListResponse",
  "type": "object",
  "required": [
    "keys",
    "count",
    "usage"
  ],
  "properties": {
    "keys": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/KeyView"
      }
    },
    "count": {
      "type": "integer",
      "minimum": 0
    },
    "usage": {
      "type": [
        "object",
        "null"
      ],
      "description": "The account's plan and this month's requests, or null when they could not be read.",
      "properties": {
        "tier": {
          "type": "string",
          "enum": [
            "none",
            "basic",
            "builder",
            "desk",
            "enterprise"
          ]
        },
        "month": {
          "type": "object",
          "properties": {
            "limit": {
              "type": "integer"
            },
            "used": {
              "type": "integer"
            },
            "resetsAt": {
              "type": [
                "string",
                "null"
              ],
              "format": "date-time"
            }
          }
        },
        "minuteLimit": {
          "type": "integer"
        },
        "enforced": {
          "type": "boolean"
        }
      }
    }
  },
  "$defs": {
    "KeyView": {
      "type": "object",
      "required": [
        "id",
        "label",
        "tokenPrefix",
        "scopes",
        "status",
        "createdAt",
        "lastUsedAt",
        "expiresAt",
        "revokedAt",
        "createdVia",
        "rotatedFrom",
        "rotatedAt",
        "requestsThisMonth"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "label": {
          "type": "string",
          "maxLength": 64
        },
        "tokenPrefix": {
          "type": "string",
          "description": "First 16 characters of the token, for matching a row to a key. Never the token."
        },
        "scopes": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "records:read",
              "portfolio:read",
              "markets:read",
              "trade:write",
              "trade:write:kalshi",
              "trade:write:poly-intl",
              "trade:write:prophetx"
            ]
          }
        },
        "status": {
          "type": "string",
          "enum": [
            "active",
            "rotating",
            "revoked",
            "expired"
          ],
          "description": "rotating: replaced by a rotation and still inside its grace period (it works until expiresAt)."
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "lastUsedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "Updated at most once an hour."
        },
        "expiresAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "revokedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "createdVia": {
          "type": "string",
          "enum": [
            "web",
            "cli"
          ],
          "description": "web: Settings. cli: arena keys."
        },
        "rotatedFrom": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid",
          "description": "The key this one replaced by rotation."
        },
        "rotatedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "When this key was rotated."
        },
        "requestsThisMonth": {
          "type": "integer",
          "minimum": 0,
          "description": "Keyed requests counted against this key this month (UTC)."
        }
      }
    }
  }
}