{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/sourcefinch-com/json-schema/sourcefinch-com-usage-schema.json",
  "title": "Usage",
  "description": "The workspace's plan, trial, limits and this month's usage: check before creating sources or queueing runs.",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/sourcefinch-com-openapi.json#/components/schemas/Usage",
  "type": "object",
  "properties": {
    "plan": {
      "type": "string",
      "description": "The plan in force now (during a trial, the trial plan)"
    },
    "subscription": {
      "type": "object",
      "properties": {
        "tier": {
          "type": "string"
        },
        "status": {
          "type": [
            "string",
            "null"
          ]
        },
        "current_period_end": {
          "type": [
            "string",
            "null"
          ],
          "description": "ISO-8601 timestamp (UTC)"
        },
        "cancel_at_period_end": {
          "type": "boolean"
        }
      },
      "required": [
        "tier",
        "status",
        "current_period_end",
        "cancel_at_period_end"
      ],
      "additionalProperties": false
    },
    "trial": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "plan": {
          "type": "string"
        },
        "started_at": {
          "type": "string",
          "description": "ISO-8601 timestamp (UTC)"
        },
        "ends_at": {
          "type": "string",
          "description": "ISO-8601 timestamp (UTC)"
        },
        "ended_at": {
          "type": [
            "string",
            "null"
          ],
          "description": "ISO-8601 timestamp (UTC)"
        },
        "outcome": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "plan",
        "started_at",
        "ends_at",
        "ended_at",
        "outcome"
      ],
      "additionalProperties": false
    },
    "retention_grace_until": {
      "description": "After a downgrade, over-limit items stay paused (not deleted) until then",
      "type": [
        "string",
        "null"
      ]
    },
    "runs": {
      "type": "object",
      "properties": {
        "used": {
          "type": "integer"
        },
        "allowance": {
          "type": "integer",
          "description": "Monthly runs in the plan plus run packs bought this month"
        },
        "packs": {
          "type": "integer"
        },
        "soft_overage": {
          "type": "boolean"
        },
        "scheduled_ceiling": {
          "type": "integer"
        },
        "manual_ceiling": {
          "type": "integer"
        }
      },
      "required": [
        "used",
        "allowance",
        "packs",
        "soft_overage",
        "scheduled_ceiling",
        "manual_ceiling"
      ],
      "additionalProperties": false
    },
    "sources": {
      "$ref": "#/$defs/UsageMeter"
    },
    "api_keys": {
      "$ref": "#/$defs/UsageMeter"
    },
    "seats": {
      "$ref": "#/$defs/UsageMeter"
    },
    "storage_bytes": {
      "$ref": "#/$defs/UsageMeter"
    },
    "limits": {
      "type": "object",
      "additionalProperties": {},
      "description": "Every limit of the plan in force (schedule floor, retention days, browser mode, origins per day, …)"
    },
    "upgrade_url": {
      "type": "string"
    }
  },
  "required": [
    "plan",
    "subscription",
    "trial",
    "retention_grace_until",
    "runs",
    "sources",
    "api_keys",
    "seats",
    "storage_bytes",
    "limits",
    "upgrade_url"
  ],
  "additionalProperties": false,
  "$defs": {
    "UsageMeter": {
      "type": "object",
      "properties": {
        "used": {
          "type": "integer"
        },
        "limit": {
          "description": "null: unlimited",
          "type": [
            "integer",
            "null"
          ]
        }
      },
      "required": [
        "used",
        "limit"
      ],
      "description": "Current use against the plan's limit",
      "additionalProperties": false
    }
  }
}