Skip to content

Latest commit

 

History

History
227 lines (147 loc) · 4.09 KB

File metadata and controls

227 lines (147 loc) · 4.09 KB

SPIR API Reference

Base URL: http://localhost:8000

Authentication: Include X-API-Key: <your-key> header on all protected endpoints.


Health

GET /health

Check API health (no auth required).

Response:

{"status": "healthy", "version": "1.0.0"}

Dashboard

GET /api/dashboard

Get the main dashboard data.

curl -H "X-API-Key: $KEY" http://localhost:8000/api/dashboard

Response:

{
  "security_score": {
    "overall_score": 67.5,
    "grade": "B",
    "color": "yellow",
    "status_text": "Good",
    "dimensions": [...]
  },
  "alert_summary": {
    "total": 12,
    "open": 5,
    "by_severity": {"critical": 1, "high": 2, "medium": 2}
  },
  "compliance_status": {
    "nis2": {"name": "NIS2 Directive", "score_percent": 40},
    ...
  },
  "recent_alerts": [...],
  "recent_incidents": [...]
}

Alerts

GET /api/alerts

List alerts with optional filters.

Query params: status (open/acknowledged/resolved), severity (critical/high/medium/low), limit (default 100)

curl -H "X-API-Key: $KEY" "http://localhost:8000/api/alerts?status=open&severity=critical"

GET /api/alerts/{id}

Get a single alert.

POST /api/alerts/{id}/acknowledge

Acknowledge an alert.

POST /api/alerts/{id}/resolve

Resolve an alert.

POST /api/alerts/{id}/false-positive

Mark an alert as a false positive.


Incidents

GET /api/incidents

List incident tickets.

GET /api/incidents/playbooks

List all available playbooks.

POST /api/incidents/trigger

Trigger a playbook.

curl -X POST \
  -H "X-API-Key: $KEY" \
  -H "Content-Type: application/json" \
  -d '{"playbook_id": "PB-RANSOMWARE", "context": {"source_ip": "10.0.0.1", "hostname": "server-01"}}' \
  http://localhost:8000/api/incidents/trigger

POST /api/incidents/{id}/notes

Add a note to an incident ticket.


Compliance

GET /api/compliance/frameworks

List all compliance frameworks with scores.

GET /api/compliance/frameworks/{id}

Get a specific framework with all controls.

Framework IDs: nis2, bsi_grundschutz, iso27001, gdpr

PUT /api/compliance/frameworks/{framework_id}/controls/{control_id}

Update a control's implementation status.

curl -X PUT \
  -H "X-API-Key: $KEY" \
  -H "Content-Type: application/json" \
  -d '{"status": "implemented", "evidence": ["Policy v2.0"]}' \
  http://localhost:8000/api/compliance/frameworks/nis2/controls/NIS2-21-2-A

GET /api/compliance/frameworks/{id}/gaps

Get gap analysis for a framework.

GET /api/compliance/frameworks/{id}/report

Generate a compliance report.

Query params: format (text/json, default: json)


Identity

GET /api/identity

Get identity and access report.

Response includes: total users, MFA coverage, dormant users, over-privileged accounts.


VAPT Integration

POST /api/vapt/import

Import VAPT scan results.

curl -X POST \
  -H "X-API-Key: $KEY" \
  -H "Content-Type: application/json" \
  -d '{"scan_id": "scan-001", "scan_date": "2024-01-01T00:00:00", "findings": [...]}' \
  http://localhost:8000/api/vapt/import

Finding schema:

{
  "id": "vuln-001",
  "title": "SQL Injection",
  "severity": "critical",
  "description": "...",
  "cvss_score": 9.8,
  "cve_ids": ["CVE-2024-0001"],
  "affected_host": "10.0.0.1",
  "affected_port": 80,
  "remediation_steps": "Use parameterized queries"
}

GET /api/vapt/findings

List all findings with optional filters.

Query params: severity, status

GET /api/vapt/summary

Get VAPT summary statistics.

PUT /api/vapt/findings/{id}/status

Update a finding's remediation status.

curl -X PUT \
  -H "X-API-Key: $KEY" \
  -H "Content-Type: application/json" \
  -d '{"status": "fixed", "notes": "Patched in deploy 2024-01-15"}' \
  http://localhost:8000/api/vapt/findings/vuln-001/status

Collectors

GET /api/collectors

Get collector status and statistics.


Settings

GET /api/settings

Get current platform configuration (non-sensitive fields only).