> ## 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.

# Reset budget period

> Moves the budget's period boundary to now and recomputes the next reset; recorded spend is NEVER mutated (the ledger and every emitted billing event are immutable, so reconciliation is unaffected). On calendar windows this truncates the running period and the next boundary stays calendar; on `manual` windows the new period stays open until the next reset. For attributed-user templates, `end_user_id` resets ONE end-user bucket's boundary and leaves the template period untouched.



## OpenAPI

````yaml POST /api/gateway/v1/budgets/{id}/reset
openapi: 3.1.0
info:
  title: LangWatch API
  version: 1.0.0
  description: LangWatch openapi spec
servers:
  - url: https://app.langwatch.ai
security:
  - project_api_key: []
paths:
  /api/gateway/v1/budgets/{id}/reset:
    post:
      tags:
        - Budgets
      summary: Reset budget period
      description: >-
        Moves the budget's period boundary to now and recomputes the next reset;
        recorded spend is NEVER mutated (the ledger and every emitted billing
        event are immutable, so reconciliation is unaffected). On calendar
        windows this truncates the running period and the next boundary stays
        calendar; on `manual` windows the new period stays open until the next
        reset. For attributed-user templates, `end_user_id` resets ONE end-user
        bucket's boundary and leaves the template period untouched.
      operationId: postApiGatewayV1BudgetsByIdReset
      parameters:
        - in: query
          name: end_user_id
          schema:
            type: string
            minLength: 1
            description: >-
              Resets ONE end-user bucket on an attributed-user template, leaving
              the template period untouched.
        - schema:
            type: string
          in: path
          name: id
          required: true
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                reason:
                  type: string
                  maxLength: 500
                  description: Free-text operator note, audit-logged with the reset.
      responses:
        '200':
          description: Reset
          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:
                        type:
                          - integer
                          - 'null'
                        description: >-
                          Canonical integer amount, nano-USD. Null past the safe
                          integer range, where limit_usd still reads.
                      spent_usd:
                        type:
                          - string
                          - 'null'
                        description: >-
                          Display value, null when spend_available is false.
                          Decimal string, up to 9 fractional digits, trailing
                          zeros trimmed, never exponent notation. Use
                          spent_nano_usd for arithmetic.
                      spent_nano_usd:
                        type:
                          - integer
                          - 'null'
                        description: >-
                          Canonical integer spend, nano-USD. Null when spend is
                          unavailable. Derived from the same integer as
                          spent_usd, so the pair always agrees.
                      timezone:
                        type:
                          - string
                          - 'null'
                      provider_key:
                        type:
                          - string
                          - 'null'
                      external_id:
                        type:
                          - string
                          - 'null'
                      metadata:
                        type: object
                        additionalProperties:
                          type: string
                      current_period_started_at:
                        type: string
                        description: >-
                          Start of the period `spent_usd` covers, computed at
                          read time. For an anchored budget this is its own
                          cycle's start, not the calendar period's.
                      resets_at:
                        type: string
                        description: >-
                          When the current period gives way to the next.
                          Far-future for total and manual windows, which do not
                          roll on their own.
                      cycle_anchor_at:
                        type:
                          - string
                          - 'null'
                        description: >-
                          The instant this budget's cycle is phased to. Null
                          means no anchor: a calendar-aligned cyclic window, or
                          one of the two windows that do not cycle (total,
                          manual).
                      last_reset_at:
                        type:
                          - string
                          - 'null'
                      archived_at:
                        type:
                          - string
                          - 'null'
                      created_at:
                        type: string
                      member_count:
                        type: integer
                      end_users_seen:
                        type: integer
                      end_users_over:
                        type: integer
                    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
                required:
                  - budget
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      type:
                        type: string
                      code:
                        type: string
                      message:
                        type: string
                      meta:
                        type: object
                        additionalProperties: {}
                      trace_id:
                        type: string
                      span_id:
                        type: string
                    required:
                      - type
                      - code
                      - message
                required:
                  - error
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      type:
                        type: string
                      code:
                        type: string
                      message:
                        type: string
                      meta:
                        type: object
                        additionalProperties: {}
                      trace_id:
                        type: string
                      span_id:
                        type: string
                    required:
                      - type
                      - code
                      - message
                required:
                  - error
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      type:
                        type: string
                      code:
                        type: string
                      message:
                        type: string
                      meta:
                        type: object
                        additionalProperties: {}
                      trace_id:
                        type: string
                      span_id:
                        type: string
                    required:
                      - type
                      - code
                      - message
                required:
                  - error
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      type:
                        type: string
                      code:
                        type: string
                      message:
                        type: string
                      meta:
                        type: object
                        additionalProperties: {}
                      trace_id:
                        type: string
                      span_id:
                        type: string
                    required:
                      - type
                      - code
                      - message
                required:
                  - error
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.

````