# Approve or deny a confirmation

Approves or denies a pending tool-use confirmation. AI SRE asks for a confirmation before sensitive actions such as writing code or creating alerts. While a confirmation is pending, the chat status is `awaiting_confirmation` and the agent waits. Once you resolve it, the agent continues and the status returns to `processing`.

[endpoint]
base_url = "https://chat.betterstack.com"
path = "/api/v2/chats/{chat_id}/confirmations/{id}"
method = "PATCH"

[[path_param]]
name = "chat_id"
description = "The ID of the chat."
required = true
type = "string"

[[path_param]]
name = "id"
description = "The ID of the confirmation, from `pending_confirmations` in the [chat status](https://betterstack.com/docs/ai-sre/api/chats/status/)."
required = true
type = "integer"

[[body_param]]
name = "approved"
description = "Set to `true` to approve the action, `false` to deny it."
required = true
type = "boolean"

[[body_param]]
name = "comment"
description = "A note for the agent. When denying, the agent sees it as the reason."
required = false
type = "string"

[[body_param]]
name = "allow_tool_for_session"
description = "Set to `true` when approving to also allow this tool for the rest of the agent session, so the agent does not ask again."
required = false
type = "boolean"

[[header]]
name = "Authorization"
description = "Bearer `$TOKEN`"
required = true
type = "string"

[[header]]
name = "Content-Type"
description = "application/json"
required = true
type = "string"
[/endpoint]

[responses]
[[response]]
status = 200
description = '''Returns the resolved confirmation.'''
body = '''{
  "data": {
    "id": "501",
    "type": "confirmation",
    "attributes": {
      "tool_name": "Bash",
      "tool_input": {
        "command": "kubectl rollout restart deployment/checkout-api -n production"
      },
      "status": "approved",
      "resolution_note": null,
      "expires_at": "2026-09-07T11:31:05.000Z",
      "confirmed_at": "2026-09-07T10:33:40.000Z",
      "created_at": "2026-09-07T10:31:05.000Z"
    }
  }
}'''

[[response]]
status = 401
description = '''Unauthorized'''
body = '''{
  "errors": "Invalid authentication"
}'''

[[response]]
status = 404
description = '''Not Found'''
body = '''{
  "errors": "Resource with the provided ID was not found"
}'''

[[response]]
status = 409
description = '''Conflict - Already Resolved'''
body = '''{
  "errors": "This confirmation is no longer pending."
}'''

[[response]]
status = 422
description = '''Unprocessable Entity - Validation Errors'''
body = '''{
  "errors": "Sorry, some values are incorrect",
  "invalid_values": {
    "approved": "must be true or false"
  }
}'''
[/responses]

#### Example cURL

```shell
[label Example]
curl --request PATCH \
  --url https://chat.betterstack.com/api/v2/chats/12345/confirmations/501 \
  --header "Authorization: Bearer $TOKEN" \
  --header 'Content-Type: application/json' \
  --data '{
    "approved": true,
    "allow_tool_for_session": false
  }'
```
