# Respond to a provider approval

Submit the person's choice for the provider prompt currently attached to a pending tool call.

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

## Parameters

| Name | Location | Type | Required | Description |
| --- | --- | --- | --- | --- |
| id | path | UUID | Yes | The pending tool-call ID from toolCalls or the tool-approvals list. |
| approvalId | path | UUID | Yes | The current providerApproval.id, URL-encoded. Read it again whenever the pending call changes. |
| choice | body | string | Yes | The exact value of the providerApproval.choices entry selected by the person. |

## Request examples

### curl

```curl
curl --fail-with-body -X POST 'https://api.smallworld.sh/api/v1/tool-approvals/b5212df0-ea8b-4eb8-a7b1-057ff45b3044/provider/69b8aa84-bcbd-4f8b-833c-f414760d9449' \
  -H "Authorization: Bearer $SMALLWORLD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "choice": "ALLOW_ONCE"
}'
```

### typescript

```typescript
const response = await fetch("https://api.smallworld.sh/api/v1/tool-approvals/b5212df0-ea8b-4eb8-a7b1-057ff45b3044/provider/69b8aa84-bcbd-4f8b-833c-f414760d9449", {
  method: "POST",
  headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
  body: JSON.stringify({
  "choice": "ALLOW_ONCE"
}),
});
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/provider/69b8aa84-bcbd-4f8b-833c-f414760d9449",
    headers={"Authorization": f"Bearer {api_key}"},
    json={
  "choice": "ALLOW_ONCE"
},
    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 · Approved

The choice was accepted. Continue reading the execution for the provider's result or another prompt.

```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": "gmail",
  "integrationName": "Gmail",
  "account": "support@example.com",
  "connectionSource": "group",
  "group": {
    "id": "team_42",
    "name": "Support team"
  },
  "toolName": "trash_thread",
  "toolDescription": "Move a conversation to Trash.",
  "toolLabel": "destructive",
  "arguments": {
    "threadId": "thread_456"
  },
  "status": "approved",
  "result": null,
  "error": null,
  "errorCode": null,
  "reason": null,
  "providerApproval": null,
  "hooks": [],
  "createdAt": "2026-10-10T12:00:00.000Z",
  "expiresAt": "2026-10-10T12:15:00.000Z",
  "completedAt": null,
  "decidedAt": "2026-10-10T12:00:01.000Z"
}
```

### 200 · Next provider approval

The same invocation is waiting on a later prompt. Its new providerApproval.id identifies a separate decision.

```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": "gmail",
  "integrationName": "Gmail",
  "account": "support@example.com",
  "connectionSource": "group",
  "group": {
    "id": "team_42",
    "name": "Support team"
  },
  "toolName": "trash_thread",
  "toolDescription": "Move a conversation to Trash.",
  "toolLabel": "destructive",
  "arguments": {
    "threadId": "thread_456"
  },
  "status": "pending",
  "result": null,
  "error": null,
  "errorCode": null,
  "reason": null,
  "providerApproval": {
    "id": "ee22f550-94d8-4c3d-a47f-0b20e25ac801",
    "message": "This operation requires your permission.",
    "question": "Allow this operation?",
    "choices": [
      {
        "value": "ALLOW_ONCE",
        "label": "Allow once"
      },
      {
        "value": "DENY_ONCE",
        "label": "Deny once"
      }
    ]
  },
  "hooks": [],
  "createdAt": "2026-10-10T12:00:00.000Z",
  "expiresAt": "2026-10-10T12:15:00.000Z",
  "completedAt": null,
  "decidedAt": null
}
```

### 200 · Running

A repeated submission of the saved choice returns the current call without another dispatch.

```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": "gmail",
  "integrationName": "Gmail",
  "account": "support@example.com",
  "connectionSource": "group",
  "group": {
    "id": "team_42",
    "name": "Support team"
  },
  "toolName": "trash_thread",
  "toolDescription": "Move a conversation to Trash.",
  "toolLabel": "destructive",
  "arguments": {
    "threadId": "thread_456"
  },
  "status": "running",
  "result": null,
  "error": null,
  "errorCode": null,
  "reason": null,
  "providerApproval": null,
  "hooks": [],
  "createdAt": "2026-10-10T12:00:00.000Z",
  "expiresAt": "2026-10-10T12:15:00.000Z",
  "completedAt": null,
  "decidedAt": "2026-10-10T12:00:01.000Z"
}
```

### 200 · Completed

A repeated submission of the saved choice returns the current call without another dispatch.

```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": "gmail",
  "integrationName": "Gmail",
  "account": "support@example.com",
  "connectionSource": "group",
  "group": {
    "id": "team_42",
    "name": "Support team"
  },
  "toolName": "trash_thread",
  "toolDescription": "Move a conversation to Trash.",
  "toolLabel": "destructive",
  "arguments": {
    "threadId": "thread_456"
  },
  "status": "completed",
  "result": {
    "threadId": "thread_456"
  },
  "error": null,
  "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"
}
```

### 200 · Failed

A repeated submission of the saved choice returns the current call without another dispatch.

```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": "gmail",
  "integrationName": "Gmail",
  "account": "support@example.com",
  "connectionSource": "group",
  "group": {
    "id": "team_42",
    "name": "Support team"
  },
  "toolName": "trash_thread",
  "toolDescription": "Move a conversation to Trash.",
  "toolLabel": "destructive",
  "arguments": {
    "threadId": "thread_456"
  },
  "status": "failed",
  "result": null,
  "error": "The provider denied this operation",
  "errorCode": "integration_provider_approval_denied",
  "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: A parameter or the body is invalid; the message names the problem. Unknown body fields are rejected. provider_approval_invalid_choice: choice does not match any value offered by this prompt. Read the pending call and render its current choices.

#### invalid_request

A parameter or the body is invalid; the message names the problem. Unknown body fields are rejected.

```json
{
  "statusCode": 400,
  "code": "invalid_request",
  "message": "Unknown field: color"
}
```

#### provider_approval_invalid_choice

choice does not match any value offered by this prompt. Read the pending call and render its current choices.

```json
{
  "statusCode": 400,
  "code": "provider_approval_invalid_choice",
  "message": "The provider approval choice is invalid"
}
```

### 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_already_processed: This prompt is no longer awaiting this decision, or another choice was already submitted. Refresh the execution before showing a decision UI. approval_policy_denied: The tool is now hidden by policy, or its integration is turned off. The call stays pending until it expires or the policy permits it.

#### 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_already_processed

This prompt is no longer awaiting this decision, or another choice was already submitted. Refresh the execution before showing a decision UI.

```json
{
  "statusCode": 409,
  "code": "provider_approval_already_processed",
  "message": "This provider approval is no longer waiting for a decision"
}
```

#### approval_policy_denied

The tool is now hidden by policy, or its integration is turned off. The call stays pending until it expires or the policy permits it.

```json
{
  "statusCode": 409,
  "code": "approval_policy_denied",
  "message": "This tool is now hidden by policy, so this tool call can't be approved. Deny it or let the approval expire."
}
```

### 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

- Authorize the acting user for this tool call and identify its account, connectionSource, and group before showing the provider's message, question, and choices.

- Render every offered choice label and submit its value after the person selects it. Choices and their meanings belong to the provider and can change between prompts.

- Bind the decision to both the tool-call ID and providerApproval.id. The same call may pause again with a new providerApproval.id; refresh the execution and render that new prompt.

- The body accepts only choice. A provider choice never changes Smallworld's tool policy. Any offered persistent permission applies at the provider.

- Repeating the same choice for the same providerApproval.id returns the current tool call without another dispatch. A stale prompt or a different choice returns a conflict. After a lost response, read the execution before retrying.

- The response is a tool call. Continue polling its execution for the provider result or another approval prompt.
