Update Workspace Spend Limit
Set, change or remove a workspace's daily, weekly or monthly spend limit.
Set, change or remove a workspace's spend limit. It covers spend in that workspace only and is checked independently of the organization limit, so it may be larger. The response is the updated spend limit.
POST /v1/organizations/workspaces/:workspace_id/spend_limitFields you leave out keep their value. Setting a limit where there is none
requires amount; the other fields then default to period: "monthly",
enforce: true and include_perks: true.
Path parameters
workspace_idstringrequiredThe workspace's ID.
Body
amountstring | number | nulloptionalThe limit in US dollars, greater than 0, with at most 8 decimals, such
as "20" or "2.50". null removes the limit; send no other field
with it.
periodstringoptionalHow often the limit starts over, in UTC: every day at 00:00, every Monday at 00:00, or on the 1st of the month at 00:00.
dailyweeklymonthlyenforcebooleanoptionaltrue refuses new requests in this workspace with 402 once the limit
is reached; false only reports.
include_perksbooleanoptionalWhether usage paid by perks counts toward the limit.
alertsobject[]optionalReplaces the limit's whole list of email alerts; [] removes them all.
Left out, the alerts stay as they are. Up to 5, each with its own
percent. Only a monthly limit takes alerts. They go to the
organization's owners, admins and billing members; recipients cannot
be chosen.
alerts[].percentintegerrequiredThe share of amount, from 1 to 200, that this month's spend
must reach. Above 100 is useful for a limit that is not enforced.
alerts[].enabledbooleanoptionalWhether the alert is sent. Defaults to true.
Any other field is rejected with 400.
Changing period to daily or weekly removes the limit's alerts.
Response
(object)SpendLimitoptionalThe updated spend limit object.
After a removal, amount is null and alerts is empty: removing a
limit removes its alerts.
The new limit applies to the next request; spend already counted in the current period counts toward it.
Errors
| Status | Reason |
|---|---|
400 | amount is not a positive amount, period is not one of the allowed values, a new limit has no amount, amount: null was sent with other fields, a non-empty alerts was sent for a daily or weekly limit, alerts holds more than 5 alerts, two with the same percent or an invalid value, the body has an unknown field, or the workspace is archived. |
404 | No workspace with this ID exists in your organization. |