PermuteDocs
Go to Permute

AI credits · aiCreditsSetLimit

Set a resource's AI credit limit

Sets the monthly AI credit limit for a Business Action or operation, or returns it to the default when monthlyCredits is null. Pass a Business Action (actn_) or operation (oper_) ID. Requires view access to the resource and the Change AI limits permission (workspace.manage_ai_credits) on its workspace; workspace admin access includes the permission, and admins can also grant it on its own. Through the API the limit can be at most 5,000 credits, and a higher value returns 403 forbidden; only organization admins can set more, in the web app. The organization's own limit comes from its plan and cannot be changed here.

PUT/v1/ai-credits/{resourceId}
betaauthenticatedworkspace

When to use

Raise or lower the monthly AI credit limit of one Business Action or operation.

For agents

Requires view access to the resource and the Change AI limits permission on its workspace (workspace.manage_ai_credits). Workspace admin access includes the permission, including an API key with admin access on all resources, and regular members have both through the workspace's default access. To grant the permission without other admin rights, call client.permissions.create with resourceType 'workspace', the workspace ID, level 'admin' and operations ['workspace.read', 'workspace.manage_ai_credits']; the grantee also needs view access to the Business Actions and operations, for example a read grant on resourceType 'businessAction' or 'operation' with resourceId '*'. Through the API the limit can be at most 5,000 credits, and a higher value returns 403 forbidden; only organization admins can set more, on the action's page or the operation's Config tab in the web app. A limit of 0 blocks every AI call. Pass monthlyCredits: null to return to the 2,000-credit default. The organization's limit comes from its plan and cannot be changed here.

Example

typescript
import { PermuteClient } from '@permute/sdk';

const orgClient = new PermuteClient({
  apiKey: process.env.PERMUTE_API_KEY!,
});

const client = orgClient.withWorkspace(process.env.PERMUTE_WORKSPACE_ID!);

const result = await client.aiCredits.setLimit('oper_abcdefghijklmnopqrstuvwx', {"monthlyCredits":5000});

Request body

json
{
  "monthlyCredits": 5000
}

Response

json
{
  "data": {
    "resourceId": "oper_abcdefghijklmnopqrstuvwx",
    "period": "2026-11",
    "usedCredits": 120,
    "monthlyLimit": 5000,
    "isDefaultLimit": false,
    "aiCallsEnabled": true,
    "canEditLimit": true,
    "maxSettableLimit": 5000
  }
}