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.

ArgumentTypeRequiredDescription
messagestringyesThe administrator’s message.
commandobjectnoA button or quick action of the panel instead of a typed message.
streambooleannoTrue to stream the answer.
langstringnoThe language of the answer.
sessionIdstringnoThe 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.

ArgumentTypeRequiredDescription
session_idstringnoThe 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.

ArgumentTypeRequiredDescription
session_idstringnoOne session.
session_idsarraynoSeveral 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.

ArgumentTypeRequiredDescription
session_idstringnoOne session.
session_idsarraynoSeveral 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.

ArgumentTypeRequiredDescription
session_idstringnoThe 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.

What are your feelings