---
kind: rest
area: admin-assistant
tier: free
summary: The routes of the admin assistant panel, which send a message and read, export, revert and delete its sessions.
---

# Admin assistant REST routes

The routes live under `/wp-json/kimaai/v1/`. A call from a logged-in browser sends the WordPress REST nonce, as every WordPress REST call does; a script uses an application password. A route that names a feature is registered only while that feature is not hidden (`app/Features/Features.php`).

Each route says its access. Internal: the route serves KimaAI's own admin screens or chat widget and may change or go away in any release without notice, so code outside KimaAI should not call it. Public: the route keeps its path, its arguments and its answer across releases, and changes only after a deprecation.

Each route needs an administrator on an admin screen where the assistant is switched on: the panel sends the screen as `page`, `tab` and `hookSuffix` with each request. The admin assistant is not released yet, so these routes are not registered in this release.

## POST /kimaai/v1/admin-assistant

- Access: internal
- Permission: an administrator (`manage_options`) on an admin screen where the admin assistant is switched on
- Tier: free
- Feature: admin-assistant

Sends a message to the admin assistant, which answers and can find and change KimaAI's settings with its tools. Streams like the chat route.

| Argument    | Type    | Required | Description                                                       |
| ----------- | ------- | -------- | ----------------------------------------------------------------- |
| `message`   | string  | yes      | The administrator's message.                                      |
| `command`   | object  | no       | A button or quick action of the panel instead of a typed message. |
| `stream`    | boolean | no       | True to stream the answer.                                        |
| `lang`      | string  | no       | The language of the answer.                                       |
| `sessionId` | string  | no       | The session to continue.                                          |

Returns: The answer, as the chat route returns it.

## GET /kimaai/v1/admin-assistant/history

- Access: internal
- Permission: an administrator (`manage_options`) on an admin screen where the admin assistant is switched on
- Tier: free
- Feature: admin-assistant

One of the current user's assistant sessions.

| Argument     | Type   | Required | Description                            |
| ------------ | ------ | -------- | -------------------------------------- |
| `session_id` | string | no       | The session; the active one otherwise. |

Returns: `sessionId`, `messages`, `feedback` and `quickActions`.

## GET /kimaai/v1/admin-assistant/sessions

- Access: internal
- Permission: an administrator (`manage_options`) on an admin screen where the admin assistant is switched on
- Tier: free
- Feature: admin-assistant

The current user's assistant sessions.

No arguments.

Returns: `activeSessionId` and `sessions`.

## POST /kimaai/v1/admin-assistant/session/delete

- Access: internal
- Permission: an administrator (`manage_options`) on an admin screen where the admin assistant is switched on
- Tier: free
- Feature: admin-assistant

Deletes sessions of the current user.

| Argument      | Type   | Required | Description       |
| ------------- | ------ | -------- | ----------------- |
| `session_id`  | string | no       | One session.      |
| `session_ids` | array  | no       | Several sessions. |

Returns: `success`, the deleted session IDs and count, and the `sessionId` to continue with; 400 without a session.

## POST /kimaai/v1/admin-assistant/session/revert

- Access: internal
- Permission: an administrator (`manage_options`) on an admin screen where the admin assistant is switched on
- Tier: free
- Feature: admin-assistant

Undoes the settings changes the assistant made in sessions of the current user, then deletes those sessions.

| Argument      | Type   | Required | Description       |
| ------------- | ------ | -------- | ----------------- |
| `session_id`  | string | no       | One session.      |
| `session_ids` | array  | no       | Several sessions. |

Returns: `success`, the reverted and deleted session IDs and count; 400 without a session.

## GET /kimaai/v1/admin-assistant/history/export

- Access: internal
- Permission: an administrator (`manage_options`) on an admin screen where the admin assistant is switched on
- Tier: free
- Feature: admin-assistant

Exports one of the current user's sessions for debugging.

| Argument     | Type   | Required | Description                            |
| ------------ | ------ | -------- | -------------------------------------- |
| `session_id` | string | no       | The session; the active one otherwise. |

Returns: The session's messages and their details.

## POST /kimaai/v1/admin-assistant/history/clear

- Access: internal
- Permission: an administrator (`manage_options`) on an admin screen where the admin assistant is switched on
- Tier: free
- Feature: admin-assistant

Starts a new session; the saved sessions are kept.

No arguments.

Returns: `ok` and the new `sessionId`.
