Skip to content

Create a budget for an organization

POST
/organizations/{org}/settings/billing/budgets

Creates a new budget for an organization. The authenticated user must be an organization admin or billing manager.

API method documentation

org
required
string

The organization name. The name is not case sensitive.

Media type application/json
object
budget_amount

The budget amount in whole dollars. For license-based products, this represents the number of licenses.

integer
prevent_further_usage

Whether to prevent additional spending once the budget is exceeded. For user and multi_user_customer scopes, this must be true.

boolean
budget_alerting
object
will_alert

Whether alerts are enabled for this budget

boolean
alert_recipients

Array of user login names who will receive alerts

Array<string>
budget_scope

The scope of the budget for this organization.

  • organization: Apply the budget to the organization.
  • repository: Apply the budget to a specific repository in the organization.
  • multi_user_customer: Apply a universal budget to all users in the organization.
  • user: Apply the budget to a single user in the organization.

user and multi_user_customer scopes are only supported when budget_product_sku is ai_credits or premium_requests.

string
Allowed values: organization repository multi_user_customer user
budget_entity_name

The name of the entity to apply the budget to

string
""
budget_type
One of:
string
Allowed values: BundlePricing
budget_product_sku

A single product or SKU that will be covered in the budget

string
user

The username of the user for user scope budgets. This field is required when budget_scope is user.

string
Examples
Example create-organization-budget

Create organization budget example

{
"budget_amount": 500,
"prevent_further_usage": true,
"budget_scope": "organization",
"budget_entity_name": "",
"budget_type": "ProductPricing",
"budget_product_sku": "actions",
"budget_alerting": {
"will_alert": false,
"alert_recipients": []
}
}

Budget created successfully

Media type application/json
object
message
required

A message indicating the result of the create operation

string
budget
required
object
id

ID of the budget.

string
budget_scope

The type of scope for the budget

string
Allowed values: enterprise organization repository cost_center multi_user_customer multi_user_cost_center user
budget_entity_name

The name of the entity to apply the budget to

string
budget_amount

The budget amount in whole dollars. For license-based products, this represents the number of licenses.

integer
prevent_further_usage

Whether to prevent additional spending once the budget is exceeded

boolean
budget_product_sku

A single product or sku to apply the budget to.

string
budget_type
One of:
string
Allowed values: ProductPricing
budget_alerting
object
will_alert

Whether alerts are enabled for this budget

boolean
alert_recipients

Array of user login names who will receive alerts

Array<string>
Examples
Example create-organization-budget
{
"message": "Budget successfully created.",
"budget": {
"id": "f5236c62-157f-4d8f-a79e-ffb91058ee97",
"budget_type": "ProductPricing",
"budget_product_sku": "actions",
"budget_scope": "organization",
"budget_entity_name": "example-organization",
"budget_amount": 100,
"prevent_further_usage": true,
"budget_alerting": {
"will_alert": false,
"alert_recipients": []
}
}
}

Bad Request

Basic Error

Basic Error

object
message
string
documentation_url
string
url
string
status
string
Example generated
{
"message": "example",
"documentation_url": "example",
"url": "example",
"status": "example"
}

Requires authentication

Media type application/json
Basic Error

Basic Error

object
message
string
documentation_url
string
url
string
status
string
Example generated
{
"message": "example",
"documentation_url": "example",
"url": "example",
"status": "example"
}

Insufficient permissions

Media type application/json
Basic Error

Basic Error

object
message
string
documentation_url
string
url
string
status
string
Examples
Example insufficient-permissions
{
"message": "Insufficient permissions to create a budget.",
"documentation_url": "https://docs.github.com/rest/billing/budgets#create-a-budget-for-an-organization"
}

Feature not enabled or organization not found

Media type application/json
Basic Error

Basic Error

object
message
string
documentation_url
string
url
string
status
string
Examples
Example feature-not-enabled
{
"message": "Not Found",
"documentation_url": "https://docs.github.com/rest/billing/budgets#create-a-budget-for-an-organization"
}

Validation failed, or the endpoint has been spammed.

Media type application/json
Validation Error

Validation Error

object
message
required
string
documentation_url
required
string
errors
Array<object>
object
resource
string
field
string
message
string
code
required
string
index
integer
value
One of:
string
nullable
Example generated
{
"message": "example",
"documentation_url": "example",
"errors": [
{
"resource": "example",
"field": "example",
"message": "example",
"code": "example",
"index": 1,
"value": [
"example"
]
}
]
}

Internal server error

Media type application/json
Basic Error

Basic Error

object
message
string
documentation_url
string
url
string
status
string
Examples
Example server-error
{
"message": "Unable to create budget.",
"documentation_url": "https://docs.github.com/rest/billing/budgets#create-a-budget-for-an-organization"
}