Home API Reference

API Reference

Bhairava exposes a REST API under /api, a GraphQL endpoint at /graphql, and a WebSocket at /ws. All endpoints require a Bearer JWT except login and health.

Interactive API docs (Swagger UI) are available on any running instance at /docs, and ReDoc at /redoc.

Authentication flow

Obtain an access token from the login endpoint, then send it as a Bearer token in the Authorization header on every subsequent request.

# 1. Obtain an access token
curl -X POST https://soc.example.com/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{"username":"admin","password":"..."}'

# 2. Call authenticated endpoints with the token
curl https://soc.example.com/api/alerts \
  -H "Authorization: Bearer $TOKEN"

Authentication

Session lifecycle, current-user lookup, self-service registration, and multi-factor auth.

MethodEndpointDescription
POST/api/auth/loginObtain a JWT access token.
POST/api/auth/refreshExchange a refresh token for a new access token.
GET/api/auth/meCurrent authenticated user and roles.
POST/api/auth/logoutRevoke the current session.
POST/api/auth/registerCreate a viewer-only account.
POST/api/auth/mfaEnroll, verify, and manage MFA under /api/auth/mfa.

Alerts

Query, aggregate, correlate, and escalate security alerts.

MethodEndpointDescription
GET/api/alertsList alerts (filterable by severity, source, status, time).
GET/api/alerts/statsVolume & severity statistics.
POST/api/alerts/bulkBulk-create alerts.
PATCH/api/alerts/bulkBulk-update alerts.
GET/api/alerts/<id>/similarAlerts similar to the given one.
POST/api/alerts/<id>/escalate-to-incidentPromote an alert to an incident.
GET/api/alerts/groupsCorrelated alert groups.

Incidents

Manage incidents, their metrics, and response templates.

MethodEndpointDescription
GET/api/incidentsList incidents.
GET/api/incidents/metricsMTTR, MTTD, and volume metrics.
GET/api/incidents/<id>Retrieve a single incident.
PATCH/api/incidents/<id>Update incident state, assignee, or notes.
GET/api/incidents/templatesResponse playbook templates.

Agents & Fleet

Drive the AI agent pool and manage enrolled endpoint agents.

MethodEndpointDescription
GET/api/agents/workersAI agent pool status.
POST/api/agents/l1/pick-nextHave an L1 agent claim the next alert.
POST/api/agents/auto-runStart the autonomous triage loop.
POST/api/agents/managed/<id>/heartbeatEndpoint agent check-in.
GET/api/agents/managed/fleet/summaryFleet health summary.
GET/api/agents/managed/enrollment-tokensList enrollment tokens.
GET/api/agents/managed/setup/install.shLinux installer (also install.ps1, install-macos.sh, docker-compose.yml).

Detection

Author and inspect Sigma detection rules and coverage.

MethodEndpointDescription
GET/api/detection/rulesList detection rules.
POST/api/detection/rulesCreate a detection rule.
GET/api/detection/active-rulesRules currently deployed to the engine.
GET/api/detection/coverage-analysisMITRE ATT&CK coverage & gaps.

Hunting

Generate hypotheses and run threat hunts.

MethodEndpointDescription
POST/api/hunting/generate-hypothesesAI-generated hunt hypotheses.
POST/api/hunting/executeRun an ad-hoc hunt query.
GET/api/hunting/huntsList saved and scheduled hunts.
POST/api/hunting/hunts/<id>/executeExecute a saved hunt.

Forensics

Work with forensic cases and export evidence.

MethodEndpointDescription
GET/api/forensics/casesList forensic cases.
GET/api/forensics/cases/<id>Retrieve a case with artifacts.
POST/api/forensics/cases/<id>/exportExport a case evidence bundle.

Compliance

Assess controls against compliance frameworks.

MethodEndpointDescription
GET/api/compliance/frameworksList supported frameworks.
GET/api/compliance/controls/<framework>Controls for a framework.
POST/api/compliance/controls/<framework>/assessRun an assessment for a framework.

Threat Intelligence

Look up indicators of compromise and manage feeds.

MethodEndpointDescription
GET/api/threat-intel/ip/<ip>Reputation & enrichment for an IP.
GET/api/threat-intel/hash/<hash>File hash reputation lookup.
GET/api/threat-intel/domain/<domain>Domain reputation lookup.
GET/api/threat-intel/feedsConfigured threat intel feeds.

MCP

Inspect Model Context Protocol servers, their tools, and health.

MethodEndpointDescription
GET/api/mcp/serversList MCP servers.
GET/api/mcp/servers/health-overviewAggregate server health.
GET/api/mcp/toolsList all exposed MCP tools.
POST/api/mcp/servers/test-connectionTest connectivity to a server.