{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/aginera-ai/json-schema/aginera-ai-usage-event-list-schema.json",
  "title": "UsageEventList",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/aginera-ai-usage-api-openapi.yml#/components/schemas/UsageEventList",
  "type": "object",
  "properties": {
    "next_cursor": {
      "type": [
        "string",
        "null"
      ]
    },
    "has_more": {
      "type": "boolean"
    },
    "data": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/UsageEvent"
      }
    }
  },
  "required": [
    "next_cursor",
    "has_more",
    "data"
  ],
  "$defs": {
    "ClientId": {
      "type": [
        "string",
        "null"
      ],
      "pattern": "^(pc|oc)_[0-9A-Za-z]{22}$"
    },
    "UsageEvent": {
      "type": "object",
      "properties": {
        "occurred_at": {
          "type": "string",
          "format": "date-time"
        },
        "request_id": {
          "type": "string"
        },
        "client_id": {
          "$ref": "#/$defs/ClientId"
        },
        "surface": {
          "type": "string",
          "enum": [
            "rest",
            "mcp"
          ]
        },
        "agent": {
          "type": [
            "string",
            "null"
          ]
        },
        "operation": {
          "type": "string"
        },
        "status_code": {
          "type": [
            "integer",
            "null"
          ]
        },
        "error_code": {
          "type": [
            "string",
            "null"
          ]
        },
        "latency_ms": {
          "type": "integer"
        },
        "units": {
          "type": "number"
        },
        "credits": {
          "type": "number"
        },
        "end_customer_ref": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "occurred_at",
        "request_id",
        "client_id",
        "surface",
        "agent",
        "operation",
        "status_code",
        "error_code",
        "latency_ms",
        "units",
        "credits",
        "end_customer_ref"
      ]
    }
  }
}