{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/bewary/json-schema/bewary-account-response-schema.json",
  "title": "AccountResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/bewary-account-api-openapi.yml#/components/schemas/AccountResponse",
  "properties": {
    "credits": {
      "$ref": "#/$defs/CreditState"
    },
    "recent": {
      "items": {
        "$ref": "#/$defs/UsageRow"
      },
      "type": "array",
      "title": "Recent"
    }
  },
  "type": "object",
  "required": [
    "credits",
    "recent"
  ],
  "$defs": {
    "CreditState": {
      "properties": {
        "period": {
          "type": "string",
          "title": "Period",
          "description": "The current UTC month, YYYY-MM."
        },
        "monthly_free": {
          "type": "integer",
          "title": "Monthly Free",
          "description": "Free credits every key gets each UTC month; they reset."
        },
        "monthly_used": {
          "type": "integer",
          "title": "Monthly Used",
          "description": "Free credits used this month."
        },
        "prepaid": {
          "type": "integer",
          "title": "Prepaid",
          "description": "Prepaid credits from packs. They never expire and are spent after the free ones."
        },
        "remaining": {
          "type": "integer",
          "title": "Remaining",
          "description": "What can be spent now: free credits left this month plus prepaid."
        },
        "billing_account": {
          "type": "boolean",
          "title": "Billing Account",
          "description": "The account has bought a pack: its receipts and invoices are in the billing portal (POST /v1/billing/portal).",
          "default": false
        }
      },
      "type": "object",
      "required": [
        "period",
        "monthly_free",
        "monthly_used",
        "prepaid",
        "remaining"
      ],
      "title": "CreditState"
    },
    "UsageRow": {
      "properties": {
        "request_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Request Id"
        },
        "endpoint": {
          "type": "string",
          "title": "Endpoint"
        },
        "credits": {
          "type": "integer",
          "title": "Credits"
        },
        "status": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "string"
            }
          ],
          "title": "Status"
        },
        "at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "At"
        }
      },
      "type": "object",
      "required": [
        "endpoint",
        "credits",
        "status"
      ],
      "title": "UsageRow"
    }
  }
}