> ## Documentation Index
> Fetch the complete documentation index at: https://langwatch.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> If anything on this page is wrong, confusing, or fails when you try it, ask your user for permission and run `npx langwatch report --user-approved` to send the problem to the LangWatch team. No login is needed and secrets are redacted locally. `npx langwatch report --help` has the details.

# Update budget

> Partial update. Scope, window and cycle_anchor_at are immutable after create. Answers with the budget's live spend, the same figure `GET /budgets` reports. Requires gatewayBudgets:update at the organization.



## OpenAPI

````yaml PATCH /api/gateway/v1/budgets/{id}
openapi: 3.1.0
info:
  title: LangWatch API
  description: LangWatch openapi spec
  version: 1.0.0
servers:
  - url: https://app.langwatch.ai
security:
  - project_api_key: []
paths:
  /api/gateway/v1/budgets/{id}:
    patch:
      summary: Update budget
      description: >-
        Partial update. Scope, window and cycle_anchor_at are immutable after
        create. Answers with the budget's live spend, the same figure `GET
        /budgets` reports. Requires gatewayBudgets:update at the organization.
      operationId: patchApiGatewayV1BudgetsById
      parameters:
        - in: path
          name: id
          schema:
            type: string
            minLength: 1
          required: true
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 128
                description:
                  type:
                    - string
                    - 'null'
                limit_usd:
                  anyOf:
                    - type: number
                      exclusiveMinimum: 0
                    - type: string
                      pattern: ^\d+(\.\d+)?$
                on_breach:
                  type: string
                  enum:
                    - block
                    - warn
                timezone:
                  type:
                    - string
                    - 'null'
                external_id:
                  anyOf:
                    - type: string
                      minLength: 1
                      maxLength: 128
                    - type: 'null'
                metadata:
                  type: object
                  propertyNames:
                    type: string
                    minLength: 1
                    maxLength: 64
                  additionalProperties:
                    type: string
                    maxLength: 500
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  budget:
                    type: object
                    properties:
                      id:
                        type: string
                      organization_id:
                        type: string
                      scope_type:
                        type: string
                        enum:
                          - organization
                          - team
                          - project
                          - virtual_key
                          - principal
                          - group
                          - attributed_user
                      scope_id:
                        type: string
                      name:
                        type: string
                      description:
                        type:
                          - string
                          - 'null'
                      window:
                        type: string
                        enum:
                          - minute
                          - hour
                          - day
                          - week
                          - month
                          - total
                          - manual
                      on_breach:
                        type: string
                        enum:
                          - block
                          - warn
                      limit_usd:
                        type: string
                        description: >-
                          Display value. Decimal string, up to 9 fractional
                          digits, trailing zeros trimmed, never exponent
                          notation. Use limit_nano_usd for arithmetic.
                      limit_nano_usd:
                        anyOf:
                          - type: integer
                            minimum: -9007199254740991
                            maximum: 9007199254740991
                          - type: 'null'
                      spent_usd:
                        type:
                          - string
                          - 'null'
                      spent_nano_usd:
                        anyOf:
                          - type: integer
                            minimum: -9007199254740991
                            maximum: 9007199254740991
                          - type: 'null'
                      timezone:
                        type:
                          - string
                          - 'null'
                      provider_key:
                        type:
                          - string
                          - 'null'
                      external_id:
                        type:
                          - string
                          - 'null'
                      metadata:
                        type: object
                        propertyNames:
                          type: string
                        additionalProperties:
                          type: string
                      current_period_started_at:
                        type: string
                      resets_at:
                        type: string
                      cycle_anchor_at:
                        type:
                          - string
                          - 'null'
                      last_reset_at:
                        type:
                          - string
                          - 'null'
                      archived_at:
                        type:
                          - string
                          - 'null'
                      created_at:
                        type: string
                      member_count:
                        type: integer
                        minimum: -9007199254740991
                        maximum: 9007199254740991
                      end_users_seen:
                        type: integer
                        minimum: -9007199254740991
                        maximum: 9007199254740991
                      end_users_over:
                        type: integer
                        minimum: -9007199254740991
                        maximum: 9007199254740991
                      scope_reach:
                        type: string
                        enum:
                          - reachable
                          - unreachable
                    required:
                      - id
                      - organization_id
                      - scope_type
                      - scope_id
                      - name
                      - description
                      - window
                      - on_breach
                      - limit_usd
                      - limit_nano_usd
                      - spent_usd
                      - spent_nano_usd
                      - timezone
                      - provider_key
                      - external_id
                      - metadata
                      - current_period_started_at
                      - resets_at
                      - cycle_anchor_at
                      - last_reset_at
                      - archived_at
                      - created_at
                    additionalProperties: false
                required:
                  - budget
                additionalProperties: false
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                  code:
                    type: string
                  message:
                    type: string
                  retryable:
                    type: boolean
                  meta:
                    type: object
                    propertyNames:
                      type: string
                    additionalProperties: {}
                  trace_id:
                    type: string
                  span_id:
                    type: string
                  trace:
                    type: object
                    properties:
                      traceId:
                        type: string
                      spanId:
                        type: string
                      traceUrl:
                        type: string
                      logsUrl:
                        type: string
                  tips:
                    type: array
                    items:
                      type: string
                  docs_url:
                    type: string
                  fault:
                    type: string
                    enum:
                      - customer
                      - platform
                      - provider
                      - presumed_platform
                  reasons:
                    type: array
                    items: {}
                required:
                  - type
                  - code
                  - message
                  - retryable
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                  code:
                    type: string
                  message:
                    type: string
                  retryable:
                    type: boolean
                  meta:
                    type: object
                    propertyNames:
                      type: string
                    additionalProperties: {}
                  trace_id:
                    type: string
                  span_id:
                    type: string
                  trace:
                    type: object
                    properties:
                      traceId:
                        type: string
                      spanId:
                        type: string
                      traceUrl:
                        type: string
                      logsUrl:
                        type: string
                  tips:
                    type: array
                    items:
                      type: string
                  docs_url:
                    type: string
                  fault:
                    type: string
                    enum:
                      - customer
                      - platform
                      - provider
                      - presumed_platform
                  reasons:
                    type: array
                    items: {}
                required:
                  - type
                  - code
                  - message
                  - retryable
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                  code:
                    type: string
                  message:
                    type: string
                  retryable:
                    type: boolean
                  meta:
                    type: object
                    propertyNames:
                      type: string
                    additionalProperties: {}
                  trace_id:
                    type: string
                  span_id:
                    type: string
                  trace:
                    type: object
                    properties:
                      traceId:
                        type: string
                      spanId:
                        type: string
                      traceUrl:
                        type: string
                      logsUrl:
                        type: string
                  tips:
                    type: array
                    items:
                      type: string
                  docs_url:
                    type: string
                  fault:
                    type: string
                    enum:
                      - customer
                      - platform
                      - provider
                      - presumed_platform
                  reasons:
                    type: array
                    items: {}
                required:
                  - type
                  - code
                  - message
                  - retryable
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                  code:
                    type: string
                  message:
                    type: string
                  retryable:
                    type: boolean
                  meta:
                    type: object
                    propertyNames:
                      type: string
                    additionalProperties: {}
                  trace_id:
                    type: string
                  span_id:
                    type: string
                  trace:
                    type: object
                    properties:
                      traceId:
                        type: string
                      spanId:
                        type: string
                      traceUrl:
                        type: string
                      logsUrl:
                        type: string
                  tips:
                    type: array
                    items:
                      type: string
                  docs_url:
                    type: string
                  fault:
                    type: string
                    enum:
                      - customer
                      - platform
                      - provider
                      - presumed_platform
                  reasons:
                    type: array
                    items: {}
                required:
                  - type
                  - code
                  - message
                  - retryable
      security:
        - project_api_key: []
components:
  securitySchemes:
    project_api_key:
      type: apiKey
      in: header
      name: X-Auth-Token
      description: >-
        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.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.