# REST operations

<!-- Generated by `pnpm docs:reference`. Do not edit this file; change the code it is read from. -->

SleekAI serves these operations under `/wp-json`. Each is declared, with its description, in the TypeSpec source of `contracts/api/sleek-ai/openapi.json`.

## Abilities

### `Abilities_list`

`GET /sleek-ai/v1/abilities`, requires `manage_options`.

The WordPress abilities the current user may run, filtered by `query` against their name, label and description and by `category`; before WordPress 6.9 it answers that the Abilities API is unavailable. Users whose role may use the Agent call it too.

### `Abilities_run`

`POST /sleek-ai/v1/abilities/run`, requires `manage_options`.

Runs the ability named by `name` with `input`, after the ability's own permission check. Users whose role may use the Agent call it too.

## Agent

### `Agent_create`

`POST /sleek-ai/v1/agent`, requires `manage_options`.

Saves the Agent capabilities of the roles in `agents`, keyed by role, and answers every role.

### `Agent_list`

`GET /sleek-ai/v1/agent`, requires `manage_options`.

Every WordPress role with its Agent capabilities, saved or default.

## AgentConversations

### `AgentConversations_create`

`POST /sleek-ai/v1/agent/conversations`, requires `manage_options`.

Stores a new Agent conversation for the current user from the body, which needs an `id`; a `type` other than `agent` or `terminal` is saved as `agent`. Users whose role may use the Agent call it too.

### `AgentConversations_list`

`GET /sleek-ai/v1/agent/conversations`, requires `manage_options`.

The current user's Agent conversations and terminal sessions in `sleekai_chats`, newest first, as `items`; workspace chats and chatbot logs stay out. Users whose role may use the Agent call it too.

### `AgentConversations_remove`

`DELETE /sleek-ai/v1/agent/conversations/{id}`, requires `manage_options`.

Deletes the current user's Agent conversation `id` with its messages. Users whose role may use the Agent call it too.

### `AgentConversations_update`

`PUT /sleek-ai/v1/agent/conversations/{id}`, requires `manage_options`.

Updates the fields the body carries of the current user's Agent conversation `id`. Users whose role may use the Agent call it too.

## AgentGateway

### `AgentGateway_anthropicMessages`

`POST /sleek-ai/v1/agent/gateway/anthropic/messages`, requires `manage_options`.

Relays an Anthropic Messages request with the stored Anthropic key.

### `AgentGateway_googleModels`

`POST /sleek-ai/v1/agent/gateway/google/models/{model}`, requires `manage_options`.

Relays a Google Gemini request for `model` with the stored Google key.

### `AgentGateway_openaiChatCompletions`

`POST /sleek-ai/v1/agent/gateway/openai/chat/completions`, requires `manage_options`.

Relays an OpenAI Chat Completions request with the stored OpenAI key.

### `AgentGateway_openaiResponses`

`POST /sleek-ai/v1/agent/gateway/openai/responses`, requires `manage_options`.

Relays an OpenAI Responses API request with the stored OpenAI key.

### `AgentGateway_openrouterChatCompletions`

`POST /sleek-ai/v1/agent/gateway/openrouter/chat/completions`, requires `manage_options`.

Relays an OpenRouter Chat Completions request with the stored OpenRouter key.

### `AgentGateway_openrouterResponses`

`POST /sleek-ai/v1/agent/gateway/openrouter/responses`, requires `manage_options`.

Relays an OpenRouter Responses API request with the stored OpenRouter key.

## AgentMessages

### `AgentMessages_create`

`POST /sleek-ai/v1/agent/messages`, requires `manage_options`.

Stores a new chat message for the current user from the body, which needs an `id` and names its conversation in `chatId`. Users whose role may use the Agent call it too.

### `AgentMessages_list`

`GET /sleek-ai/v1/agent/messages`, requires `manage_options`.

The current user's chat messages in `sleekai_chat_messages`, newest first, as `items`. Users whose role may use the Agent call it too.

### `AgentMessages_remove`

`DELETE /sleek-ai/v1/agent/messages/{id}`, requires `manage_options`.

Deletes the current user's chat message `id`. Users whose role may use the Agent call it too.

## AgentMode

### `AgentMode_create`

`POST /sleek-ai/v1/agent-mode`, requires `manage_options`.

Stores a custom Agent mode; needs `createModes`, and `shared` is kept only with `shareModes`.

### `AgentMode_list`

`GET /sleek-ai/v1/agent-mode`, requires `manage_options`.

The stored custom Agent modes the current user may see: their own and shared ones, or every mode with `manageAllModes`.

### `AgentMode_read`

`GET /sleek-ai/v1/agent-mode/{id}`, requires `manage_options`.

One stored custom Agent mode.

### `AgentMode_remove`

`DELETE /sleek-ai/v1/agent-mode/{id}`, requires `manage_options`.

Deletes a stored custom Agent mode its owner, or a user with `manageAllModes`, may edit.

### `AgentMode_update`

`PUT /sleek-ai/v1/agent-mode/{id}`, requires `manage_options`.

Replaces a stored custom Agent mode the current user may edit.

## AltText

### `AltText_create`

`POST /sleek-ai/v1/alt-text`, requires `manage_options`.

Runs the WordPress query in the body for the Alt Text table, which asks for image attachments with their alt text, caption and description.

### `AltText_createPost`

`POST /sleek-ai/v1/alt-text/{id}`, requires `manage_options`.

Generates the alt text of one image attachment with the Alt Text model and instruction, and writes it to the configured fields.

## Chatbot

### `Chatbot_create`

`POST /sleek-ai/v1/chatbot`, requires `manage_options`.

Creates a chatbot from the body, which needs at least a `name`; a new chatbot starts in wizard mode. Every call creates another chatbot.

### `Chatbot_files`

`GET /sleek-ai/v1/chatbot/files`, requires `manage_options`.

The files Sleek AI uploaded to OpenAI for chatbot file search.

### `Chatbot_list`

`GET /sleek-ai/v1/chatbot`, requires `manage_options`.

Every saved chatbot, newest first.

### `Chatbot_log`

`GET /sleek-ai/v1/chatbot/log/{logId}`, requires `manage_options`.

One logged conversation with its messages.

### `Chatbot_logDeleteAll`

`POST /sleek-ai/v1/chatbot/log/delete-all`, requires `manage_options`.

Deletes every logged conversation of the chatbot named by `chatbotId`.

### `Chatbot_logDeleteMultiple`

`POST /sleek-ai/v1/chatbot/log/delete-multiple`, requires `manage_options`.

Deletes the logged conversations listed in `ids`.

### `Chatbot_logs`

`GET /sleek-ai/v1/chatbot/{id}/logs`, requires `manage_options`.

The chatbot's logged conversations, newest first.

### `Chatbot_logsPost`

`POST /sleek-ai/v1/chatbot/{id}/logs`, requires `manage_options`.

The chatbot's logged conversations, paged by the query `args` in the body.

### `Chatbot_read`

`GET /sleek-ai/v1/chatbot/{id}`, requires `manage_options`.

One chatbot: its name, data, conditions, model, widget and logs settings.

### `Chatbot_remove`

`DELETE /sleek-ai/v1/chatbot/{id}`, requires `manage_options`.

Deletes a chatbot and the files it synchronized to OpenAI.

### `Chatbot_update`

`PATCH /sleek-ai/v1/chatbot/{id}`, requires `manage_options`.

Replaces a chatbot's whole definition with the body, not a partial merge, and reschedules its file synchronization.

## Completions

### `Completions_create`

`POST /sleek-ai/v1/completions`, requires `manage_options`.

Answers one completion for `model` and `messages`, streamed as server-sent events or written to a polling file. An administrator may send any request; a visitor's request is accepted only with the parameters and token a rendered chatbot carries.

### `Completions_models`

`GET /sleek-ai/v1/completions/models`, requires `manage_options`.

The models of every provider with a stored key, grouped by provider, with the current user's custom models unless `excludeCustom` is set. Users whose role may use the Agent call it too.

### `Completions_streamTest`

`GET /sleek-ai/v1/completions/stream-test`, requires `manage_options`.

A short server-sent event stream a browser reads to test whether the server can stream.

### `Completions_streamTestResult`

`POST /sleek-ai/v1/completions/stream-test/result`, requires `manage_options`.

Stores a browser's streaming test result, `supported`, which decides whether later completions stream or poll.

## CustomModels

### `CustomModels_create`

`POST /sleek-ai/v1/custom-models`, requires `manage_options`.

Stores a new custom model for the current user from the body, which needs an `id`; one that already exists is answered as stored.

### `CustomModels_list`

`GET /sleek-ai/v1/custom-models`, requires `manage_options`.

The current user's rows of `sleekai_models`, newest first, as `items`; the custom models are those whose `name` starts with `custom-`.

### `CustomModels_remove`

`DELETE /sleek-ai/v1/custom-models/{id}`, requires `manage_options`.

Deletes the current user's custom model `id`.

### `CustomModels_update`

`PUT /sleek-ai/v1/custom-models/{id}`, requires `manage_options`.

Updates the fields the body carries of the current user's custom model `id`, creating it when it is missing.

## Data

### `Data_posts`

`GET /sleek-ai/v1/data/posts`, requires `manage_options`.

Up to ten posts of any type matching the search `s`, with the post `id` added first, as options for the chatbot editor.

### `Data_postsGet`

`GET /sleek-ai/v1/data/posts/{id}`, requires `manage_options`.

One post with its meta, for a chatbot variable's preview.

### `Data_query`

`POST /sleek-ai/v1/data/query`, requires `manage_options`.

Runs a chatbot query variable's `query` and answers the matching posts.

### `Data_querySingle`

`POST /sleek-ai/v1/data/query/single`, requires `manage_options`.

Runs a chatbot query variable's `query` and answers its first post.

### `Data_queryTokens`

`POST /sleek-ai/v1/data/query/tokens`, requires `manage_options`.

Renders a query variable's posts through its template and estimates the result's size: characters, posts and tokens at four characters each.

### `Data_taxonomies`

`GET /sleek-ai/v1/data/taxonomies/{id}`, requires `manage_options`.

One taxonomy, for a chatbot variable's preview.

### `Data_terms`

`GET /sleek-ai/v1/data/terms/{id}`, requires `manage_options`.

One term, for a chatbot variable's preview.

### `Data_users`

`GET /sleek-ai/v1/data/users`, requires `manage_options`.

Users matching the search `s`, with the user `id` added first, as options for the chatbot editor.

### `Data_usersGet`

`GET /sleek-ai/v1/data/users/{id}`, requires `manage_options`.

One user with their meta, for a chatbot variable's preview.

## LegacyChats

### `LegacyChats_list`

`GET /sleek-ai/v1/legacy-chats`, requires `manage_options`.

Every chat and message the current user saved in `sleekai_chats` and `sleekai_chat_messages`, as `chats` and `messages`, which the Chats page moves to its own history once.

## Options

### `Options_read`

`GET /sleek-ai/v1/options`, requires `manage_options`.

The settings document `sleek-ai_settings`: alt text, retention and the other site-wide settings.

### `Options_save`

`POST /sleek-ai/v1/options`, requires `manage_options`.

Writes `value` to the WordPress option named by `option`; the screens write `sleek-ai_settings` with it.

## UserSettings

### `UserSettings_read`

`GET /sleek-ai/v1/user-settings/{name}`, requires `manage_options`.

The current user's settings document `name` from `sleekai_settings`, such as the chat's, as `settings`; an empty object when none is saved.

### `UserSettings_save`

`PUT /sleek-ai/v1/user-settings/{name}`, requires `manage_options`.

Saves the body's `settings` object as the current user's settings document `name`, replacing the one saved before.
