Skip to content

budgets.createBudget

POST
/v1/organization/budgets
curl --request POST \
--url https://example.com/v1/organization/budgets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "scope": "organization", "scopeId": "example", "period": "day", "limitMicros": 1, "mode": "hard" }'

Adds a budget. Each scope can have one budget for each period.

Media typeapplication/json
object
scope
required
string
Allowed values: organization member bot token
scopeId
string
>= 1 characters <= 200 characters
period
required
string
Allowed values: day month
limitMicros
required
integer
<= 9007199254740991
mode
required
string
Allowed values: hard soft

Success

Media typeapplication/json
object
id
required
string
>= 1 characters <= 128 characters
scope
required
string
Allowed values: organization member bot token
scopeId
required
string
period
required
string
Allowed values: day month
limitMicros
required
integer
<= 9007199254740991
mode
required
string
Allowed values: hard soft
periodStart
required
string
spentMicros
required
integer
<= 9007199254740991
exceeded
required
boolean
version
required
integer
<= 9007199254740991
createdAt
required
string
updatedAt
required
string

Example

{
"scope": "organization",
"period": "day",
"mode": "hard"
}

UsageQueryInvalid | BudgetInvalid | OrganizationRequired

Media typeapplication/json
Any of:
object
_tag
required
string
Allowed values: UsageQueryInvalid
message
required
string

Example

{
"_tag": "UsageQueryInvalid"
}

AuthenticationRequired

Media typeapplication/json
object
_tag
required
string
Allowed values: AuthenticationRequired

Example

{
"_tag": "AuthenticationRequired"
}

@nmnmcc/ability/Authorizer/Forbidden | MembershipRequired | ForbiddenOrigin

Media typeapplication/json
Any of:
object
_tag
required
string
Allowed values: Forbidden
action
required
string
kind
required
string
field
string
reason
string

Example

{
"_tag": "Forbidden"
}

BudgetNotFound

Media typeapplication/json
object
_tag
required
string
Allowed values: BudgetNotFound
budgetId
required
string
>= 1 characters <= 128 characters

Example

{
"_tag": "BudgetNotFound"
}

@nmnmcc/ability/Authorizer/Pending | BudgetConflict

Media typeapplication/json
Any of:
object
_tag
required
string
Allowed values: Pending
ticket
required
string
reason
string

Example

{
"_tag": "Pending"
}

RateLimited

Media typeapplication/json
object
_tag
required
string
Allowed values: RateLimited
retryAfterSeconds
required
integer
>= -9007199254740991 <= 9007199254740991

Example

{
"_tag": "RateLimited"
}

BillingUnavailable | AuthenticationUnavailable | RequestFailed

Media typeapplication/json
Any of:
object
_tag
required
string
Allowed values: PolicyUnavailable

Example

{
"_tag": "PolicyUnavailable"
}