---
title: Budgets
description: Set a daily or monthly spend budget in US dollars for your
  organization, a workspace or an environment, get email alerts as it fills, and
  optionally stop priced work when it is used up.
url: https://hexelstudio.com/docs/titan/budgets
---

A **budget** is a spend limit in US dollars for one day or one calendar month (UTC), for your whole organization, one workspace or one environment. Hexel Studio emails the address on your billing profile (and its cc addresses) as spend reaches the budget's alert percentages. An **enforced** budget is also a hard stop: once it is used up, priced work in its scope is refused.

<Note>
In these docs, "budget" always means this billing budget in US dollars. Other limits have their own names: an agent session's limits in its session profile, a plan's monthly governed-action limit, and a Titan Harness task's `max_usd` ([Budgets and estimates](https://hexelstudio.com/docs/harness/budgets-and-estimates)).
</Note>

## Create a budget

<Tabs>
  <Tab title="CLI">
    With the [Hexel CLI](https://hexelstudio.com/docs/cli/overview) 0.11.1 or later:

    ```bash
    # $500 a month for the whole organization, alerts at 80% and 100%
    hexel billing budget create --name "Org monthly" --usd 500

    # A hard stop: $25 a day for one environment
    hexel billing budget create --name "Prod daily" --usd 25 --period day \
      --scope environment --env env_prod --enforce

    # A workspace budget with your own alert percentages
    hexel billing budget create --name "Team" --usd 100 --scope workspace --alert 50,90,100
    ```

    `hexel billing budgets` lists every budget with what it has spent this period; `hexel billing budget update <ID>` changes only the flags you pass, and `hexel billing budget delete <ID>` removes one.
  </Tab>
  <Tab title="API">
    ```bash
    curl -X POST https://api.hexelstudio.com/v1/billing/budgets \
      -H "Authorization: Bearer $ACCESS_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
        "name": "Prod daily",
        "scope": "environment",
        "workspace_id": "ws_7f2",
        "environment_id": "env_prod",
        "usd_micros": 25000000,
        "period": "day",
        "enforce": true,
        "alert_percents": [80, 100]
      }'
    ```

    The answer is `201` with the budget and its `budget_id`.
  </Tab>
</Tabs>

## Fields

| Field | Meaning |
| --- | --- |
| `name` | 1 to 200 characters. |
| `scope` | `org`, `workspace` or `environment`. A workspace budget takes `workspace_id`; an environment budget takes `workspace_id` and `environment_id`; an organization budget takes neither. |
| `usd_micros` | The limit in millionths of a US dollar, more than 0. `25000000` is $25. |
| `period` | `day` or `month`, in UTC. |
| `enforce` | `true` makes the budget a hard stop. Default `false`: alerts only. |
| `alert_percents` | Percentages of the limit (1 to 1000) at which an alert is emailed, each at most once a period. When spend jumps past several at once, only the highest is sent. Default `[80, 100]`. |

You can have one budget per scope and period: a second one for the same workspace and period is refused with `409 budget_exists`.

## Read and change budgets

| Method and path | What it does | Permission |
| --- | --- | --- |
| `GET /v1/billing/budgets` | Every budget with `spent_usd_micros`, `period_start` and `period_end` | `org:billing:read` |
| `GET /v1/billing/budgets/{budget_id}` | One budget with its spend this period | `org:billing:read` |
| `POST /v1/billing/budgets` | Create a budget | `org:billing:manage` |
| `PUT /v1/billing/budgets/{budget_id}` | Replace every setting of a budget | `org:billing:manage` |
| `DELETE /v1/billing/budgets/{budget_id}` | Delete a budget; alerts already queued are still sent | `org:billing:manage` |

Spend so far is the larger of the settled cost and the real-time counter for the period, so a budget still counts while usage is being settled. After a `PUT`, alerts already sent this period are not sent again for the same percentages.

Errors have the body `{"error": "<code>", "message": "..."}`: `400 invalid_request` for a field that breaks the rules above, `404 budget_not_found`, `409 budget_exists`, and `503` when billing can't be read (try again).

## What an enforced budget stops

When an enforced budget that covers the request (the organization's, its workspace's or its environment's) is used up, or the request's estimated cost would pass it, Hexel Studio refuses the priced request with the reason `budget_exceeded`. Requests that are not priced, such as reading your settings, are never refused by a budget.

### Titan governed actions

Titan checks your plan before it lets an agent act:

- **Monthly governed-action limit.** A plan that sets a monthly limit on governed actions (the trial does) refuses the action once the limit is reached, with `409 GOVERNED_ACTION_LIMIT_REACHED`, before anything runs. The agent gets the refusal on its call. The refusal is not written to the [Agent Ledger](https://hexelstudio.com/docs/titan/agent-ledger); only plan refusals (`402`) are.
- **Enforced budgets.** Titan Cloud does not yet stop governed actions on an enforced budget: governed actions still count toward your budgets' spend and alerts. When this is turned on, an action refused by a budget will answer `409 GOVERNED_ACTION_BUDGET_EXCEEDED`.

If billing can't be reached, a governed action goes ahead and is still metered and billed afterwards.

## See also

- [Errors](https://hexelstudio.com/docs/api/errors) for Titan's error codes.
- [Kill switch](https://hexelstudio.com/docs/titan/kill-switch) to stop an agent at once, whatever it has spent.
