HTTP API
The HackAgent API stores what HackAgent does: the agents you test, the campaigns you run against them, and every run with its results, traces and reports. It also queues campaign runs on HackAgent cloud, and serves the LLM gateway, the attacker and judge models that campaigns use. The dashboard, the SDK and the CLI are all built on it.
Everything is JSON over HTTPS at:
https://api.hackagent.dev
Paths in these pages are relative to that address: GET /agent means GET https://api.hackagent.dev/agent.
When to use it
| You want to | Use |
|---|---|
| Run a campaign file from your machine or CI | The CLI: hackagent campaign run FILE |
| Run attacks from Python, or inside your own test suite | The SDK |
| Launch saved campaigns, read reports or wire HackAgent into another system, from any language | This API |
| Call the attacker or judge model from your own code | The LLM gateway |
The SDK and the CLI write to this API when a campaign stores its results remotely (see Local or remote), so what they record is readable here too.
What it covers
Each group below is a section of the reference, with one page per operation.
| Group | What it holds |
|---|---|
| Agents | The targets you test: a name and a model configuration |
| Campaigns | Saved campaigns, the attack catalogue, the launch preflight and the launch |
| Runs | Campaign runs and their attack runs, their status, reports and cancellation |
| Results | One attempt against a goal: what was sent, what came back, the verdict and the trace |
| Attack configurations | One technique and its parameters, as recorded for each attack run |
| Secrets | Write-only API keys of the models your agents and campaigns use |
| LLM gateway | OpenAI-compatible chat completions from HackAgent's models |
| API keys, Usage logs, Organizations, Users, Credits | Your account. Most of these accept only the dashboard's login, not an API key |
| License | The license of a self-hosted installation |
Conventions
- Authentication. Every request needs
Authorization: Bearer <api-key>. See Authentication. - No trailing slash. Paths are
/agent, not/agent/; the second answers404. - JSON in, JSON out. Send request bodies as JSON with
Content-Type: application/json. - Identifiers. Most objects are identified by a UUID. API keys are identified by their prefix, secrets by their name, and trace steps and usage logs by an integer.
- Organizations. Everything belongs to your organization. You only see and change its objects; another organization's object answers
404. - Lists are paginated. See Errors, pagination and limits.
Versioning
Paths carry no version number. The /v1 in the gateway's paths (/v1/chat/completions, /v1/models) follows the OpenAI API it imitates; it is not a version of this API. The reference on this site is generated from the API's OpenAPI schema; download it to generate a client in your language.
Next steps
- Create an API key and make your first request.
- Follow a campaign from creation to report.
- Handle errors, pagination and rate limits.