API: Commands
This section covers command templates and how to send commands to agents via the API.
List Command Plugins
Retrieve a list of available command plugins:
Enable a Command Plugin
Enable a previously disabled command plugin. Disabled plugins have their command templates hidden from agents.
Returns the updated plugin object.
Disable a Command Plugin
Disable a command plugin. Its command templates will no longer be offered to agents until re-enabled.
Returns the updated plugin object.
List Command Templates
Get a list of command templates:
Command Template Details
Fetch details for a specific command template:
Send a Command to an Agent
Issue a command by specifying the template and configuration. Optionally include an execConf block to control execution context.
JSON request:
Multipart request (when the command configuration uses files):
Use the file field name from the command schema. For example, a schema field shown as @files.executable is sent as a multipart file part named executable.
For JSON file reuse or inline Base64 content, see
Configuration files in requests.
Examples
Example 1 – Basic Command
Run a simple command, such as "whoami", using the "cmd" template:
Example 2 – Spawning a New Process
Spawn a new process with the "spawn" template.
Info
payloadId must reference a payload of type SHELLCODE.
Search Commands (v2)
Use the paged v2 endpoints to search commands across all visible agents or within one agent:
AGENT_GUID is a UUID. The agent-specific operation returns 404 when that agent does not exist.
Pagination and filters
| Parameter | Applies to | Description |
|---|---|---|
page |
Both endpoints | Zero-based page number; defaults to 0; minimum 0 |
pageSize |
Both endpoints | Items per page; defaults to 100; minimum 1, maximum 1000 |
status |
Both endpoints | Lifecycle status to include; repeat for multiple statuses |
commandTemplateName |
Both endpoints | Exact, case-sensitive persisted template name; repeat for multiple names |
agentGuid |
All-commands endpoint | Agent UUID to include; repeat for multiple agents |
createdSince, createdBefore |
Both endpoints | Inclusive lower and exclusive upper creation-time bounds |
sentSince, sentBefore |
Both endpoints | Inclusive lower and exclusive upper effective send-time bounds |
updatedSince, updatedBefore |
Both endpoints | Inclusive lower and exclusive upper bounds for the latest update event |
sort |
Both endpoints | Sort criterion; repeat to apply multiple criteria in order |
Omitting an array filter includes all values. An explicitly empty array matches no commands.
Supported lifecycle statuses are CREATED, SENT, ONGOING, CANCELED, FAILED, and COMPLETE.
Each sort field accepts the bare field, :ASC, or :DESC form:
| Field | Accepted values |
|---|---|
| Command ID | ID, ID:ASC, ID:DESC |
| Agent GUID | AGENT_GUID, AGENT_GUID:ASC, AGENT_GUID:DESC |
| Creation time | CREATED, CREATED:ASC, CREATED:DESC |
| Send time | SENT, SENT:ASC, SENT:DESC |
| Latest update | LAST_UPDATE, LAST_UPDATE:ASC, LAST_UPDATE:DESC |
| Lifecycle status | STATUS, STATUS:ASC, STATUS:DESC |
For example, search across agents with several filters and two sort criteria:
Or retrieve the second page of failed commands for one agent:
Incremental polling
Use updatedSince, updatedBefore, and sort=LAST_UPDATE:ASC to poll commands whose
latest update changed. Updates include creation, sends, cancellation, queued updates,
and persisted results. Time bounds are truncated to seconds; Since includes its named
second and Before excludes it. Equal or reversed normalized bounds match no commands.
Overlap polling windows and deduplicate by command ID. Offset pages can change during concurrent updates, and delayed persistence can appear behind a checkpoint. This is not a lossless change feed; periodically reconcile with the full command listing.
The createdFrom, createdTo, sentFrom, and sentTo filters are deprecated
aliases. The To aliases are inclusive: replace a To upper bound with a Before bound
one second later for equivalent results. The corresponding replacement parameter takes precedence
when both forms are supplied.
Paged response
A successful request returns the shared paged response. Its items are eventful command records with these fields:
| Field | Type | Description |
|---|---|---|
id |
integer | Unique command ID |
commandTemplateId |
UUID | Command-template ID |
commandTemplateName |
string or null | Persisted command-template name |
configuration |
object | Command configuration; multipart configurations can include an @files object |
effectiveConfiguration |
object or null | Latest configuration reported by the initialized plugin, including resolved defaults and file references |
execConf |
object | Execution configuration |
agentGuid |
UUID | Agent that owns the command |
created |
date-time | Command creation time |
sent |
date-time or null | Command send time |
sendFormat |
string or null | Format used to send the command |
sends |
array | Individual command send attempts, described below |
status |
string | Command lifecycle status |
commandUpdates |
array | Updates created for the command |
result |
object or null | Composite command result |
createEvent |
object | Creation audit metadata |
lastUpdateEvent |
object | Latest-update audit metadata |
See Eventful Responses and Audit Actors for the audit event and actor fields.
Each entry in sends describes one delivery attempt:
| Field | Type | Description |
|---|---|---|
sendTime |
date-time | Time of the attempt |
listenerId |
integer or null | Listener that sent the command |
status |
string | SUCCEEDED or FAILED |
errorMessage |
string or null | Delivery error, when present |
sendFormat |
string or null | Format used for this attempt |
event |
object or null | Audit event created for this attempt |
The all-commands endpoint returns 200, 401, or 403. The agent-specific endpoint can also return 404 when AGENT_GUID is not found.
Large Result Entries
Command listings and event notifications limit the size of each text or binary result
entry. When an entry reaches the limit, its response has type: "omitted", the
original realType (text or binary), a human-readable size, and no content.
The default limits are 250KB for REST listings and 50KB for WebSocket
notifications. Configure them with tuoni.api.command-result-max-size and
tuoni.websocket.command-result-max-size, respectively.
If an entry is omitted, request GET /api/v1/commands/{COMMAND_ID} to retrieve
the full public result entry. This individual-command endpoint does not apply the listing
limit. A file result remains a file reference; download it through the file API.
Command Notes
For labeled annotations, see Command Notes. Notes are available through the v2 API and server-side Python scripting.
Retrieve Agent Commands
Get all commands sent to a specific agent:
Retrieve All Commands
List all commands issued across agents:
Response is a JSON object keyed by command ID, where each value is a CommandResponse
with the large result entry limit. The individual-command
endpoint returns the same response shape with complete text and binary entries:
Get Command Result
Fetch the result for a specific command:
Send a Command Update
Send new data to an already-running command. Use JSON for commands that only require a configuration update, or multipart form-data when you also need to attach files.
JSON variant:
Multipart variant (when files are required):
Use the file field name from the command update's configuration schema, as for
command creation. You can also set persistenceType
in requestBody to PERSISTENT (the default) or TRANSIENT.
Download a Command Configuration File
Download a file that was attached to the original command's configuration.
Returns the file as an octet-stream download.
Download a Command Update Configuration File
Download a file attached to a specific command update.
UPDATE_INDEX is the zero-based position of the update in the command's update history.
Returns the file as an octet-stream download.
Download a Command Result File
Download a file returned as part of a command's result.
Returns the file as an octet-stream download. UTF-8 filenames are preserved, with a safe ASCII filename fallback for clients that do not support the UTF-8 form.
Stop command
Sends stop signal to a command identified by ID. If command is not yet sent, then the command will be canceled and never sent.