---
name: kimaai_admin_assistant_blocked
type: action
since: 1.5.0
tier: free
feature: admin-assistant
area: admin-assistant
summary: Fires when the admin assistant's gate blocks an administrator's message.
parameters:
  - name: error_message
    type: string
    description: The message the administrator gets.
  - name: payload
    type: array
    description: The normalised request payload, with prompt, postId (always 0), lang and chatbot_settings, which holds the admin assistant's runtime settings.
  - name: data
    type: array
    description: The request's JSON body.
  - name: request
    type: WP_REST_Request
    description: The REST request.
surfaces: [admin_assistant]
---

# kimaai_admin_assistant_blocked

## When it fires

Right after `kimaai_admin_assistant_gate` returned anything but `true`, before the administrator gets the refusal with status 403. KimaAI blocks nothing in the admin assistant by itself, so the action fires only for the rules of your own gate callbacks. The request ends here: no session is resolved, the daily limit does not count it, nothing is stored in the assistant's history and nothing reaches the AI provider.

The action cannot change the outcome. The payload carries no user ID yet; `get_current_user_id()` is the administrator who sent the message.

## Example

```php
add_action(
  'kimaai_admin_assistant_blocked',
  function (string $error_message): void {
    error_log(sprintf('KimaAI admin assistant refused a message from user %d: %s', get_current_user_id(), $error_message));
  }
);
```

## Related

- `kimaai_admin_assistant_gate`: decides whether a message is blocked.
- `kimaai_admin_assistant_rate_limited`: fires when an administrator reaches the daily limit instead.
