{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/logbrew/json-schema/logbrew-billing-overview-response-schema.json",
  "title": "BillingOverviewResponse",
  "description": "Authenticated billing and per-signal usage overview.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/logbrew-billing-api-openapi.yml#/components/schemas/BillingOverviewResponse",
  "properties": {
    "checkout_available": {
      "description": "Whether fixed-price checkout is connected.",
      "type": "boolean"
    },
    "management_available": {
      "description": "Whether a provider management session can be created.",
      "type": "boolean"
    },
    "meters": {
      "description": "Complete fixed-order metering receipt.",
      "items": {
        "$ref": "#/$defs/BillingMeterResponse"
      },
      "type": "array"
    },
    "offer": {
      "anyOf": [
        {
          "$ref": "#/$defs/BillingOfferResponse"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Active offer whose plan allowances the meters include; absent when none applies."
    },
    "period_end": {
      "description": "Exclusive usage-period end and reset time.",
      "format": "date-time",
      "type": "string"
    },
    "period_start": {
      "description": "Inclusive usage-period start.",
      "format": "date-time",
      "type": "string"
    },
    "pro_trial_available": {
      "default": false,
      "description": "Whether a Pro checkout now starts the 1-month free trial: checkout is connected and the\naccount never had a subscription.",
      "type": "boolean"
    },
    "response_version": {
      "description": "Contract version.",
      "format": "uint8",
      "maximum": 255,
      "minimum": 0,
      "type": "integer"
    },
    "state": {
      "$ref": "#/$defs/BillingSubscriptionState",
      "description": "Current subscription lifecycle state."
    },
    "tier": {
      "$ref": "#/$defs/BillingTier",
      "description": "Current canonical plan."
    },
    "warning_threshold_basis_points": {
      "description": "Warning threshold in basis points.",
      "format": "uint16",
      "maximum": 65535,
      "minimum": 0,
      "type": "integer"
    }
  },
  "required": [
    "response_version",
    "tier",
    "state",
    "period_start",
    "period_end",
    "checkout_available",
    "management_available",
    "pro_trial_available",
    "warning_threshold_basis_points",
    "meters",
    "offer"
  ],
  "type": "object",
  "$defs": {
    "BillingMeterKind": {
      "description": "Fixed metered resources.",
      "oneOf": [
        {
          "const": "issue_events",
          "description": "Issue/error event count.",
          "type": "string"
        },
        {
          "const": "log_bytes",
          "description": "Normalized log bytes.",
          "type": "string"
        },
        {
          "const": "metric_bytes",
          "description": "Normalized application-metric bytes.",
          "type": "string"
        },
        {
          "const": "trace_spans",
          "description": "Trace span count.",
          "type": "string"
        }
      ]
    },
    "BillingMeterResponse": {
      "description": "One per-signal usage meter.",
      "properties": {
        "included": {
          "description": "Included units; absent only for a quoted Enterprise contract.",
          "format": "uint64",
          "minimum": 0,
          "type": [
            "integer",
            "null"
          ]
        },
        "kind": {
          "$ref": "#/$defs/BillingMeterKind",
          "description": "Meter identity."
        },
        "state": {
          "$ref": "#/$defs/BillingMeterState",
          "description": "Derived utilization state."
        },
        "unit": {
          "$ref": "#/$defs/BillingMeterUnit",
          "description": "Meter unit."
        },
        "used": {
          "description": "Used units in the current period.",
          "format": "uint64",
          "minimum": 0,
          "type": "integer"
        }
      },
      "required": [
        "kind",
        "unit",
        "used",
        "included",
        "state"
      ],
      "type": "object"
    },
    "BillingMeterState": {
      "description": "Derived meter state.",
      "oneOf": [
        {
          "const": "ok",
          "description": "Below 80%.",
          "type": "string"
        },
        {
          "const": "warning",
          "description": "At or above 80% but below the hard limit.",
          "type": "string"
        },
        {
          "const": "blocked",
          "description": "At or above the hard limit.",
          "type": "string"
        },
        {
          "const": "quoted",
          "description": "Defined by a quoted Enterprise contract outside this fixed catalog.",
          "type": "string"
        }
      ]
    },
    "BillingMeterUnit": {
      "description": "Meter units.",
      "oneOf": [
        {
          "const": "events",
          "description": "Event count.",
          "type": "string"
        },
        {
          "const": "bytes",
          "description": "Byte count.",
          "type": "string"
        },
        {
          "const": "spans",
          "description": "Span count.",
          "type": "string"
        }
      ]
    },
    "BillingOfferKind": {
      "description": "Offer kinds.",
      "oneOf": [
        {
          "const": "public_beta",
          "description": "The new-account offer: Pro (`team`) allowances for 6 months from sign-up (from\n2026-10-22 for accounts that existed at launch). Sign-up no longer grants it; accounts\nthat hold it keep it until it ends, and new accounts try Pro through the checkout trial.",
          "type": "string"
        }
      ]
    },
    "BillingOfferResponse": {
      "description": "Plan allowances granted for a fixed time, apart from a paid subscription.",
      "properties": {
        "ends_at": {
          "description": "Exclusive end; the account falls back to its own plan afterwards.",
          "format": "date-time",
          "type": "string"
        },
        "kind": {
          "$ref": "#/$defs/BillingOfferKind",
          "description": "Why the allowances apply."
        },
        "starts_at": {
          "description": "Inclusive start.",
          "format": "date-time",
          "type": "string"
        },
        "tier": {
          "$ref": "#/$defs/BillingTier",
          "description": "Plan whose allowances apply while the offer lasts."
        }
      },
      "required": [
        "kind",
        "tier",
        "starts_at",
        "ends_at"
      ],
      "type": "object"
    },
    "BillingSubscriptionState": {
      "description": "Canonical subscription lifecycle state.",
      "oneOf": [
        {
          "const": "free",
          "description": "Developer plan.",
          "type": "string"
        },
        {
          "const": "active",
          "description": "Paid access is active.",
          "type": "string"
        },
        {
          "const": "past_due",
          "description": "Payment needs attention.",
          "type": "string"
        },
        {
          "const": "paused",
          "description": "Paid access is paused.",
          "type": "string"
        },
        {
          "const": "canceled",
          "description": "Subscription ended.",
          "type": "string"
        }
      ]
    },
    "BillingTier": {
      "description": "Canonical subscription tier.",
      "oneOf": [
        {
          "const": "developer",
          "description": "Free individual plan.",
          "type": "string"
        },
        {
          "const": "team",
          "description": "Fixed $25 monthly plan.",
          "type": "string"
        },
        {
          "const": "business",
          "description": "Fixed $80 monthly plan.",
          "type": "string"
        },
        {
          "const": "enterprise",
          "description": "Quoted contract.",
          "type": "string"
        }
      ]
    }
  }
}