# Deny a tool call

Deny the exact pending invocation before it reaches the provider.

`POST https://api.smallworld.sh/api/v1/tool-approvals/:id/deny`

## Parameters

| Name | Location | Type | Required | Description |
| --- | --- | --- | --- | --- |
| id | path | UUID | Yes | The pending tool-call ID from toolCalls or the tool-approvals list. |

## Request examples

### curl

```curl
curl --fail-with-body -X POST 'https://api.smallworld.sh/api/v1/tool-approvals/b5212df0-ea8b-4eb8-a7b1-057ff45b3044/deny' \
  -H "Authorization: Bearer $SMALLWORLD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### typescript

```typescript
const response = await fetch("https://api.smallworld.sh/api/v1/tool-approvals/b5212df0-ea8b-4eb8-a7b1-057ff45b3044/deny", {
  method: "POST",
  headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
  body: JSON.stringify({}),
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
const result = await response.json();
```

### python

```python
response = requests.post(
    "https://api.smallworld.sh/api/v1/tool-approvals/b5212df0-ea8b-4eb8-a7b1-057ff45b3044/deny",
    headers={"Authorization": f"Bearer {api_key}"},
    json={},
    timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Responses

Returns one tool call: id, sessionId, executionId, your userId, worldId, integration (its key), integrationName, account, connectionSource, group, toolName, toolDescription, toolLabel (read, write, destructive, or unknown), exact arguments, status, nullable result/error/errorCode, reason, hooks, nullable providerApproval, and timestamps. integrationName, account, connectionSource, group, toolDescription, and toolLabel are copied when the call is made, so an approval shows the call as it was requested, also after its group is renamed or deleted; they are null for calls recorded before they were kept, and account is null without a connection. connectionSource is personal for the user's own account, group for the account of the session's group, or none for a tool without a connection. group is the group the call's session acted for when the call was made, with your id and its name, or null in a groupless session. reason says why tool call hooks denied the call or asked for approval, and hooks lists each hook's answer (scope, status, reason, durationMs, failure). providerApproval is present only while a provider prompt is pending and contains id, message, question, and choices, each with value and label. Use that id for the provider decision endpoint and render the offered choices. completedAt and decidedAt may be null. Statuses include pending, approved, denied, running, completed, failed, expired, interrupted, and unknown.

### 200 · Denied

The invocation was denied before provider dispatch. The script receives a tool error and may handle it or finish with an error.

```json
{
  "id": "b5212df0-ea8b-4eb8-a7b1-057ff45b3044",
  "sessionId": "01995e57-0501-76b8-b797-5b24df5b307f",
  "executionId": "01995e57-3027-7557-a233-009ea3dcd8fc",
  "userId": "customer_123",
  "worldId": "01995e56-e2d4-7f19-b691-7bf9af6abdc8",
  "integration": "acme",
  "integrationName": "Acme",
  "account": null,
  "connectionSource": "none",
  "group": null,
  "toolName": "get_order",
  "toolDescription": "Read an order by its ID.",
  "toolLabel": "read",
  "arguments": {
    "orderId": "order_456"
  },
  "status": "denied",
  "result": null,
  "error": "Tool call denied",
  "errorCode": null,
  "reason": null,
  "providerApproval": null,
  "hooks": [],
  "createdAt": "2026-10-10T12:00:00.000Z",
  "expiresAt": "2026-10-10T12:15:00.000Z",
  "completedAt": "2026-10-10T12:00:01.000Z",
  "decidedAt": "2026-10-10T12:00:01.000Z"
}
```

### 400

invalid_request: The body is invalid. remember is not supported for denial.

#### invalid_request

The body is invalid. remember is not supported for denial.

```json
{
  "statusCode": 400,
  "code": "invalid_request",
  "message": "remember is only supported for approvals"
}
```

### 401

authentication_required: The Authorization header is missing or empty. invalid_api_key: The API key is invalid or revoked, or the header doesn't use the Bearer scheme.

#### authentication_required

The Authorization header is missing or empty.

```json
{
  "statusCode": 401,
  "code": "authentication_required",
  "message": "Authentication is required"
}
```

#### invalid_api_key

The API key is invalid or revoked, or the header doesn't use the Bearer scheme.

```json
{
  "statusCode": 401,
  "code": "invalid_api_key",
  "message": "The API key is invalid or revoked"
}
```

### 403

ip_not_allowed: The request came from an address outside the workspace's IP allowlist.

#### ip_not_allowed

The request came from an address outside the workspace's IP allowlist.

```json
{
  "statusCode": 403,
  "code": "ip_not_allowed",
  "message": "The source IP address is not allowed by this account's security settings"
}
```

### 404

approval_not_found: The tool approval does not exist in your workspace.

#### approval_not_found

The tool approval does not exist in your workspace.

```json
{
  "statusCode": 404,
  "code": "approval_not_found",
  "message": "Tool approval not found"
}
```

### 409

approval_expired: The tool approval has expired. approval_interrupted: The call was interrupted before it was decided, such as by an API restart, a change to its integration or connection, the user being moved out of the group whose connection it used, or its session being closed. The message says why. approval_already_processed: The invocation has already been decided differently, or it already finished. provider_approval_required: The pending call is waiting for a provider choice. Read its providerApproval and submit an offered choice to the provider decision endpoint.

#### approval_expired

The tool approval has expired.

```json
{
  "statusCode": 409,
  "code": "approval_expired",
  "message": "Approval is expired"
}
```

#### approval_interrupted

The call was interrupted before it was decided, such as by an API restart, a change to its integration or connection, the user being moved out of the group whose connection it used, or its session being closed. The message says why.

```json
{
  "statusCode": 409,
  "code": "approval_interrupted",
  "message": "The tool call was interrupted: API restarted; submit a new command"
}
```

#### approval_already_processed

The invocation has already been decided differently, or it already finished.

```json
{
  "statusCode": 409,
  "code": "approval_already_processed",
  "message": "Approval was already decided"
}
```

#### provider_approval_required

The pending call is waiting for a provider choice. Read its providerApproval and submit an offered choice to the provider decision endpoint.

```json
{
  "statusCode": 409,
  "code": "provider_approval_required",
  "message": "This call is waiting for a provider approval. Submit one of the provider choices."
}
```

### 413

request_too_large: The JSON body is larger than 12 MiB. File uploads count toward it, base64 or escaping included.

#### request_too_large

The JSON body is larger than 12 MiB. File uploads count toward it, base64 or escaping included.

```json
{
  "statusCode": 413,
  "code": "request_too_large",
  "message": "The request body is larger than 12 MiB."
}
```

### 415

unsupported_media_type: The request has a body that isn't JSON. Send JSON with Content-Type: application/json, or no body at all.

#### unsupported_media_type

The request has a body that isn't JSON. Send JSON with Content-Type: application/json, or no body at all.

```json
{
  "statusCode": 415,
  "code": "unsupported_media_type",
  "message": "Send the request body as JSON with Content-Type: application/json."
}
```

### 500

internal_error: An unexpected server error.

#### internal_error

An unexpected server error.

```json
{
  "statusCode": 500,
  "code": "internal_error",
  "message": "Internal server error"
}
```

## Notes

- Omit the body or send {}. remember: true is not supported for denial, and arguments cannot be edited.

- Use this endpoint while providerApproval is null or absent. When the provider asks for a decision, render its offered choices and submit the selected value through the provider decision endpoint.

- Denial becomes a tool error inside the command. The script may handle it and continue; poll the execution to observe the outcome.

- Repeating the same denial does not invoke the provider.
