Skip to main content
POST
Create budget

Authorizations

X-Auth-Token
string
header
required

Project API key for sending traces and accessing project-scoped resources. Format: sk-lw-... (no underscore). Obtain one by creating a project via the Admin API or the LangWatch UI.

Headers

Idempotency-Key
string

A caller-chosen key, 8 to 255 characters, that makes this create safe to retry. The first request to use a key runs normally and its response is stored for 24 hours. A later request with the same key and the same body is not executed again: it returns the stored response, marked with X-Idempotent-Replay: true. The same key with a different body is refused 409 idempotency_error, as is a retry sent while the original is still running. Only successful responses are stored, so a create that failed can simply be retried with the same key.

Required string length: 8 - 255

Body

application/json
scope
object
required
name
string
required
Required string length: 1 - 128
window
enum<string>
required
Available options:
minute,
hour,
day,
week,
month,
total,
manual
limit_usd
required
Required range: x > 0
description
string
on_breach
enum<string>
Available options:
block,
warn
timezone
string | null
provider_key
string | null
external_id
string | null
Required string length: 1 - 128
metadata
object
cycle_anchor_at
string<date-time>

Phases the budget's cycle off this instant instead of the calendar, so a month budget anchored 2026-01-17T09:00:00Z starts a fresh period every 17th at 09:00 UTC. Omit for calendar alignment, which is the default and unchanged behaviour. A month cycle anchored past the 28th clamps into shorter months and springs back: anchored on the 31st gives Feb 28, then Mar 31. Immutable after create, since moving it would redraw periods the budget has already reported and enforced on. Rejected with gateway_budget_cycle_anchor_invalid on total and manual, which do not cycle.

allow_unreachable
boolean

Keeps a team, project or group budget that no active key can produce traffic for, which is otherwise refused with gateway_budget_scope_unreachable. Send it to provision ahead of the keys that will use the budget. An organization with no active keys is never refused, so this is not needed during first setup.

Response

Budget created

budget
object
required
Last modified on May 19, 2026