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

# Change a token budget's limits, action or state



## OpenAPI

````yaml put /api/airouter/budgets/{budget_id}
openapi: 3.1.0
info:
  title: Nx1 AI API
  description: |

    AI API for Nx1 Data Platform Management and Automated Data Tasks.

    Authentication is required via PSK in Authorization header.

    Default PSK is | [ask a friend] |
  version: 0.10.2
servers: []
security: []
paths:
  /api/airouter/budgets/{budget_id}:
    put:
      tags:
        - AI Router
      summary: Change a token budget's limits, action or state
      operationId: update_budget_api_airouter_budgets__budget_id__put
      parameters:
        - name: budget_id
          in: path
          required: true
          schema:
            type: string
            title: Budget Id
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TokenBudgetRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenBudget'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - OAuth2AuthorizationCodeBearer: []
        - APIKeyHeader: []
components:
  schemas:
    TokenBudgetRequest:
      properties:
        scope:
          type: string
          enum:
            - user
            - team
          title: Scope
        subject:
          type: string
          maxLength: 255
          minLength: 1
          title: Subject
        description:
          anyOf:
            - type: string
              maxLength: 200
            - type: 'null'
          title: Description
        limits:
          $ref: '#/components/schemas/BudgetLimits'
        action:
          type: string
          enum:
            - block
            - warn
          title: Action
          default: block
        enabled:
          type: boolean
          title: Enabled
          default: true
      type: object
      required:
        - scope
        - subject
        - limits
      title: TokenBudgetRequest
      description: Create or replace a budget. Scope and subject can't change on update.
    TokenBudget:
      properties:
        id:
          type: string
          title: Id
        scope:
          type: string
          enum:
            - user
            - team
          title: Scope
        subject:
          type: string
          title: Subject
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        action:
          type: string
          enum:
            - block
            - warn
          title: Action
          default: block
        enabled:
          type: boolean
          title: Enabled
          default: true
        periods:
          additionalProperties:
            $ref: '#/components/schemas/PeriodUsage'
          propertyNames:
            enum:
              - daily
              - weekly
              - monthly
          type: object
          title: Periods
        active_members:
          anyOf:
            - type: integer
            - type: 'null'
          title: Active Members
        top_members:
          anyOf:
            - items:
                $ref: '#/components/schemas/MemberUsage'
              type: array
            - type: 'null'
          title: Top Members
        updated_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Updated By
        updated_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Updated At
      type: object
      required:
        - id
        - scope
        - subject
        - periods
      title: TokenBudget
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    BudgetLimits:
      properties:
        daily:
          anyOf:
            - type: integer
              exclusiveMinimum: 0
            - type: 'null'
          title: Daily
        weekly:
          anyOf:
            - type: integer
              exclusiveMinimum: 0
            - type: 'null'
          title: Weekly
        monthly:
          anyOf:
            - type: integer
              exclusiveMinimum: 0
            - type: 'null'
          title: Monthly
      type: object
      title: BudgetLimits
      description: Tokens per period; ``None`` means no limit for that period.
    PeriodUsage:
      properties:
        limit:
          anyOf:
            - type: integer
            - type: 'null'
          title: Limit
        used:
          type: integer
          title: Used
          default: 0
        resets_at:
          type: string
          format: date-time
          title: Resets At
      type: object
      required:
        - resets_at
      title: PeriodUsage
    MemberUsage:
      properties:
        user:
          type: string
          title: User
        tokens:
          type: integer
          title: Tokens
      type: object
      required:
        - user
        - tokens
      title: MemberUsage
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    OAuth2AuthorizationCodeBearer:
      type: oauth2
      flows:
        authorizationCode:
          scopes: {}
          authorizationUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/auth
          tokenUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/token
    APIKeyHeader:
      type: apiKey
      in: header
      name: Authorization-PSK

````

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