Billing API, REST: Budget.Create
Creates a budget for the specified billing account.
HTTP request
POST https://billing.api.cloud.yandex.net/billing/v1/budgets
Body parameters
{
"billingAccountId": "string",
"name": "string",
// Includes only one of the fields `costBudgetSpec`, `expenseBudgetSpec`, `balanceBudgetSpec`
"costBudgetSpec": {
"amount": "string",
"notificationUserAccountIds": [
"string"
],
"thresholdRules": [
{
"type": "string",
"amount": "string",
"notificationUserAccountIds": [
"string"
]
}
],
"filter": {
"serviceIds": [
"string"
],
"cloudFoldersFilters": [
{
"cloudId": "string",
"folderIds": [
"string"
]
}
]
},
// Includes only one of the fields `resetPeriod`, `startDate`
"resetPeriod": "string",
"startDate": "string",
// end of the list of possible fields
"endDate": "string"
},
"expenseBudgetSpec": {
"amount": "string",
"notificationUserAccountIds": [
"string"
],
"thresholdRules": [
{
"type": "string",
"amount": "string",
"notificationUserAccountIds": [
"string"
]
}
],
"filter": {
"serviceIds": [
"string"
],
"cloudFoldersFilters": [
{
"cloudId": "string",
"folderIds": [
"string"
]
}
]
},
// Includes only one of the fields `resetPeriod`, `startDate`
"resetPeriod": "string",
"startDate": "string",
// end of the list of possible fields
"endDate": "string"
},
"balanceBudgetSpec": {
"amount": "string",
"notificationUserAccountIds": [
"string"
],
"thresholdRules": [
{
"type": "string",
"amount": "string",
"notificationUserAccountIds": [
"string"
]
}
],
"startDate": "string",
"endDate": "string"
}
// end of the list of possible fields
}
Field |
Description |
billingAccountId |
string Required field. ID of the billing account to list budgets corresponding to. |
name |
string Required field. Name of the budget. |
costBudgetSpec |
Cost budget specification. Includes only one of the fields Specification of the budget. |
expenseBudgetSpec |
Expense budget specification. Includes only one of the fields Specification of the budget. |
balanceBudgetSpec |
Balance budget specification. Includes only one of the fields Specification of the budget. |
CostBudgetSpec
Cost budget specification describes budget that can be used to control cost of cloud resources usage.
Field |
Description |
amount |
string Required field. Max cost threshold of the budget. Amount currency is the same as corresponding yandex.cloud.billing.v1.BillingAccount.currency. |
notificationUserAccountIds[] |
string IDs of the yandex.cloud.iam.v1.UserAccount. |
thresholdRules[] |
List of the ThresholdRule. |
filter |
Filter that can be used for specific resources selection. Only consumption cost of selected resources are used for the budget calculation. |
resetPeriod |
enum (ResetPeriodType) Periodic start type that resets budget after specified period is finished. Includes only one of the fields Start type of the budget.
|
startDate |
string Custom start date of the budget. Includes only one of the fields Start type of the budget. |
endDate |
string Required field. End date of the budget. |
ThresholdRule
Rules that define intermediate cost thresholds of the budget.
Field |
Description |
type |
enum (ThresholdType) Required field. Type of the rule.
|
amount |
string Required field. Amount of the rule.
|
notificationUserAccountIds[] |
string IDs of the yandex.cloud.iam.v1.UserAccount. |
ConsumptionFilter
Filter that can be used for specific resources selection.
Field |
Description |
serviceIds[] |
string IDs of the yandex.cloud.billing.v1.Service. |
cloudFoldersFilters[] |
Cloud and folders consumption filter. |
CloudFoldersConsumptionFilter
Filter that can be used for specific cloud and its folders selection.
Field |
Description |
cloudId |
string ID of the yandex.cloud.resourcemanager.v1.Cloud. |
folderIds[] |
string IDs of the yandex.cloud.resourcemanager.v1.Folder. |
ExpenseBudgetSpec
Expense budget specification describes budget that can be used to control expense of cloud resources usage.
Field |
Description |
amount |
string Required field. Max expense threshold of the budget. Amount currency is the same as corresponding yandex.cloud.billing.v1.BillingAccount.currency. |
notificationUserAccountIds[] |
string IDs of the yandex.cloud.iam.v1.UserAccount. |
thresholdRules[] |
List of the ThresholdRule. |
filter |
Filter that can be used for specific resources selection. Only consumption expense of selected resources are used for the budget calculation. |
resetPeriod |
enum (ResetPeriodType) Periodic start type that resets budget after specified period is finished. Includes only one of the fields Start type of the budget.
|
startDate |
string Custom start date of the budget. Includes only one of the fields Start type of the budget. |
endDate |
string Required field. End date of the budget. |
BalanceBudgetSpec
Balance budget specification describes budget that can be used to control yandex.cloud.billing.v1.BillingAccount.balance.
Field |
Description |
amount |
string Required field. Max balance threshold of the budget. Amount currency is the same as corresponding yandex.cloud.billing.v1.BillingAccount.currency. |
notificationUserAccountIds[] |
string IDs of the yandex.cloud.iam.v1.UserAccount. |
thresholdRules[] |
List of the ThresholdRule. |
startDate |
string Start_date of the budget. |
endDate |
string Required field. End date of the budget. |
Response
HTTP Code: 200 - OK
{
"id": "string",
"description": "string",
"createdAt": "string",
"createdBy": "string",
"modifiedAt": "string",
"done": "boolean",
"metadata": {
"budgetId": "string"
},
// Includes only one of the fields `error`, `response`
"error": {
"code": "integer",
"message": "string",
"details": [
"object"
]
},
"response": {
"id": "string",
"name": "string",
"createdAt": "string",
"billingAccountId": "string",
"status": "string",
// Includes only one of the fields `costBudget`, `expenseBudget`, `balanceBudget`
"costBudget": {
"amount": "string",
"notificationUserAccountIds": [
"string"
],
"thresholdRules": [
{
"type": "string",
"amount": "string",
"notificationUserAccountIds": [
"string"
]
}
],
"filter": {
"serviceIds": [
"string"
],
"cloudFoldersFilters": [
{
"cloudId": "string",
"folderIds": [
"string"
]
}
]
},
// Includes only one of the fields `resetPeriod`, `startDate`
"resetPeriod": "string",
"startDate": "string",
// end of the list of possible fields
"endDate": "string"
},
"expenseBudget": {
"amount": "string",
"notificationUserAccountIds": [
"string"
],
"thresholdRules": [
{
"type": "string",
"amount": "string",
"notificationUserAccountIds": [
"string"
]
}
],
"filter": {
"serviceIds": [
"string"
],
"cloudFoldersFilters": [
{
"cloudId": "string",
"folderIds": [
"string"
]
}
]
},
// Includes only one of the fields `resetPeriod`, `startDate`
"resetPeriod": "string",
"startDate": "string",
// end of the list of possible fields
"endDate": "string"
},
"balanceBudget": {
"amount": "string",
"notificationUserAccountIds": [
"string"
],
"thresholdRules": [
{
"type": "string",
"amount": "string",
"notificationUserAccountIds": [
"string"
]
}
],
"startDate": "string",
"endDate": "string"
}
// end of the list of possible fields
}
// end of the list of possible fields
}
An Operation resource. For more information, see Operation.
Field |
Description |
id |
string ID of the operation. |
description |
string Description of the operation. 0-256 characters long. |
createdAt |
string (date-time) Creation timestamp. String in RFC3339 To work with values in this field, use the APIs described in the |
createdBy |
string ID of the user or service account who initiated the operation. |
modifiedAt |
string (date-time) The time when the Operation resource was last modified. String in RFC3339 To work with values in this field, use the APIs described in the |
done |
boolean If the value is |
metadata |
Service-specific metadata associated with the operation. |
error |
The error result of the operation in case of failure or cancellation. Includes only one of the fields The operation result. |
response |
The normal response of the operation in case of success. Includes only one of the fields The operation result. |
CreateBudgetMetadata
Field |
Description |
budgetId |
string ID of the budget. |
Status
The error result of the operation in case of failure or cancellation.
Field |
Description |
code |
integer (int32) Error code. An enum value of google.rpc.Code |
message |
string An error message. |
details[] |
object A list of messages that carry the error details. |
Budget
A Budget resource. For more information, see [/docs/billing/concepts/budget].
Field |
Description |
id |
string ID of the budget. |
name |
string Name of the budget. |
createdAt |
string (date-time) Creation timestamp. String in RFC3339 To work with values in this field, use the APIs described in the |
billingAccountId |
string ID of the billing account that the budget belongs to. |
status |
enum (BudgetStatus) Status of the budget.
|
costBudget |
Cost budget specification. Includes only one of the fields Specification of the budget. |
expenseBudget |
Expense budget specification. Includes only one of the fields Specification of the budget. |
balanceBudget |
Balance budget specification. Includes only one of the fields Specification of the budget. |
CostBudgetSpec
Cost budget specification describes budget that can be used to control cost of cloud resources usage.
Field |
Description |
amount |
string Required field. Max cost threshold of the budget. Amount currency is the same as corresponding yandex.cloud.billing.v1.BillingAccount.currency. |
notificationUserAccountIds[] |
string IDs of the yandex.cloud.iam.v1.UserAccount. |
thresholdRules[] |
List of the ThresholdRule. |
filter |
Filter that can be used for specific resources selection. Only consumption cost of selected resources are used for the budget calculation. |
resetPeriod |
enum (ResetPeriodType) Periodic start type that resets budget after specified period is finished. Includes only one of the fields Start type of the budget.
|
startDate |
string Custom start date of the budget. Includes only one of the fields Start type of the budget. |
endDate |
string Required field. End date of the budget. |
ThresholdRule
Rules that define intermediate cost thresholds of the budget.
Field |
Description |
type |
enum (ThresholdType) Required field. Type of the rule.
|
amount |
string Required field. Amount of the rule.
|
notificationUserAccountIds[] |
string IDs of the yandex.cloud.iam.v1.UserAccount. |
ConsumptionFilter
Filter that can be used for specific resources selection.
Field |
Description |
serviceIds[] |
string IDs of the yandex.cloud.billing.v1.Service. |
cloudFoldersFilters[] |
Cloud and folders consumption filter. |
CloudFoldersConsumptionFilter
Filter that can be used for specific cloud and its folders selection.
Field |
Description |
cloudId |
string ID of the yandex.cloud.resourcemanager.v1.Cloud. |
folderIds[] |
string IDs of the yandex.cloud.resourcemanager.v1.Folder. |
ExpenseBudgetSpec
Expense budget specification describes budget that can be used to control expense of cloud resources usage.
Field |
Description |
amount |
string Required field. Max expense threshold of the budget. Amount currency is the same as corresponding yandex.cloud.billing.v1.BillingAccount.currency. |
notificationUserAccountIds[] |
string IDs of the yandex.cloud.iam.v1.UserAccount. |
thresholdRules[] |
List of the ThresholdRule. |
filter |
Filter that can be used for specific resources selection. Only consumption expense of selected resources are used for the budget calculation. |
resetPeriod |
enum (ResetPeriodType) Periodic start type that resets budget after specified period is finished. Includes only one of the fields Start type of the budget.
|
startDate |
string Custom start date of the budget. Includes only one of the fields Start type of the budget. |
endDate |
string Required field. End date of the budget. |
BalanceBudgetSpec
Balance budget specification describes budget that can be used to control yandex.cloud.billing.v1.BillingAccount.balance.
Field |
Description |
amount |
string Required field. Max balance threshold of the budget. Amount currency is the same as corresponding yandex.cloud.billing.v1.BillingAccount.currency. |
notificationUserAccountIds[] |
string IDs of the yandex.cloud.iam.v1.UserAccount. |
thresholdRules[] |
List of the ThresholdRule. |
startDate |
string Start_date of the budget. |
endDate |
string Required field. End date of the budget. |