API Overview
This guide offers a basic overview and examples to help you use the API. For detailed technical information, please refer to the Command and Control (C2) server documentation.
By default, the C2 server provides the API in two formats:
If you have tuoni installed on the current machine:
- OpenAPI JSON: https://localhost:8443/docs/api
- Swagger UI: https://localhost:8443/docs/ui
If you have Tuoni installed on a remote machine, replace local-c2 with the remote IP or hostname:
- OpenAPI JSON:
https://{remote-ip-or-domain}:8443/docs/api - Swagger UI:
https://{remote-ip-or-domain}:8443/docs/ui
API Versions
The v2 endpoints provide paged and eventful representations for selected resources. Existing v1 endpoints remain supported and can continue to be used by current integrations. Each resource page identifies which version an operation uses.
Use v2 authentication for renewable sessions. The v1 login remains available with Basic credentials, but is deprecated.
v2 operations
| Endpoint | Purpose | Guide |
|---|---|---|
POST /api/v2/auth/login, /refresh, /logout |
Create, renew, and revoke refresh sessions | Authentication |
GET /api/v2/listeners |
Search and page through listeners | Listeners |
GET /api/v2/agents |
Search and page through agents | Agents |
GET /api/v2/payload-templates |
Search templates by name, plugin, OS, or architecture | Payloads |
GET /api/v2/plugins |
Search plugins by text, enabled state, and vendor | Plugins |
GET /api/v2/events |
Search activity history by event, actor, and time | Events |
/api/v2/agents/{AGENT_GUID}/commands/{COMMAND_ID}/notes |
Create and manage labeled command notes | Command Notes |
GET /api/v2/info |
Read the server version with an authenticated request | The response contains a version string |
Command searches support latest-update time filters and sorting for incremental polling.
Submitted and effective configurations
Command, listener, and payload responses expose effectiveConfiguration
alongside the originally submitted configuration. The effective configuration contains
resolved defaults and existing file references reported by the initialized plugin.
It is null when reporting is unsupported or no successful configuration is available.
File references point to live file contents, not a frozen copy. Use the two fields to
distinguish what was submitted from the configuration the plugin actually uses.
Configuration files in requests
Command, command-update, alias, listener, and payload requests can include a
configurationFiles array. Each entry names the configuration file field in
fileName and supplies exactly one source:
| Field | Meaning |
|---|---|
fileName |
File field name from the plugin's configuration schema; required |
existingFileId |
UUID of a file already stored on the server |
fileContent |
Base64-encoded content for a new file |
For example, a JSON request can reuse an existing file:
To send new content inline, replace existingFileId with fileContent. Never
set both in the same entry. Multipart requests can instead attach a file part
named for the schema's file field.
Pagination and Sorting
Paged v2 endpoints use zero-based page numbers. Unless an endpoint says otherwise, page defaults to 0, and pageSize defaults to 100, with an allowed range of 1 to 1000.
Every paged response contains:
| Field | Type | Description |
|---|---|---|
itemCount |
integer | Number of items in this page |
page |
integer | Zero-based page number returned |
pageSize |
integer | Requested page size |
totalCount |
integer | Total number of matching items |
totalPages |
integer | Total number of matching pages |
hasMorePages |
boolean | Whether another page follows this one |
items |
array | Resource records in the current page |
Sorting values use FIELD[:ASC|DESC]. Repeat the sort query parameter to apply multiple criteria in order:
Each endpoint documents its supported sort fields.
Eventful Responses and Audit Actors
Eventful v2 resources include createEvent and lastUpdateEvent. Each contains the event id (UUID), eventType, time (date-time), and actor, providing provenance for creation and the latest update.
The actor's actorType discriminator identifies one of these variants:
actorType |
Source | Additional fields |
|---|---|---|
api |
Authenticated API user | username, endpoint |
plugin |
Server plugin | plugin metadata containing id, version, and type |
script |
Server-side script | scriptFilePath |
server |
Tuoni server | reason |
unknown |
Unidentified source | No variant-specific fields |