Skip to main content

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 toUse
Run a campaign file from your machine or CIThe CLI: hackagent campaign run FILE
Run attacks from Python, or inside your own test suiteThe SDK
Launch saved campaigns, read reports or wire HackAgent into another system, from any languageThis API
Call the attacker or judge model from your own codeThe 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.

GroupWhat it holds
AgentsThe targets you test: a name and a model configuration
CampaignsSaved campaigns, the attack catalogue, the launch preflight and the launch
RunsCampaign runs and their attack runs, their status, reports and cancellation
ResultsOne attempt against a goal: what was sent, what came back, the verdict and the trace
Attack configurationsOne technique and its parameters, as recorded for each attack run
SecretsWrite-only API keys of the models your agents and campaigns use
LLM gatewayOpenAI-compatible chat completions from HackAgent's models
API keys, Usage logs, Organizations, Users, CreditsYour account. Most of these accept only the dashboard's login, not an API key
LicenseThe 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 answers 404.
  • 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​

  1. Create an API key and make your first request.
  2. Follow a campaign from creation to report.
  3. Handle errors, pagination and rate limits.