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

> ## Agent Instructions
> These docs cover three products: TrustGate (AI agent gateway), TrustGuard (runtime security), and TrustTest (AI red teaming). Start from each product overview for the definition and How it works. Prefer the .md URL next to a page in /llms.txt when you need the full article. Use /llms-full.txt for a single-file dump of the site.

# Set the budget of a personal key

> Sets or clears the spending limit of a personal (owned) key. The body is {"max": <number>, "unit": "tokens" or "dollars", "time_window": "calendar_month" or "calendar_day"}, or null to clear the budget. max must be a finite number above zero, and a whole number of tokens when unit is tokens. Every token_rate_limiter policy with key_budgets that counts in that unit holds the key to this budget in place of its aggregate; a policy counting in the other unit keeps its own limit. The secret, the expiry and the consumers of the key do not change, and a rotation keeps the budget. An application key answers 422 application_key; an invalid body answers 422 validation_failed.



## OpenAPI

````yaml /trustgate/api/openapi.json put /v1/gateways/{gateway_id}/auths/{id}/budget
openapi: 3.0.0
info:
  description: >-
    Administrative API for managing gateways and their registries, policies,
    consumers and auth credentials.
  title: TrustGate Admin API
  contact:
    name: NeuralTrust
    url: https://neuraltrust.ai/contact
    email: support@neuraltrust.ai
  version: '1.0'
servers:
  - url: /
security: []
paths:
  /v1/gateways/{gateway_id}/auths/{id}/budget:
    put:
      tags:
        - auths
      summary: Set the budget of a personal key
      description: >-
        Sets or clears the spending limit of a personal (owned) key. The body is
        {"max": <number>, "unit": "tokens" or "dollars", "time_window":
        "calendar_month" or "calendar_day"}, or null to clear the budget. max
        must be a finite number above zero, and a whole number of tokens when
        unit is tokens. Every token_rate_limiter policy with key_budgets that
        counts in that unit holds the key to this budget in place of its
        aggregate; a policy counting in the other unit keeps its own limit. The
        secret, the expiry and the consumers of the key do not change, and a
        rotation keeps the budget. An application key answers 422
        application_key; an invalid body answers 422 validation_failed.
      parameters:
        - description: Gateway id
          name: gateway_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - description: Auth id
          name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_auth_request.UpdateAuthBudgetRequest
        description: The budget, or null to clear it
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_auth_response.AuthResponse
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_httpio.ErrorBody
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_httpio.ErrorBody
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_httpio.ErrorBody
        '422':
          description: >-
            An application key (application_key), or an invalid budget
            (validation_failed)
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_httpio.ErrorBody
      security:
        - BearerAuth: []
components:
  schemas:
    github_com_NeuralTrust_TrustGate_pkg_api_handler_http_auth_request.UpdateAuthBudgetRequest:
      type: object
      properties:
        max:
          type: number
          example: 50
        time_window:
          type: string
          enum:
            - calendar_month
            - calendar_day
          example: calendar_month
        unit:
          type: string
          enum:
            - tokens
            - dollars
          example: dollars
    github_com_NeuralTrust_TrustGate_pkg_api_handler_http_auth_response.AuthResponse:
      type: object
      properties:
        api_key:
          description: '#nosec G101'
          type: string
        budget:
          description: >-
            Budget is the spending limit of a personal key. Absent means it has
            none.
          allOf:
            - $ref: >-
                #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_auth_response.KeyBudgetResponse
        config:
          $ref: >-
            #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_auth_response.ConfigResponse
        consumers:
          description: >-
            Consumers are the consumers this auth reaches, which is what a
            caller

            needs before revoking one: a key can be attached to several, so

            disabling it stops more than the endpoint the reader was looking at.

            Empty means it reaches none, which is an answer rather than a gap.
          type: array
          items:
            $ref: >-
              #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_auth_response.AuthConsumerResponse
        created_at:
          type: string
        enabled:
          type: boolean
        expires_at:
          description: When the key retires itself. Absent means it never does.
          type: string
        gateway_id:
          type: string
        group_id:
          description: >-
            GroupID is the directory group a group key is held for, which its
            spend

            is attributed to. Absent on the owner's personal key and on
            application

            keys.
          type: string
        group_name:
          description: >-
            GroupName is GroupID's directory name, which the MCP Store matches
            the

            key's access against. Absent wherever GroupID is.
          type: string
        id:
          type: string
        key_prefix:
          description: >-
            Non-secret recognition hint for api_key auths (e.g. "ag_3dlXk" +
            "Rv8Q").
          type: string
        key_suffix:
          type: string
        name:
          type: string
        owner_email:
          description: >-
            OwnerEmail is the email of a personal key's owner, which the key's
            calls

            are shown under. Absent means none was recorded.
          type: string
        owner_groups:
          description: >-
            OwnerGroups are the directory groups of a personal key's owner, as
            the

            platform last reported them. Absent means none were reported.
          type: array
          items:
            type: string
        owner_id:
          type: string
        type:
          type: string
        updated_at:
          type: string
    github_com_NeuralTrust_TrustGate_pkg_api_handler_http_httpio.ErrorBody:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
    github_com_NeuralTrust_TrustGate_pkg_api_handler_http_auth_response.KeyBudgetResponse:
      type: object
      properties:
        max:
          type: number
        time_window:
          type: string
          enum:
            - calendar_month
            - calendar_day
        unit:
          type: string
          enum:
            - tokens
            - dollars
    github_com_NeuralTrust_TrustGate_pkg_api_handler_http_auth_response.ConfigResponse:
      type: object
      properties:
        mtls:
          $ref: >-
            #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_auth_response.MTLSConfigResponse
        oauth2:
          $ref: >-
            #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_auth_response.OAuth2ConfigResponse
    github_com_NeuralTrust_TrustGate_pkg_api_handler_http_auth_response.AuthConsumerResponse:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        slug:
          type: string
        type:
          type: string
    github_com_NeuralTrust_TrustGate_pkg_api_handler_http_auth_response.MTLSConfigResponse:
      type: object
      properties:
        allowed_common_names:
          type: array
          items:
            type: string
        allowed_dns_names:
          type: array
          items:
            type: string
        allowed_fingerprints:
          type: array
          items:
            type: string
        ca_cert:
          type: string
    github_com_NeuralTrust_TrustGate_pkg_api_handler_http_auth_response.OAuth2ConfigResponse:
      type: object
      properties:
        allowed_algorithms:
          type: array
          items:
            type: string
        audiences:
          type: array
          items:
            type: string
        authorize_url:
          type: string
        client_id:
          type: string
        client_secret:
          type: string
        exchange_client_id:
          description: >-
            ExchangeClientID and ExchangeClientSecret sign on-behalf-of and
            token

            exchanges; the secret is masked.
          type: string
        exchange_client_secret:
          description: '#nosec G117 -- masked before serialization'
          type: string
        introspection_url:
          type: string
        issuer:
          type: string
        jwks_url:
          type: string
        login_scopes:
          type: array
          items:
            type: string
        public_keys:
          type: array
          items:
            type: string
        required_scopes:
          type: array
          items:
            type: string
        session_mode:
          type: boolean
        subject_claim:
          type: string
        token_url:
          type: string
        userinfo_url:
          type: string
  securitySchemes:
    BearerAuth:
      type: apiKey
      name: Authorization
      in: header

````

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