{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/uploads-sh/json-schema/uploads-sh-usage-schema.json",
  "title": "Usage",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/uploads-sh-openapi.json#/components/schemas/Usage",
  "type": "object",
  "required": [
    "workspace",
    "bytes",
    "objects",
    "uploadsInPeriod",
    "scopes",
    "plan",
    "storageBudgetBasis",
    "storage"
  ],
  "properties": {
    "workspace": {
      "type": "string"
    },
    "bytes": {
      "type": "integer",
      "minimum": 0
    },
    "objects": {
      "type": "integer",
      "minimum": 0
    },
    "sharedBytes": {
      "type": "integer",
      "minimum": 0
    },
    "sharedObjects": {
      "type": "integer",
      "minimum": 0
    },
    "uploadsInPeriod": {
      "type": "integer",
      "minimum": 0
    },
    "periodStart": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}$",
      "description": "Current billing period as `YYYY-MM` (UTC)."
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "scopes": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "plan": {
      "type": "string"
    },
    "maxStorageBytes": {
      "type": "integer",
      "minimum": 0
    },
    "storageRemainingBytes": {
      "type": "integer",
      "minimum": 0
    },
    "maxUploadsPerPeriod": {
      "type": "integer",
      "minimum": 0
    },
    "uploadsRemaining": {
      "type": "integer",
      "minimum": 0
    },
    "storageBudgetBasis": {
      "type": "string",
      "enum": [
        "total",
        "shared"
      ],
      "description": "Which byte count the storage cap applies to. `shared` for a workspace on its own bucket, where only hosted residue is metered."
    },
    "storage": {
      "type": "object",
      "required": [
        "mode",
        "fallbackLanes",
        "health"
      ],
      "properties": {
        "mode": {
          "type": "string",
          "enum": [
            "shared",
            "byo"
          ]
        },
        "fallbackLanes": {
          "type": "integer",
          "minimum": 0
        },
        "health": {
          "type": "object",
          "required": [
            "ok"
          ],
          "properties": {
            "ok": {
              "type": "boolean"
            },
            "code": {
              "type": "string",
              "enum": [
                "auth",
                "bucket_missing",
                "unreachable"
              ]
            },
            "message": {
              "type": "string"
            },
            "since": {
              "type": "string",
              "format": "date-time"
            }
          }
        }
      }
    }
  }
}