{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/blacksky/json-schema/blacksky-page-of-budgets-schema.json",
  "title": "PageOfBudgets",
  "description": "A page of budgets.",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/blacksky-budgets-api-openapi.yml#/components/schemas/PageOfBudgets",
  "type": "object",
  "allOf": [
    {
      "type": "object",
      "properties": {
        "content": {
          "type": "array",
          "description": "A list of budgets.",
          "items": {
            "$ref": "#/$defs/BudgetResponse"
          }
        }
      }
    },
    {
      "$ref": "#/$defs/PageableResponse"
    }
  ],
  "$defs": {
    "BudgetResponse": {
      "required": [
        "createdAt",
        "createdBy",
        "id",
        "name",
        "status",
        "updatedAt"
      ],
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "The budget ID.\n",
          "format": "uuid"
        },
        "name": {
          "maxLength": 255,
          "minLength": 1,
          "type": "string",
          "description": "The name of the budget.\n"
        },
        "description": {
          "maxLength": 1024,
          "type": [
            "string",
            "null"
          ],
          "description": "The description of the budget.\n"
        },
        "externalId": {
          "maxLength": 255,
          "type": [
            "string",
            "null"
          ],
          "description": "The ID of the external project associated with the budget.\n"
        },
        "status": {
          "$ref": "#/$defs/BudgetStatus"
        },
        "createdBy": {
          "type": "string",
          "description": "The ID of the user who created the budget.\n",
          "format": "uuid"
        },
        "createdAt": {
          "type": "string",
          "description": "The timestamp when the budget was created.\n",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "description": "The timestamp when the budget was last updated.\n",
          "format": "date-time"
        },
        "validityPeriod": {
          "$ref": "#/$defs/ValidityPeriod"
        },
        "spendLimit": {
          "type": [
            "integer",
            "null"
          ],
          "description": "The spend limit for this budget. Any consumption that would cause total credit consumption to exceed the limit fails. The total credit consumption aggregates all consumptions and refunds under this budget.\n\nIf the spend limit is set below the current budget usage, further consumption fails.\n",
          "format": "int64"
        },
        "consumedCredits": {
          "type": [
            "integer",
            "null"
          ],
          "description": "The number of credits consumed under this budget, after offsetting applicable refunds. Expressed as a negative value. Returned only if `includeUsage` is enabled.\n",
          "format": "int64"
        },
        "remainingCredits": {
          "type": [
            "integer",
            "null"
          ],
          "description": "The number of credits remaining to spend under this budget. Can be negative if the credits consumed exceed the spend limit. If the budget doesn’t have a spend limit, the value is `null`. Returned only if `includeUsage` is enabled.\n",
          "format": "int64"
        },
        "usagePercentage": {
          "type": [
            "number",
            "null"
          ],
          "description": "The percentage of the spend limit consumed, rounded up to two decimals. Can be greater than 100% if the spend limit is set below current budget usage. If the budget doesn’t have a spend limit, the value is `null`. Returned only if `includeUsage` is enabled.\n",
          "format": "float"
        }
      }
    },
    "BudgetStatus": {
      "type": "string",
      "description": "The [budget status](https://docs.up42.com/developers/api-budgets#budget-statuses).\n",
      "enum": [
        "ACTIVE",
        "INACTIVE"
      ]
    },
    "PageableObject": {
      "type": "object",
      "properties": {
        "pageNumber": {
          "type": "integer",
          "format": "int32"
        },
        "pageSize": {
          "type": "integer",
          "format": "int32"
        },
        "sort": {
          "$ref": "#/$defs/Sort"
        },
        "offset": {
          "type": "integer",
          "format": "int64"
        },
        "paged": {
          "type": "boolean"
        },
        "unpaged": {
          "type": "boolean"
        }
      }
    },
    "PageableResponse": {
      "type": "object",
      "properties": {
        "pageable": {
          "$ref": "#/$defs/PageableObject"
        },
        "last": {
          "type": "boolean"
        },
        "totalElements": {
          "type": "integer",
          "format": "int64"
        },
        "totalPages": {
          "type": "integer",
          "format": "int32"
        },
        "size": {
          "type": "integer",
          "format": "int32"
        },
        "number": {
          "type": "integer",
          "format": "int32"
        },
        "sort": {
          "$ref": "#/$defs/Sort"
        },
        "numberOfElements": {
          "type": "integer",
          "format": "int32"
        },
        "first": {
          "type": "boolean"
        },
        "empty": {
          "type": "boolean"
        }
      }
    },
    "Sort": {
      "type": "object",
      "properties": {
        "empty": {
          "type": "boolean"
        },
        "sorted": {
          "type": "boolean"
        },
        "unsorted": {
          "type": "boolean"
        }
      }
    },
    "ValidityPeriod": {
      "type": "object",
      "properties": {
        "startDate": {
          "type": [
            "string",
            "null"
          ],
          "description": "The start date of the budget's validity period, in UTC. Before this date, the budget can't be used.\n",
          "format": "date"
        },
        "endDate": {
          "type": [
            "string",
            "null"
          ],
          "description": "The end date of the budget's validity period, in UTC. After this date, the budget can't be used. If the start date is set, the end date must be on or after it.\n",
          "format": "date"
        }
      },
      "description": "The period during which the budget can be used for orders and processing jobs. The budget is valid from the start date through the end date, inclusive.\n"
    }
  }
}