{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/mentio-dev/json-schema/mentio-dev-wallet-schema.json",
  "title": "Wallet",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/mentio-dev-billing-api-openapi.yml#/components/schemas/Wallet",
  "type": "object",
  "properties": {
    "balanceCents": {
      "type": "integer",
      "description": "Ledger balance: every credit minus every settled debit."
    },
    "pendingCents": {
      "type": "integer",
      "description": "Mentions and comments billed since the last daily settlement, priced but not yet debited."
    },
    "effectiveBalanceCents": {
      "type": "integer",
      "description": "balanceCents minus pendingCents: what the stop sweep and the keyword gate look at."
    },
    "burnPerDayCents": {
      "type": "integer",
      "description": "Average daily debit over the last 7 days (or since the workspace was created)."
    },
    "daysLeft": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 0,
      "description": "effectiveBalanceCents divided by burnPerDayCents; null when nothing is burning."
    },
    "stopped": {
      "type": "boolean",
      "description": "The wallet paused tracking; a top-up that covers a day of every keyword resumes it."
    },
    "lowBalance": {
      "type": "boolean",
      "description": "Running, and the effective balance is at or under 20 percent of the last credit: the same rule as the low-balance email."
    },
    "activeKeywords": {
      "type": "integer",
      "minimum": 0,
      "description": "Unmuted keywords."
    },
    "autoMutedKeywords": {
      "type": "integer",
      "minimum": 0,
      "description": "Keywords the wallet paused; a top-up resumes them."
    },
    "nextDayCents": {
      "type": "integer",
      "description": "What one more day of the running keywords costs; tracking stops when the effective balance drops under it."
    },
    "resumeCostCents": {
      "type": "integer",
      "description": "What one day of every keyword (running and paused) costs; a stopped workspace resumes once the effective balance covers it."
    },
    "signupCredit": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "amountCents": {
          "type": "integer",
          "description": "Integer USD cents."
        },
        "grantedAt": {
          "type": "string",
          "description": "ISO 8601 timestamp, UTC."
        }
      },
      "required": [
        "amountCents",
        "grantedAt"
      ],
      "description": "The welcome credit this workspace received, or null (a second workspace of the same user gets none)."
    },
    "lastTopUpAt": {
      "type": [
        "string",
        "null"
      ],
      "description": "Newest paid top-up; null before the first."
    },
    "billingConfigured": {
      "type": "boolean",
      "description": "False when this deployment has no Polar credentials: the top-up button is hidden."
    },
    "minTopUpCents": {
      "type": "integer",
      "description": "Smallest top-up the checkout accepts."
    },
    "maxTopUpCents": {
      "type": "integer",
      "description": "Largest single top-up."
    },
    "defaultTopUpCents": {
      "type": "integer",
      "description": "Amount prefilled in the checkout."
    },
    "currency": {
      "type": "string",
      "enum": [
        "USD"
      ],
      "description": "Every amount on this page is in USD cents."
    },
    "autoRecharge": {
      "type": "object",
      "properties": {
        "available": {
          "type": "boolean",
          "description": "This deployment can charge saved cards; false hides the setting."
        },
        "enabled": {
          "type": "boolean",
          "description": "Charge the saved card automatically when the balance runs low."
        },
        "thresholdCents": {
          "type": "integer",
          "description": "Charge when the effective balance drops under this."
        },
        "amountCents": {
          "type": "integer",
          "description": "How much to add per automatic charge (same bounds as a manual top-up)."
        },
        "weeklyLimitCents": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Most the saved card may be charged automatically over any 7 days, before tax; null = no limit."
        },
        "spentThisWeekCents": {
          "type": "integer",
          "description": "What counts against the weekly limit over the last 7 days, before tax: automatic charges made plus any still settling."
        },
        "lastRunAt": {
          "type": [
            "string",
            "null"
          ],
          "description": "Newest successful automatic charge."
        },
        "lastError": {
          "type": [
            "string",
            "null"
          ],
          "description": "Why the last automatic charge failed; null after a success."
        }
      },
      "required": [
        "available",
        "enabled",
        "thresholdCents",
        "amountCents",
        "weeklyLimitCents",
        "spentThisWeekCents",
        "lastRunAt",
        "lastError"
      ]
    }
  },
  "required": [
    "balanceCents",
    "pendingCents",
    "effectiveBalanceCents",
    "burnPerDayCents",
    "daysLeft",
    "stopped",
    "lowBalance",
    "activeKeywords",
    "autoMutedKeywords",
    "nextDayCents",
    "resumeCostCents",
    "signupCredit",
    "lastTopUpAt",
    "billingConfigured",
    "minTopUpCents",
    "maxTopUpCents",
    "defaultTopUpCents",
    "currency",
    "autoRecharge"
  ]
}