{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/nopaque-co-uk/json-schema/nopaque-co-uk-entitlement-schema.json",
  "title": "Entitlement",
  "description": "Entitlement check result from `GET /workspaces/{workspaceId}/billing/entitlement`.\nResponse shape varies by activity `type`:\n- For `s2s`: returns `s2sAvailable` (minutes) and S2S-specific suspension fields.\n- For `s2stest`: returns `s2stestAvailable`.\n- For `testing`/`loadTesting`/`mapping`: returns `availableMinutes` breakdown.\n\nReason codes when `allowed=false`: `S2S_SUSPENDED`, `NO_S2S_MINUTES`,\n`FREE_TIER_EXHAUSTED`, `WORKSPACE_LIMIT_EXCEEDED`, `PAYMENT_PAST_DUE`, `DISPUTE_LOCK`,\netc. The HTTP status is 402 for billing-blockers and 200 when allowed. A paused\nworkspace (`PAYMENT_PAST_DUE`, `DISPUTE_LOCK`) is refused on every tier except beta,\nincluding its free allowance.\nRun-start endpoints refuse a custom-deal workspace with `DEAL_NOT_STARTED`, `DEAL_ENDED` or\n`QUOTA_EXHAUSTED` (see `BillingError`); this endpoint does not report the custom-deal state yet.\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/Entitlement",
  "type": "object",
  "required": [
    "allowed",
    "tier",
    "requestedType"
  ],
  "properties": {
    "allowed": {
      "type": "boolean"
    },
    "reason": {
      "type": "string",
      "description": "Reason code when `allowed=false`. Stable machine-readable string."
    },
    "httpHint": {
      "type": "integer",
      "description": "HTTP status the API/job orchestrator should mirror on its own response (typically 402 for billing-blockers)."
    },
    "tier": {
      "type": "string",
      "enum": [
        "free",
        "starter",
        "team",
        "enterprise"
      ]
    },
    "requestedType": {
      "type": "string",
      "description": "The `type` query parameter value, echoed for client correlation."
    },
    "estimatedSeconds": {
      "type": "integer",
      "description": "Echoed if supplied by caller."
    },
    "availableMinutes": {
      "type": "object",
      "description": "Per-pool availability breakdown for non-AVE types.",
      "additionalProperties": {
        "type": "integer"
      }
    },
    "s2sAvailable": {
      "type": "integer",
      "description": "Available `s2s` minutes (purchased pool only — `s2s` has no free tier)."
    },
    "s2stestAvailable": {
      "type": "integer",
      "description": "Available `s2stest` minutes (free + purchased)."
    }
  }
}