Docs

Integrations / Build your own / Script tool templates

Claude Enterprise spend fulfillment

Apply an approved fixed monthly cap and manage its removal for a designated Claude Enterprise member

Use Claude Enterprise spend fulfillment to apply a fixed monthly cap through a Risotto access rule. One script handles both grant and remove: grant sets a per-user override and reads it back; remove clears the recorded override and checks the current inherited cap.

Before you start

  • You must be a Risotto Org Admin or Manager.
  • Use a Claude Enterprise organization billed in USD, with usage credits enabled and one designated member.
  • Store a scoped Anthropic Admin API key with both read:spend_limits and write:spend_limits in the Credential Vault. Set its allowed hosts to api.anthropic.com.
  • Configure the spend lookup first. Use it to confirm the member's user_id, a finite inherited monthly cap, and the USD currency. The source must be a seat tier, group, or organization default, with no per-user override.
  • Keep exclusive control of the member from grant through removal. Do not allow other grants, scripts, or manual cap changes for this member during that time.
  • Keep an admin available to record the cleanup details and recover a failed removal.

Read access alone does not confirm write access. Anthropic can reject writes even when lookup succeeds. See the vendor's Spend Limits API guide for key scopes and organization requirements.

Configure the fulfillment tool

  1. Create and configure the fulfillment tool

    Open Tools > Script templates, select Claude Enterprise spend fulfillment, and click Use template.

    In the new tool's Edit form, select or create a Secret text vault credential for ANTHROPIC_ADMIN_API_KEY. Confirm both spend-limit scopes, the api.anthropic.com allowed host, and that the credential is usable by the tool's department. Save the configuration.

    See Create and deploy a tool for the shared configuration steps.

    Existing tools keep the code they were created with. To use the current template's configuration below, finish any active grant on an earlier tool before creating a new copy.

  2. Set the member and approved cap

    Open the studio, click Code, and find the allowance settings near the top. Set member_user_id to the identifier from the member's lookup. Set approved_monthly_cap_minor to the approved total monthly cap as an integer string in USD cents.

    For example, the configuration below approves a total cap of $1,000. Replace user_test with your designated member's actual ID. Leave both cleanup fields empty for the grant.

    const allowance = {
      member_user_id: "user_test",
      approved_monthly_cap_minor: "100000",
      cleanup_spend_limit_id: "",
      cleanup_updated_at: ""
    };

    Click Save draft. The published script rejects a different account or an amount that does not match this approved cap. These settings are not secrets; the Admin key stays in the vault.

  3. Publish and enable the tool

    Publish the saved draft and turn on Enabled on the tool's page. Keep Requires Approval on for direct tool calls.

    A studio Test with action: grant makes a real change in Anthropic. For this guide, make the grant through the access rule in the next section. Do not also grant from the Test dialog.

Bind and run an approved grant

  1. Bind a fixed-tier access rule

    Create or edit the application's access rule. In Access settings > Script tool, select the published fulfillment tool in the Script field.

    Set monthly_cap_minor as a bound argument on the card. For the $1,000 example, use the string 100000, matching the approved cap in the script. The rule stores:

    {
      "monthly_cap_minor": "100000"
    }

    Risotto supplies the action and the recipient's email and aliases. Do not add an employee-selected amount or ask the agent to choose a tier. The same script and bound cap serve both grant and removal.

    Configure the rule's Approval policy and who can request it. Set Allowed Duration to the approved grant window and turn off Renewal prompts. For your first verification, use a short fixed window, for example a minimum and maximum of 1 hour.

    The access rule's approval policy decides whether a grant runs. The tool's own Requires Approval switch does not enforce approval when the access rule calls it.

  2. Request and approve the grant

    Request this access rule for the designated member through your normal Risotto request workflow, then complete the rule's approval. Keep all other grants and writers for that member paused.

    The script refuses an existing per-user override. On success, it checks both the configured override and the effective monthly cap before reporting a grant. Review the result in the ticket's internal comment or the tool's Run history. Confirm the member ID, monthly_cap_minor, and USD currency.

    Keep the successful result's cleanup_receipt. It contains the override's spend_limit_id and updated_at.

  3. Record the verified cleanup details before expiry

    Open the same tool in the studio. Copy the values from the successful grant result into its allowance settings:

    Grant resultScript setting
    cleanup_receipt.spend_limit_idallowance.cleanup_spend_limit_id
    cleanup_receipt.updated_atallowance.cleanup_updated_at

    Keep the member ID and approved cap unchanged. Click Save draft, then Publish so the removal uses the recorded details. Do this before the grant's expiry. Without the record, the script refuses to delete a user override.

    Keep exactly one grant for this tool. Publishing changes the script used by subsequent removals, including removal of this active grant. The manual record cannot protect against another writer changing the override between inspection and deletion.

Verify removal

  1. Remove early or check the scheduled removal

    To test early removal, open the grant in Access Grants and click Expire access now. To test expiry, leave the tool enabled and check the removal after the configured window ends.

    Review the result. A verified removal reports changed: true, a finite monthly_cap_minor, and an inherited source. It clears the override and uses the current seat, group, or organization limit. If that inherited limit changed during the grant, the result can differ from the starting cap.

    If the result is unlimited or removal fails, follow the recovery steps below. Confirm the member's current state in Claude before treating cleanup as complete.

  2. Check repeated cleanup

    After verified removal, you can test the same saved script with action: remove for the same member. For example:

    {
      "action": "remove",
      "recipient_email": "member@example.com",
      "monthly_cap_minor": "100000"
    }

    Replace the address with the designated member's email and keep the configured cap. With no user override and a finite inherited cap, removal reports changed: false and leaves the current inheritance in place.

  3. Finish or replace the setup

    After you verify cleanup, disable the rule and fulfillment tool if you no longer need them. Keep the lookup enabled if you use it for read-only allowance questions.

    Disabling the tool does not clear an Anthropic override. Finish cleanup first. Create a fresh tool for another grant instead of reusing the previous cleanup record.

Recover a failed or uncertain change

ProblemWhat to do
Tool cannot be selected on the ruleConfirm that the tool is published and enabled. A tool that requires User Verification cannot fulfill an access rule. Configure the rule's approval policy.
Writes disabled for the organizationAsk Anthropic to enable the capability. A successful lookup does not prove that writes are enabled.
Write refusedCheck the Admin key's write:spend_limits scope, organization capability, and vault host restriction.
Existing override or changed cleanup recordStop and inspect the account. Resolve the current owner before continuing. Do not replace the record merely to make it match an unrelated or manually changed override.
Rate limit, server error, timeout, or failed readbackCheck the member's current state in Claude before retrying. A write may have applied even though the run did not report success.
Removal failedThe grant stays active and Risotto alerts admins. Fix the cause, then use Expire access now to retry. The expiry sweep does not automatically retry a grant after it is marked as a failed removal.
Removal reports no finite inherited capInspect the current defaults in Claude and set the intended finite fallback. Deleting an override can leave a member unlimited when no inherited cap is configured.

Operating requirements and limits

  • Separate tier rules do not select the highest active allowance or supersede one another. The tool refuses an existing override instead of reconciling tiers.
  • An override ID, amount, and update timestamp cannot prevent a concurrent change between inspection and deletion. Keep the designated member under exclusive control.
  • The monthly spending period is separate from the access grant's expiry. A monthly reset does not delete the override. This template does not implement calendar-month-end expiry.
  • Cleanup needs a manual record and admin recovery after failure. A short successful expiry test does not prove recovery after worker loss or automatic retry of transient failures.

Use the lookup tool independently for allowance questions. Configure each fulfillment tool for one designated member, record its grant before removal, and verify cleanup before allowing another grant.

Something wrong or missing? Report an issue · View as Markdown