{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/rumoro-dev/json-schema/rumoro-dev-wallet-schema.json",
  "title": "Wallet",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/rumoro-dev-billing-api-openapi.yml#/components/schemas/Wallet",
  "type": "object",
  "properties": {
    "balanceCents": {
      "type": "integer",
      "description": "The ledger balance, all credits minus all settled debits."
    },
    "pendingCents": {
      "type": "integer",
      "description": "Cost of mentions matched after the last daily settlement. Not debited yet."
    },
    "effectiveBalanceCents": {
      "type": "integer",
      "description": "balanceCents minus pendingCents. Pausing at zero and the check before adding keywords both use this number."
    },
    "burnPerDayCents": {
      "type": "integer",
      "description": "Mean daily debit across the past 7 days, or the workspace's lifetime if shorter."
    },
    "daysLeft": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 0,
      "description": "effectiveBalanceCents over burnPerDayCents, rounded down. Null when burnPerDayCents is 0."
    },
    "stopped": {
      "type": "boolean",
      "description": "True when tracking is paused because the balance ran out. It resumes after a top-up that covers one day of every keyword."
    },
    "lowBalance": {
      "type": "boolean",
      "description": "True when tracking is running and the effective balance is 20 percent of the last credit or less. The low-balance email uses the same rule."
    },
    "activeKeywords": {
      "type": "integer",
      "minimum": 0,
      "description": "Keywords that are not muted."
    },
    "autoMutedKeywords": {
      "type": "integer",
      "minimum": 0,
      "description": "Keywords muted for low balance. A top-up restarts them."
    },
    "nextDayCents": {
      "type": "integer",
      "description": "Next day's cost for the running keywords. Tracking stops if the effective balance drops below it."
    },
    "resumeCostCents": {
      "type": "integer",
      "description": "Daily cost of every keyword, running or paused. Tracking restarts once the effective balance reaches this amount."
    },
    "signupCredit": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "amountCents": {
          "type": "integer",
          "description": "Whole US cents."
        },
        "grantedAt": {
          "type": "string",
          "description": "UTC time in ISO 8601."
        }
      },
      "required": [
        "amountCents",
        "grantedAt"
      ],
      "description": "Welcome credit given to this workspace. Null when the user already got it in another workspace."
    },
    "lastTopUpAt": {
      "type": [
        "string",
        "null"
      ],
      "description": "Latest paid top-up time, or null if there is none."
    },
    "billingConfigured": {
      "type": "boolean",
      "description": "Whether top-ups work here. false when Polar isn't configured, which hides the top-up button."
    },
    "minTopUpCents": {
      "type": "integer",
      "description": "The minimum top-up at checkout."
    },
    "maxTopUpCents": {
      "type": "integer",
      "description": "The maximum for one top-up."
    },
    "defaultTopUpCents": {
      "type": "integer",
      "description": "The amount the checkout starts with."
    },
    "currency": {
      "type": "string",
      "enum": [
        "USD"
      ],
      "description": "All amounts here are in US cents."
    },
    "autoRecharge": {
      "type": "object",
      "properties": {
        "available": {
          "type": "boolean",
          "description": "Whether saved-card charging works on this deployment. The setting is hidden when false."
        },
        "enabled": {
          "type": "boolean",
          "description": "When true, the saved card is charged automatically if the balance gets low."
        },
        "thresholdCents": {
          "type": "integer",
          "description": "The card is charged when the effective balance falls below this."
        },
        "amountCents": {
          "type": "integer",
          "description": "The amount each automatic charge adds, within the same limits as a manual top-up."
        },
        "lastRunAt": {
          "type": [
            "string",
            "null"
          ],
          "description": "Time of the latest successful automatic charge."
        },
        "lastError": {
          "type": [
            "string",
            "null"
          ],
          "description": "Error of the last failed automatic charge, cleared by a successful one."
        }
      },
      "required": [
        "available",
        "enabled",
        "thresholdCents",
        "amountCents",
        "lastRunAt",
        "lastError"
      ]
    }
  },
  "required": [
    "balanceCents",
    "pendingCents",
    "effectiveBalanceCents",
    "burnPerDayCents",
    "daysLeft",
    "stopped",
    "lowBalance",
    "activeKeywords",
    "autoMutedKeywords",
    "nextDayCents",
    "resumeCostCents",
    "signupCredit",
    "lastTopUpAt",
    "billingConfigured",
    "minTopUpCents",
    "maxTopUpCents",
    "defaultTopUpCents",
    "currency",
    "autoRecharge"
  ]
}