Skip to content
Set a user override

Set a user override

Set one tool's policy for a represented user in every World.

PUT/api/v1/users/:userId/tool-policies/:integration/:toolName

Request#

TypeScript
const response = await fetch("https://api.smallworld.sh/api/v1/users/customer_123/tool-policies/acme/get_order", {
  method: "PUT",
  headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
  body: JSON.stringify({
  "policy": "allow"
}),
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
const result = await response.json();

Use your server-side apiKey. Replace the example IDs.

Path parameters#

userIdstringrequired

Your application's user ID, URL-encoded. At most 512 characters, with no surrounding whitespace or null bytes. Encode the IDs . and .. as %2E and %2E%2E: curl sends these as written, but JavaScript's fetch removes them even when encoded.

integrationstringrequired

An integration key from GET /integrations, such as github or notion.

toolNamestringrequired

The integration's own tool name, as toolName in GET /tool-policies and in tool calls. URL-encode it.

Query parameters#

groupIdstring

Your application's group ID: which of the user's groups the result is for. Omit it for a user with no group or one group. Required when the user belongs to several groups. URL-encode it.

Request body#

policystringrequired

allow runs the tool without asking, ask waits for an approval, and deny hides the tool from agents. To remove the override, use DELETE.

Responses#

Returns integration, toolName, policy (the setting at this level: allow, ask, deny, or inherit when there is no override), effectivePolicy (allow, ask, or deny), and source: integration_default, world_override, group_override, user_override, workspace_hidden, group_hidden, or disabled. hiddenInWorlds lists the Worlds that hide the tool, where the override doesn't apply.

200 response
{
  "integration": "acme",
  "toolName": "get_order",
  "policy": "allow",
  "effectivePolicy": "allow",
  "source": "user_override",
  "hiddenInWorlds": []
}
More about this endpoint

The override applies to the user's next tool call in every World. It never shows a tool the workspace or a World hides, or an integration that is turned off, and it has no effect in sessions of a group that sets its own policy for the tool.

The override is stored for the user and applies in all of their sessions. groupId follows the rules of a new session in POST /worlds/:worldId/execute. Without it, a user with no groups is read without a group and a user with one group is read for that group. A user in several groups needs groupId. It chooses the group that the response's effectivePolicy and source are resolved for. When it fails, nothing is saved.

The user must already exist; this endpoint doesn't create users.