Yandex Cloud
  • Services
  • Solutions
  • Why Yandex Cloud
  • Pricing
  • Documentation
  • Contact us
Get started
Language / Region
© 2022 Yandex.Cloud LLC
Billing
  • Getting started
  • Step-by-step instructions
    • All instructions
    • Activate the paid version
    • Purchase a committed volume of services (CVoS)
    • Activate a promo code
    • View usage details
    • Top up your personal account
    • Link another bank card
    • Unlink a card
    • Link a cloud to a billing account
    • Change the payment method
    • Understand your payment invoice
    • View your payment history
    • Change your billing account data
    • Create a new billing account
    • Delete billing account
    • Get expense details by folder
    • View details in Yandex DataLens
    • Enable notifications
    • Enable electronic document management
    • Download reporting documents
  • Concepts
    • All concepts
    • Promo code
    • Billing threshold
    • Billing accounts
      • Overview
      • Statuses
    • Personal account
    • Grant
    • Trial period
    • Committed volume of services (CVoS)
    • Free tier of serverless ecosystem
    • Budget
    • Agreement
    • Glossary
  • Paying for resources
    • General information
    • Payment methods
      • General information
      • For individuals
      • For businesses and individual entrepreneurs
        • Bank account transfers
        • Bank card transfer
    • Billing cycle
      • General information
      • For individuals
      • For businesses and individual entrepreneurs
    • Reporting documents
      • General information
      • Report
      • Payment invoice
      • Invoice
      • Electronic document management
    • Payment currency
  • Access management
  • Pricing policy
  • Questions and answers
    • General questions
    • Questions about an agreement
    • Questions about payment
    • Questions about the billing account
    • Questions about the trial period and paid version
    • Questions about working with non-residents of Russia or Kazakhstan
    • All questions on one page
  • API reference
    • Authentication in the API
    • gRPC
      • Overview
      • BillingAccountService
      • BudgetService
      • CustomerService
      • ServiceService
      • SkuService
      • OperationService
    • REST
      • Overview
      • BillingAccount
        • Overview
        • bindBillableObject
        • get
        • list
        • listAccessBindings
        • listBillableObjectBindings
        • updateAccessBindings
      • Budget
        • Overview
        • create
        • get
        • list
      • Customer
        • Overview
        • activate
        • invite
        • list
        • suspend
      • Service
        • Overview
        • get
        • list
      • Sku
        • Overview
        • get
        • list
  1. API reference
  2. REST
  3. Budget
  4. create

Method create

Written by
Yandex Cloud
  • HTTP request
  • Body parameters
  • Response

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"
          ]
        }
      ]
    },
    "endDate": "string",

    // `costBudgetSpec` includes only one of the fields `resetPeriod`, `startDate`
    "resetPeriod": "string",
    "startDate": "string",
    // end of the list of possible fields`costBudgetSpec`

  },
  "expenseBudgetSpec": {
    "amount": "string",
    "notificationUserAccountIds": [
      "string"
    ],
    "thresholdRules": [
      {
        "type": "string",
        "amount": "string",
        "notificationUserAccountIds": [
          "string"
        ]
      }
    ],
    "filter": {
      "serviceIds": [
        "string"
      ],
      "cloudFoldersFilters": [
        {
          "cloudId": "string",
          "folderIds": [
            "string"
          ]
        }
      ]
    },
    "endDate": "string",

    // `expenseBudgetSpec` includes only one of the fields `resetPeriod`, `startDate`
    "resetPeriod": "string",
    "startDate": "string",
    // end of the list of possible fields`expenseBudgetSpec`

  },
  "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. ID of the billing account to list budgets corresponding to. To get the billing account ID, use list request.

The maximum string length in characters is 50.

name string

Required. Name of the budget.

costBudgetSpec object
Cost budget specification.
includes only one of the fields costBudgetSpec, expenseBudgetSpec, balanceBudgetSpec

Cost budget specification describes budget that can be used to control cost of cloud resources usage.

costBudgetSpec.
amount
string

Max cost threshold of the budget. Amount currency is the same as corresponding BillingAccount.currency.

costBudgetSpec.
notificationUserAccountIds[]
string

IDs of the UserAccount. Specified users will be be notified if the budget exceeds.

costBudgetSpec.
thresholdRules[]
object

Rules that define intermediate cost thresholds of the budget.

costBudgetSpec.
thresholdRules[].
type
string

Type of the rule.

Define the unit of the [ThesholdRule.amount].

  • PERCENT: Percent.
  • AMOUNT: The same as budget amount.
costBudgetSpec.
thresholdRules[].
amount
string

Amount of the rule.

  • Must be less than 100 if type is PERCENT.
  • Must be less than budget's amount if type is AMOUNT.
costBudgetSpec.
thresholdRules[].
notificationUserAccountIds[]
string

IDs of the UserAccount. Specified users will be be notified if the threshold exceeds.

costBudgetSpec.
filter
object
Filter that can be used for specific resources selection. Only consumption expense of selected resources are used for the budget calculation.

Filter that can be used for specific resources selection.

costBudgetSpec.
filter.
serviceIds[]
string

IDs of the Service. Only consumption of resources corresponding to the given services is used for the budget calculation. Empty sequence means no services filters.

costBudgetSpec.
filter.
cloudFoldersFilters[]
object

Filter that can be used for specific cloud and its folders selection.

costBudgetSpec.
filter.
cloudFoldersFilters[].
cloudId
string

ID of the Cloud. Only consumption within specified cloud is used for the budget calculation.

costBudgetSpec.
filter.
cloudFoldersFilters[].
folderIds[]
string

IDs of the Folder. Only consumption within specified folders of the given cloud is used for the budget calculation. Empty sequence means no folders filters and the whole cloud consumption will be used.

costBudgetSpec.
endDate
string

End date of the budget. Must be the last day of a month and must be formatted like YYYY-MM-DD.

costBudgetSpec.
resetPeriod
string
Periodic start type that resets budget after specified period is finished. First time budget is calculated in the current period, i.e. current month, quarter or year.
costBudgetSpec includes only one of the fields resetPeriod, startDate

  • MONTHLY: Reset budget every month.
  • QUARTER: Reset budget every quarter.
  • ANNUALLY: Reset budget every year.
costBudgetSpec.
startDate
string
costBudgetSpec includes only one of the fields resetPeriod, startDate

Custom start date of the budget. Must be the first day of a month and must be formatted like YYYY-MM-DD.

expenseBudgetSpec object
Expense budget specification.
includes only one of the fields costBudgetSpec, expenseBudgetSpec, balanceBudgetSpec

Expense budget specification describes budget that can be used to control expense of cloud resources usage.

expenseBudgetSpec.
amount
string

Max expense threshold of the budget. Amount currency is the same as corresponding BillingAccount.currency.

expenseBudgetSpec.
notificationUserAccountIds[]
string

IDs of the UserAccount. Specified users will be be notified if the budget exceeds.

expenseBudgetSpec.
thresholdRules[]
object

Rules that define intermediate cost thresholds of the budget.

expenseBudgetSpec.
thresholdRules[].
type
string

Type of the rule.

Define the unit of the [ThesholdRule.amount].

  • PERCENT: Percent.
  • AMOUNT: The same as budget amount.
expenseBudgetSpec.
thresholdRules[].
amount
string

Amount of the rule.

  • Must be less than 100 if type is PERCENT.
  • Must be less than budget's amount if type is AMOUNT.
expenseBudgetSpec.
thresholdRules[].
notificationUserAccountIds[]
string

IDs of the UserAccount. Specified users will be be notified if the threshold exceeds.

expenseBudgetSpec.
filter
object
Filter that can be used for specific resources selection. Only consumption cost of selected resources are used for the budget calculation.

Filter that can be used for specific resources selection.

expenseBudgetSpec.
filter.
serviceIds[]
string

IDs of the Service. Only consumption of resources corresponding to the given services is used for the budget calculation. Empty sequence means no services filters.

expenseBudgetSpec.
filter.
cloudFoldersFilters[]
object

Filter that can be used for specific cloud and its folders selection.

expenseBudgetSpec.
filter.
cloudFoldersFilters[].
cloudId
string

ID of the Cloud. Only consumption within specified cloud is used for the budget calculation.

expenseBudgetSpec.
filter.
cloudFoldersFilters[].
folderIds[]
string

IDs of the Folder. Only consumption within specified folders of the given cloud is used for the budget calculation. Empty sequence means no folders filters and the whole cloud consumption will be used.

expenseBudgetSpec.
endDate
string

End date of the budget. Must be the last day of a month and must be formatted like YYYY-MM-DD.

expenseBudgetSpec.
resetPeriod
string
Periodic start type that resets budget after specified period is finished. First time budget is calculated in the current period, i.e. current month, quarter or year.
expenseBudgetSpec includes only one of the fields resetPeriod, startDate

  • MONTHLY: Reset budget every month.
  • QUARTER: Reset budget every quarter.
  • ANNUALLY: Reset budget every year.
expenseBudgetSpec.
startDate
string
expenseBudgetSpec includes only one of the fields resetPeriod, startDate

Custom start date of the budget. Must be the first day of a month and must be formatted like YYYY-MM-DD.

balanceBudgetSpec object
Balance budget specification.
includes only one of the fields costBudgetSpec, expenseBudgetSpec, balanceBudgetSpec

Balance budget specification describes budget that can be used to control BillingAccount.balance.

balanceBudgetSpec.
amount
string

Max balance threshold of the budget. Amount currency is the same as corresponding BillingAccount.currency.

balanceBudgetSpec.
notificationUserAccountIds[]
string

IDs of the UserAccount. Specified users will be be notified if the budget exceeds.

balanceBudgetSpec.
thresholdRules[]
object

Rules that define intermediate cost thresholds of the budget.

balanceBudgetSpec.
thresholdRules[].
type
string

Type of the rule.

Define the unit of the [ThesholdRule.amount].

  • PERCENT: Percent.
  • AMOUNT: The same as budget amount.
balanceBudgetSpec.
thresholdRules[].
amount
string

Amount of the rule.

  • Must be less than 100 if type is PERCENT.
  • Must be less than budget's amount if type is AMOUNT.
balanceBudgetSpec.
thresholdRules[].
notificationUserAccountIds[]
string

IDs of the UserAccount. Specified users will be be notified if the threshold exceeds.

balanceBudgetSpec.
startDate
string

Start_date of the budget. Must be the first day of a month and must be formatted like YYYY-MM-DD.

balanceBudgetSpec.
endDate
string

End date of the budget. Must be the last day of a month and must be formatted like YYYY-MM-DD.

Response

HTTP Code: 200 - OK

{
  "id": "string",
  "description": "string",
  "createdAt": "string",
  "createdBy": "string",
  "modifiedAt": "string",
  "done": true,
  "metadata": "object",

  //  includes only one of the fields `error`, `response`
  "error": {
    "code": "integer",
    "message": "string",
    "details": [
      "object"
    ]
  },
  "response": "object",
  // 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 text format.

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 text format.

done boolean (boolean)

If the value is false, it means the operation is still in progress. If true, the operation is completed, and either error or response is available.

metadata object

Service-specific metadata associated with the operation. It typically contains the ID of the target resource that the operation is performed on. Any method that returns a long-running operation should document the metadata type, if any.

error object
The error result of the operation in case of failure or cancellation.
includes only one of the fields error, response

The error result of the operation in case of failure or cancellation.

error.
code
integer (int32)

Error code. An enum value of google.rpc.Code.

error.
message
string

An error message.

error.
details[]
object

A list of messages that carry the error details.

response object
includes only one of the fields error, response

The normal response of the operation in case of success. If the original method returns no data on success, such as Delete, the response is google.protobuf.Empty. If the original method is the standard Create/Update, the response should be the target resource of the operation. Any method that returns a long-running operation should document the response type, if any.

Was the article helpful?

Language / Region
© 2022 Yandex.Cloud LLC
In this article:
  • HTTP request
  • Body parameters
  • Response