Skip to content

Run a slash command

POST
/api/v1/chat/command/{command}
curl --request POST \
--url http://localhost:11044/api/v1/chat/command/example \
--header 'Content-Type: application/json' \
--header 'X-Embabel-Api-Key: <X-Embabel-Api-Key>' \
--data '{ "argument": "example" }'

Executes a world slash command by sending it as a chat message. The response is delivered via the SSE stream. An SSE stream must be open before running commands.

command
required
string

Name of one of the world’s slash commands, without the leading slash, matched case-insensitively; 404 when the world has no command by that name

Optional. argument is the text that follows the command, which is sent as the chat message /<command> <argument>; a body left out, or an argument that is null or blank, runs the bare /<command>. Its output arrives on the SSE stream, which must already be open or the request is refused with 409

Media typeapplication/json

Optional body of POST /chat/command/{command}: the text that follows the slash command

object
argument

Text appended after / and a space; null or blank runs the command with no argument

string

Example generated

{
"argument": "example"
}

Command accepted

Media type*/*
object
key
additional properties
string

Unknown command

Media type*/*

A refusal from the chat surface: the word error and the reason, written to be shown

object
message
required

What was refused and why, such as no open stream, no active session, or an unknown command

string
status
required

Always error. A client may branch on it rather than on the status code

string

Example

error

No active SSE stream — open /stream first

Media type*/*

A refusal from the chat surface: the word error and the reason, written to be shown

object
message
required

What was refused and why, such as no open stream, no active session, or an unknown command

string
status
required

Always error. A client may branch on it rather than on the status code

string

Example

error