---
title: "Update spend alert or limit"
method: PUT
path: "/v1/projects/{project_id}/budgets/alerts/{alert_id}"
tags: ["budgets"]
---

# Update spend alert or limit

`PUT /v1/projects/{project_id}/budgets/alerts/{alert_id}`

## Request

- Base URL: `https://api.connic.co`
- URL: `https://api.connic.co/v1/projects/{project_id}/budgets/alerts/{alert_id}`
- Auth: HTTP bearer

Partial update: only supplied fields change. Changing `threshold_amount` or `currency` clears `last_triggered_at` so the alert can fire again in the current period. Raising a limit above current spend, or disabling it, releases runs it was holding in the queue.

Required permission: `budgets.manage`.

## Path parameters

- `project_id` string, uuid, required
- `alert_id` string, uuid, required

## Request body

- SpendAlertUpdate: Partial update of a spend rule. Omitted fields are unchanged.
  - `name` string, nullable
  - `type` 'alert' | 'limit', nullable: `alert` sends a notification when spend reaches the threshold. `limit` also keeps new runs queued until the period resets or the limit is raised, disabled or deleted.
  - `threshold_amount` union: Spend that triggers the rule, as a positive decimal string in `currency`. Changing it clears `last_triggered_at`.
    - number
    - string
  - `currency` 'EUR' | 'USD', nullable: Currency of the threshold. Changing it clears `last_triggered_at`.
  - `scope` 'global' | 'environment' | 'agent', nullable: `global` counts all project spend, `environment` only the environments in `scope_ids`, `agent` only the agents named in `scope_ids`.
  - `scope_ids` string[], nullable: Environment IDs or agent names, depending on `scope`. Ignored for `global`.
  - `period` 'monthly' | 'daily', nullable: Spend window: the current calendar month or the current day, in UTC.
  - `enabled` boolean, nullable: Whether the rule is evaluated.

## Response `200`

Successful Response

- SpendAlertResponse: A spend notification (`alert`) or hard cap (`limit`) for the project.
  - `id` string, uuid, required
  - `project_id` string, uuid, required: Project the rule belongs to.
  - `name` string, required
  - `type` 'alert' | 'limit', required: `alert` sends a notification when spend reaches the threshold; `limit` also keeps new runs queued.
  - `threshold_amount` string, required: Spend that triggers the rule, as a decimal string in `currency`.
  - `currency` 'USD' | 'EUR', required: Currency of the threshold and of `current_spend`.
  - `scope` 'global' | 'environment' | 'agent', required: `global` counts all project spend, `environment` only the environments in `scope_ids`, `agent` only the agents named in `scope_ids`.
  - `scope_ids` string[], nullable: Environment IDs or agent names, depending on `scope`.
  - `period` 'monthly' | 'daily', required: Spend window: the current calendar month or the current day, in UTC.
  - `enabled` boolean, required: Whether the rule is evaluated.
  - `last_triggered_at` string, date-time, nullable: When the rule last fired. It fires at most once per period.
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required
  - `current_spend` string, nullable: Spend so far in the current period, as a decimal string in `currency`. Null when some model calls could not be priced.
  - `current_spend_coverage` object: Pricing coverage of `current_spend`: `complete`, `call_count`, `priced_call_count`, `unpriced_call_count` and `unpriced_models`.

## Other responses

- `401`: Missing or invalid API key.
- `403`: The API key lacks the required permission or access to the environment.
- `404`: The resource does not exist in this project.
- `422`: Validation Error
- `429`: Rate limit exceeded.

---

[API](https://skmtc.dev/connic/apis/connic-api.md) · [All operations](https://skmtc.dev/connic/apis/connic-api/llms.txt) · [OpenAPI document](https://skmtc.dev/connic/apis/connic-api/revisions/482932da5fbe?raw)
