Skip to content

API Reference

The NIS2 Platform exposes a REST API at http://localhost:8000. All routes are prefixed with /api/v1/. Interactive OpenAPI documentation is available at /docs (Swagger UI) and /redoc (ReDoc).

All endpoints return JSON. Authenticated endpoints require a Bearer token in the Authorization header.

Authentication

MethodPathDescriptionAuth
POST/api/v1/auth/registerRegister a new user and create an organization. Returns access and refresh tokensNo
POST/api/v1/auth/loginObtain access and refresh tokensNo
POST/api/v1/auth/refreshRefresh an expired access token using a refresh tokenNo
GET/api/v1/auth/meGet current user profileYes
PATCH/api/v1/auth/meUpdate current user profileYes

Scans

MethodPathDescriptionAuth
GET/api/v1/scansList scans for current organization. Filterable by status. PaginatedYes
POST/api/v1/scansCreate and queue a new scanYes
GET/api/v1/scans/{scan_id}Get scan details and statusYes
DELETE/api/v1/scans/{scan_id}Delete a scan and its findings (admin only)Yes
GET/api/v1/scans/{scan_id}/resultsList raw scan results for a scan. PaginatedYes
GET/api/v1/scans/{scan_id}/findingsList findings for a scan. PaginatedYes
POST/api/v1/scans/{scan_id}/cancelCancel a pending or running scanYes
GET/api/v1/scans/{scan_id}/compare/{other_id}Compare two scans: score delta, new/resolved/persistent findingsYes

Findings

MethodPathDescriptionAuth
GET/api/v1/findingsList all findings. Filterable by severity, status, category. PaginatedYes
GET/api/v1/findings/statsGet finding counts grouped by severity and statusYes
GET/api/v1/findings/{finding_id}Get finding detailsYes
PATCH/api/v1/findings/{finding_id}Update finding status or resolution noteYes
POST/api/v1/findings/bulk-updateBulk update status for multiple findingsYes

Assets

MethodPathDescriptionAuth
GET/api/v1/assetsList assets for current organization. PaginatedYes
POST/api/v1/assetsCreate a new assetYes
GET/api/v1/assets/{asset_id}Get asset detailsYes
PATCH/api/v1/assets/{asset_id}Update an assetYes
DELETE/api/v1/assets/{asset_id}Delete an assetYes
POST/api/v1/assets/importImport assets from a CSV fileYes

Schedules

MethodPathDescriptionAuth
GET/api/v1/schedulesList scan schedulesYes
POST/api/v1/schedulesCreate a scan schedule (cron expression). Admin or auditor onlyYes
PATCH/api/v1/schedules/{schedule_id}Update a scheduleYes
DELETE/api/v1/schedules/{schedule_id}Delete a scheduleYes
POST/api/v1/schedules/{schedule_id}/runTrigger an immediate run of a scheduled scanYes

Reports

MethodPathDescriptionAuth
POST/api/v1/reports/generateQueue report generation for a completed scan. Params: scan_id, format (pdf, json, csv). Returns a task_idYes
GET/api/v1/reports/status/{task_id}Check report generation status by Celery task IDYes
GET/api/v1/reports/download/{task_id}Download a generated report file by Celery task IDYes

Organizations

MethodPathDescriptionAuth
GET/api/v1/organizationsList organizations the current user belongs toYes
GET/api/v1/organizations/{org_id}Get organization detailsYes
PATCH/api/v1/organizations/{org_id}Update organization settings (admin only)Yes
GET/api/v1/organizations/{org_id}/membersList organization membersYes
POST/api/v1/organizations/{org_id}/membersInvite a member by email (admin only)Yes
PATCH/api/v1/organizations/{org_id}/members/{member_id}Update a member's role (admin only). Query param: role (admin, auditor, viewer)Yes
DELETE/api/v1/organizations/{org_id}/members/{member_id}Remove a member (admin only). Cannot remove the last adminYes

Health

MethodPathDescriptionAuth
GET/api/v1/healthLiveness check. Returns {"status": "ok"}No
GET/api/v1/health/readyReadiness check. Tests database and Redis connectivityNo

Error Responses

All errors follow a consistent format:

json
{
  "detail": "Description of the error"
}

Common HTTP status codes:

CodeMeaning
400Bad request (validation error)
401Unauthorized (missing or invalid token)
403Forbidden (insufficient role permissions)
404Resource not found
409Conflict (duplicate resource)
422Unprocessable entity (invalid request body)
500Internal server error

Released under the MIT License.