{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/regtail-com/json-schema/regtail-com-credits-schema.json",
  "title": "Credits",
  "x-generated": "2026-11-23",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/regtail-com-openapi.yml#/components/schemas/Credits",
  "properties": {
    "credits": {
      "type": "integer",
      "title": "Credits",
      "description": "Credits the key's account can spend now"
    },
    "top_up_url": {
      "type": "string",
      "title": "Top Up Url"
    },
    "sample": {
      "type": "boolean",
      "title": "Sample",
      "default": false
    },
    "plan": {
      "anyOf": [
        {
          "$ref": "#/$defs/Plan"
        },
        {
          "type": "null"
        }
      ],
      "description": "The account's API plan and this period's cars, if it has one"
    }
  },
  "type": "object",
  "required": [
    "credits",
    "top_up_url"
  ],
  "$defs": {
    "Plan": {
      "properties": {
        "cars_used": {
          "type": "integer",
          "title": "Cars Used",
          "description": "Distinct cars looked up this billing period, this one included"
        },
        "cars_included": {
          "type": "integer",
          "title": "Cars Included",
          "description": "Cars the monthly plan includes"
        },
        "extra_cars": {
          "type": "integer",
          "title": "Extra Cars",
          "description": "Cars past the included ones this period, billed at the end of the month"
        },
        "price_per_extra_car_pence": {
          "type": "integer",
          "title": "Price Per Extra Car Pence"
        },
        "period_end": {
          "type": "string",
          "title": "Period End",
          "description": "When this billing period ends and the count starts again (UTC)"
        },
        "new_car": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "New Car",
          "description": "Whether this call counted a car not yet looked up this period"
        }
      },
      "type": "object",
      "required": [
        "cars_used",
        "cars_included",
        "extra_cars",
        "price_per_extra_car_pence",
        "period_end"
      ],
      "title": "Plan"
    }
  }
}