Skip to main content
POST
Create a budget

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

Idempotency-Key
string
required

Required; reuse it only to retry the same request

Path Parameters

id_or_alias
string
required

Customer ID or alias

Body

application/json
amount
integer<int64>
required

In minor units of the currency or credit unit.

behavior
enum<string> | null

Defaults to SOFT.

Available options:
SOFT,
HARD
credit_unit
string | null

A credit unit (its code): the budget counts the usage priced in that unit, in its minor units.

currency
enum<string> | null

A currency the customer is billed in. Set exactly one of currency and credit_unit; a customer has one active budget per currency or credit unit, and per subscription.

Available options:
AED,
AFN,
ALL,
AMD,
ANG,
AOA,
ARS,
AUD,
AWG,
AZN,
BAM,
BBD,
BDT,
BGN,
BHD,
BIF,
BMD,
BND,
BOB,
BRL,
BSD,
BTN,
BWP,
BYN,
BZD,
CAD,
CDF,
CHF,
CLP,
CNH,
CNY,
COP,
CRC,
CUC,
CUP,
CVE,
CZK,
DJF,
DKK,
DOP,
DZD,
EGP,
ERN,
ETB,
EUR,
FJD,
FKP,
GBP,
GEL,
GHS,
GIP,
GMD,
GNF,
GTQ,
GYD,
HKD,
HNL,
HRK,
HTG,
HUF,
IDR,
ILS,
INR,
IQD,
IRR,
ISK,
JMD,
JOD,
JPY,
KES,
KGS,
KHR,
KMF,
KPW,
KRW,
KWD,
KYD,
KZT,
LAK,
LBP,
LKR,
LRD,
LSL,
LYD,
MAD,
MDL,
MGA,
MKD,
MMK,
MNT,
MOP,
MRU,
MUR,
MVR,
MWK,
MXN,
MYR,
MZN,
NAD,
NGN,
NIO,
NOK,
NPR,
NZD,
OMR,
PAB,
PEN,
PGK,
PHP,
PKR,
PLN,
PYG,
QAR,
RON,
RSD,
RUB,
RWF,
SAR,
SBD,
SCR,
SDG,
SEK,
SGD,
SHP,
SLL,
SOS,
SRD,
SSP,
STD,
STN,
SVC,
SYP,
SZL,
THB,
TJS,
TMT,
TND,
TOP,
TRY,
TTD,
TWD,
TZS,
UAH,
UGX,
USD,
UYU,
UZS,
VES,
VND,
VUV,
WST,
XAF,
XCD,
XOF,
XPF,
YER,
ZAR,
ZMW,
ZWL
Example:

"EUR"

subscription_id
string | null

An active subscription of the customer (sub_…): the budget then counts only that subscription's spend, in its currency. Absent counts the whole customer's.

thresholds
integer<int32>[] | null

Percentages of the amount (1 to 100, at most 10). Defaults to 50, 80 and 100.

Required range: x >= 0

Response

Budget created

A spending limit for one currency, set by you or by the customer, with alerts at percentages of it. It counts the customer's whole spend, or one subscription's. A HARD budget also refuses access once reached. A budget never charges the customer.

amount
integer<int64>
required

In minor units of the currency or credit unit.

behavior
enum<string>
required

What reaching the amount does. A SOFT budget only sends alerts; a HARD budget also makes the entitlement check answer BUDGET_EXCEEDED for the features whose usage counts in its spend. A HARD budget on one subscription refuses the checks naming that subscription, and the checks naming none once every subscription charging the feature's metric is refused by its own.

Available options:
SOFT,
HARD
created_at
string<date-time>
required
created_by
enum<string>
required

Who set the budget: you (TENANT) or the customer, from the portal (CUSTOMER).

Available options:
TENANT,
CUSTOMER
exact
boolean
required

Always false: the estimate prices usage that is not yet invoiced.

id
string
required
thresholds
integer<int32>[]
required

Percentages of the amount at which an alert is sent.

Required range: x >= 0
updated_at
string<date-time>
required
version
integer<int32>
required

Send it back as expected_version when patching.

archived_at
string<date-time> | null
as_of
string<date-time> | null

When estimated_spend was last measured.

credit_unit
string | null

The credit unit (its code) whose usage the budget counts; absent for a currency.

credit_unit_precision
integer<int32> | null

Decimal places of credit_unit: amounts are integers of 10^-precision credit.

Required range: x >= 0
currency
enum<string> | null

The currency the budget counts spend in; absent for a budget in a credit unit.

Available options:
AED,
AFN,
ALL,
AMD,
ANG,
AOA,
ARS,
AUD,
AWG,
AZN,
BAM,
BBD,
BDT,
BGN,
BHD,
BIF,
BMD,
BND,
BOB,
BRL,
BSD,
BTN,
BWP,
BYN,
BZD,
CAD,
CDF,
CHF,
CLP,
CNH,
CNY,
COP,
CRC,
CUC,
CUP,
CVE,
CZK,
DJF,
DKK,
DOP,
DZD,
EGP,
ERN,
ETB,
EUR,
FJD,
FKP,
GBP,
GEL,
GHS,
GIP,
GMD,
GNF,
GTQ,
GYD,
HKD,
HNL,
HRK,
HTG,
HUF,
IDR,
ILS,
INR,
IQD,
IRR,
ISK,
JMD,
JOD,
JPY,
KES,
KGS,
KHR,
KMF,
KPW,
KRW,
KWD,
KYD,
KZT,
LAK,
LBP,
LKR,
LRD,
LSL,
LYD,
MAD,
MDL,
MGA,
MKD,
MMK,
MNT,
MOP,
MRU,
MUR,
MVR,
MWK,
MXN,
MYR,
MZN,
NAD,
NGN,
NIO,
NOK,
NPR,
NZD,
OMR,
PAB,
PEN,
PGK,
PHP,
PKR,
PLN,
PYG,
QAR,
RON,
RSD,
RUB,
RWF,
SAR,
SBD,
SCR,
SDG,
SEK,
SGD,
SHP,
SLL,
SOS,
SRD,
SSP,
STD,
STN,
SVC,
SYP,
SZL,
THB,
TJS,
TMT,
TND,
TOP,
TRY,
TTD,
TWD,
TZS,
UAH,
UGX,
USD,
UYU,
UZS,
VES,
VND,
VUV,
WST,
XAF,
XCD,
XOF,
XPF,
YER,
ZAR,
ZMW,
ZWL
Example:

"EUR"

estimated_spend
integer<int64> | null

Spend in the current billing period, including usage not invoiced yet, in minor units. Absent until first measured.

period
object | null

The current billing period: of subscription_id when set. Absent for an archived budget, or without an active subscription to measure it on.

subscription_id
string | null

The subscription whose spend the budget counts; null when it counts the whole customer's.