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

# Update the spend cap and/or the alert thresholds

> Every field is optional — only sent fields change; an empty body
returns current state unmodified. Mirrors the in-app mutators but
emits a single `budget.updated` audit event tagged `source: api` so
reviewers can tell API-driven changes from console changes.



## OpenAPI

````yaml /openapi/v1.json patch /usage/budget
openapi: 3.1.0
info:
  title: HASP AI API
  version: '2026-07-12'
  description: >-
    The HASP Public AI API is the regulated-AI substrate for healthcare and
    other

    regulated industries — identity, policy, audit, compliance, and PHI handling

    for AI inference, exposed via two surfaces:


    - **Native (`/v1/ai/*`)**: HASP-native chat with full event taxonomy, run
    lifecycle,
      and PHI metadata.
    - **Anthropic-compat (`/v1/messages`)**: Drop-in replacement for
    `@anthropic-ai/sdk` —
      change only `baseURL`. All Gateway compliance checks (BAA, credits, PHI policy) apply.

    All requests require an API key (`Authorization: Bearer
    hasp_api_live_<key>`). See

    [Authentication](https://docs.usehasp.com/ai-api/authentication) for key
    management.
servers:
  - url: https://api.usehasp.com/v1
    description: Production
security:
  - http: []
paths:
  /usage/budget:
    patch:
      tags:
        - Budget
      summary: Update the spend cap and/or the alert thresholds
      description: |-
        Every field is optional — only sent fields change; an empty body
        returns current state unmodified. Mirrors the in-app mutators but
        emits a single `budget.updated` audit event tagged `source: api` so
        reviewers can tell API-driven changes from console changes.
      operationId: v1.control.usage.budget.update
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateBudgetRequest'
      responses:
        '200':
          description: Updated budget settings.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: object
                    properties:
                      spend_cap:
                        type:
                          - integer
                          - 'null'
                      alert_thresholds:
                        type: array
                        items:
                          type: integer
                      credits_allotment:
                        type: integer
                    required:
                      - spend_cap
                      - alert_thresholds
                      - credits_allotment
                required:
                  - success
                  - data
        '401':
          description: Bearer token is missing, malformed, or revoked.
          content:
            application/json:
              schema:
                type: object
                example:
                  success: false
                  error:
                    type: authentication
                    code: INVALID_API_KEY
                    message: Bearer token is missing, malformed, or revoked.
                    param: null
                    details: null
                    retryable: false
                    request_id: 01JQREQ7XZQK5N6PZ1VVXHYB8T
                  meta:
                    request_id: 01JQREQ7XZQK5N6PZ1VVXHYB8T
        '403':
          description: >-
            The caller is authenticated but lacks the scope or capability this
            route requires.
          content:
            application/json:
              schema:
                type: object
                example:
                  success: false
                  error:
                    type: permission
                    code: MISSING_SCOPE
                    message: >-
                      The caller is authenticated but lacks the scope or
                      capability this route requires.
                    param: null
                    details: null
                    retryable: false
                    request_id: 01JQREQ7XZQK5N6PZ1VVXHYB8T
                  meta:
                    request_id: 01JQREQ7XZQK5N6PZ1VVXHYB8T
        '422':
          $ref: '#/components/responses/ValidationException'
components:
  schemas:
    UpdateBudgetRequest:
      type: object
      description: >-
        Validation for `PUT /v1/usage/budget`.


        Every field is optional — a client sends only what it wants to change,
        and an

        empty body is a no-op that returns current state (per the documented
        contract

        in docs-site/ai-api/control/budget.mdx). `spend_cap` and
        `alert_thresholds`

        accept an explicit `null` to clear, which is semantically distinct from
        an

        omitted key (leave unchanged); the controller distinguishes the two via

        `has()` rather than the validated value.
      properties:
        spend_cap:
          type:
            - integer
            - 'null'
          minimum: 0
          maximum: 1000000000000
        alert_thresholds:
          type:
            - array
            - 'null'
          items:
            type: integer
            minimum: 1
            maximum: 100
          maxItems: 3
      title: UpdateBudgetRequest
  responses:
    ValidationException:
      description: Validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Errors overview.
              errors:
                type: object
                description: A detailed description of each field that failed validation.
                additionalProperties:
                  type: array
                  items:
                    type: string
            required:
              - message
              - errors
  securitySchemes:
    http:
      type: http
      scheme: bearer

````