{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/scaledthought-com/json-schema/scaledthought-com-billing-status-schema.json",
  "title": "BillingStatus",
  "x-generated": "2026-11-23",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/scaledthought-com-openapi.json#/components/schemas/BillingStatus",
  "type": "object",
  "properties": {
    "balance_usd": {
      "type": "number"
    },
    "auto_reload": {
      "type": "object",
      "properties": {
        "enabled": {
          "type": "boolean"
        },
        "threshold_usd": {
          "type": [
            "number",
            "null"
          ]
        },
        "amount_usd": {
          "type": [
            "number",
            "null"
          ]
        },
        "monthly_limit_usd": {
          "type": [
            "number",
            "null"
          ]
        },
        "used_this_month_usd": {
          "type": "number"
        },
        "disabled_reason": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "enabled",
        "threshold_usd",
        "amount_usd",
        "monthly_limit_usd",
        "used_this_month_usd",
        "disabled_reason"
      ],
      "additionalProperties": false
    },
    "pending_topups": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "topup_id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "checkout",
              "auto_reload",
              "card_setup"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "paid",
              "expired",
              "failed",
              "canceled"
            ]
          },
          "amount_usd": {
            "type": "number"
          },
          "approval_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string"
          },
          "completed_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "failure_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "auto_reload": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "threshold_usd": {
                    "type": "number"
                  },
                  "amount_usd": {
                    "type": "number"
                  },
                  "monthly_limit_usd": {
                    "type": [
                      "number",
                      "null"
                    ]
                  }
                },
                "required": [
                  "threshold_usd",
                  "amount_usd",
                  "monthly_limit_usd"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "topup_id",
          "kind",
          "status",
          "amount_usd",
          "approval_url",
          "expires_at",
          "created_at",
          "completed_at",
          "failure_code",
          "auto_reload"
        ],
        "additionalProperties": false
      }
    },
    "recent_transactions": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "purchase",
              "auto_reload",
              "grant",
              "usage",
              "batch",
              "fine_tune",
              "refund",
              "adjustment",
              "dispute_hold",
              "dispute_release",
              "video",
              "promo",
              "promo_expire",
              "trial",
              "trial_expire",
              "review",
              "internal_grant",
              "customer_grant"
            ]
          },
          "amount_usd": {
            "type": "number"
          },
          "amount_micros": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "balance_after_usd": {
            "type": "number"
          },
          "created_at": {
            "type": "string"
          },
          "topup_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "request_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "batch_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "fine_tune_job_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "kind",
          "amount_usd",
          "amount_micros",
          "balance_after_usd",
          "created_at",
          "topup_id",
          "request_id",
          "batch_id",
          "fine_tune_job_id",
          "reason"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "balance_usd",
    "auto_reload",
    "pending_topups",
    "recent_transactions"
  ],
  "additionalProperties": false
}