curl -sS -X POST "$BMA_BASE_URL/v1/sessions/ses_agray3h7xf3w5ihioo7wojxbd4/tool_grants/tgr_3f9a1c7e5b2d4086a1e9c3b7/revoke" \
-H "x-api-key: $BMA_API_KEY" \
-H "bma-workspace-id: $BMA_PROJECT_ID"{
"type": "tool_grant",
"id": "tgr_3f9a1c7e5b2d4086a1e9c3b7",
"session_id": "ses_agray3h7xf3w5ihioo7wojxbd4",
"tool_name": "bash",
"input_pattern": "npm:*",
"granted_at": "2026-11-24T07:12:03.418211Z",
"granted_by": "0193f0b2-6c1d-7a4e-9b2f-5d8e3a1c7f40",
"tool_use_id": "sevt_agray3h7xf3xvh3ikvm2dxwz6u",
"revoked_at": "2026-11-24T08:05:51.660482Z",
"revoked_by": "0193f0b2-6c1d-7a4e-9b2f-5d8e3a1c7f40"
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"bma_error_code": "<string>"
},
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"bma_error_code": "<string>"
},
"request_id": "<string>"
}Revoke a session's tool grant
Revokes one tool grant of a session and returns the grant with revoked_at and revoked_by set. From then on the platform no longer answers the permission requests the grant covered: unless another active grant of the session covers it, the next such call stops the turn at requires_action and waits for a user.tool_confirmation again. A request already answered by the grant is not undone. The grant stays in the session’s list of grants. The request takes no body and emits no session event. Naturally idempotent: revoking a grant that is already revoked returns it unchanged, keeping its first revoked_at and revoked_by; an Idempotency-Key header is not used. Grants of an archived session can be revoked as well. An unknown grant, or a session that does not exist, was deleted or belongs to another workspace, answers 404 not_found_error without an error.code.
Authorization: An organization API key (x-api-key: bma_org_v1_…), a personal access token (Authorization: Bearer bma_pat_v1_…), an OAuth access token or a signed-in dashboard user; a user credential names its organization with the bma-organization-id header. The request acts in one workspace: the one named by bma-workspace-id (or anthropic-workspace-id), otherwise the credential’s default workspace, otherwise its only workspace. The session must belong to that workspace. Requires a workspace role that may run sessions: operator, developer or admin (organization owners and admins act as workspace admins); a viewer is refused.
Limits:
- No limits specific to this endpoint.
- Rate limit: one request of the organization’s write budget (Rate limits).
Errors (besides the common errors (401 authentication, 429 rate_limited, 500)):
| Status | error.type | error.code | Cause | Fix |
|---|---|---|---|---|
| 400 | invalid_request_error | organization_required | A user credential (personal access token, OAuth token, dashboard user) names no organization. | Send the bma-organization-id header. |
| 400 | invalid_request_error | project_required | No usable workspace could be selected: the request names none, and the credential has no default workspace it may use and more than one workspace. | Send the bma-workspace-id header with the session’s workspace. |
| 400 | invalid_request_error | workspace_id_conflict | bma-workspace-id and anthropic-workspace-id are both sent and name different workspaces. | Correct the request as the message describes and send it again; the same request will keep failing. |
| 403 | permission_error | permission_denied | The caller’s workspace role is viewer. | Use a credential with the required role or access; retrying with the same credential will not help. |
curl -sS -X POST "$BMA_BASE_URL/v1/sessions/ses_agray3h7xf3w5ihioo7wojxbd4/tool_grants/tgr_3f9a1c7e5b2d4086a1e9c3b7/revoke" \
-H "x-api-key: $BMA_API_KEY" \
-H "bma-workspace-id: $BMA_PROJECT_ID"{
"type": "tool_grant",
"id": "tgr_3f9a1c7e5b2d4086a1e9c3b7",
"session_id": "ses_agray3h7xf3w5ihioo7wojxbd4",
"tool_name": "bash",
"input_pattern": "npm:*",
"granted_at": "2026-11-24T07:12:03.418211Z",
"granted_by": "0193f0b2-6c1d-7a4e-9b2f-5d8e3a1c7f40",
"tool_use_id": "sevt_agray3h7xf3xvh3ikvm2dxwz6u",
"revoked_at": "2026-11-24T08:05:51.660482Z",
"revoked_by": "0193f0b2-6c1d-7a4e-9b2f-5d8e3a1c7f40"
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"bma_error_code": "<string>"
},
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"bma_error_code": "<string>"
},
"request_id": "<string>"
}Path Parameters
Response
The grant after revocation (or as it was, when it was already revoked).
A standing allow of one tool rule for the rest of a session, made by a user.tool_confirmation with result: "allow" and bma_scope: "session". While revoked_at is null, the platform answers allow to every permission request of the session whose call matches tool_name and input_pattern.
Which inputs of the tool the grant covers. An empty string for every tool except bash: any input. For bash, <program>:* when the allowed command was one program with plain arguments (no ;, &, |, $, backquotes, <, >, *, ?, parentheses, brackets, braces, ~, backslash or line break, no variable assignment or quotes in the program, and a program that does not run another one, such as sudo, env, xargs, sh, bash or ssh): it covers every such simple command of that program. Otherwise the exact command, without its leading and trailing whitespace, and only that command is covered; an allowed bash call with an empty or missing command gives an empty string, which then covers only an empty command.