{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/nopaque-co-uk/json-schema/nopaque-co-uk-usage-summary-schema.json",
  "title": "UsageSummary",
  "description": "MCP-agent-friendly subset of `BillingInfo`. Returned by\n`GET /workspaces/{workspaceId}/usage` on the api-key gateway\n(Phase 76 — MCP-02 tool `getWorkspaceUsage`). Does NOT include\nStripe-internal fields, checkout URLs, or PII.\n",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/nopaque-co-uk-billing-api-openapi.yml#/components/schemas/UsageSummary",
  "type": "object",
  "required": [
    "workspaceId",
    "subscriptionTier",
    "pools",
    "tokens"
  ],
  "properties": {
    "workspaceId": {
      "type": "string",
      "format": "uuid"
    },
    "subscriptionTier": {
      "type": "string",
      "enum": [
        "free",
        "starter",
        "team",
        "enterprise"
      ]
    },
    "currentPeriodEnd": {
      "type": "string",
      "format": "date-time",
      "description": "ISO8601 timestamp when the current billing period ends. Free-tier pools reset at this time."
    },
    "pools": {
      "type": "object",
      "required": [
        "testing",
        "loadTesting",
        "mapping",
        "s2s",
        "s2stest"
      ],
      "properties": {
        "testing": {
          "$ref": "#/$defs/UsagePool"
        },
        "loadTesting": {
          "$ref": "#/$defs/UsagePool"
        },
        "mapping": {
          "$ref": "#/$defs/UsagePool"
        },
        "s2s": {
          "$ref": "#/$defs/UsagePool"
        },
        "s2stest": {
          "$ref": "#/$defs/UsagePool"
        }
      }
    },
    "tokens": {
      "type": "object",
      "required": [
        "remainingTokens",
        "currentPeriodTokensUsed"
      ],
      "properties": {
        "remainingTokens": {
          "type": "integer",
          "minimum": 0,
          "description": "Total LLM-enrichment tokens remaining (free + purchased)."
        },
        "currentPeriodTokensUsed": {
          "type": "integer",
          "minimum": 0
        }
      }
    }
  },
  "$defs": {
    "UsagePool": {
      "type": "object",
      "description": "Per-pool usage snapshot. Free + purchased seconds remaining, plus\nseconds consumed in the current billing period.\n",
      "required": [
        "freeRemainingSecs",
        "purchasedRemainingSecs",
        "currentPeriodUsedSecs"
      ],
      "properties": {
        "freeRemainingSecs": {
          "type": "integer",
          "minimum": 0,
          "description": "Free-tier seconds remaining for this period (resets at `currentPeriodEnd`)."
        },
        "purchasedRemainingSecs": {
          "type": "integer",
          "minimum": 0,
          "description": "Purchased-pack seconds remaining (carries over between periods)."
        },
        "currentPeriodUsedSecs": {
          "type": "integer",
          "minimum": 0,
          "description": "Seconds consumed in the current period."
        }
      }
    }
  }
}