CI/CD Integration
The HarborGuard API is what you wire into CI. The pattern is always the same: trigger a scan with POST /api/scans, poll GET /api/scans/{scanId} until it leaves IN_PROGRESS, then read the compliance grade and decide whether to ship.
Authentication
Generate an API key in Settings -> API Keys. Pick the lowest role that works:
| Role | Can scan | Can read scans | Can mutate orgs |
|---|---|---|---|
viewer | no | yes | no |
developer | yes | yes | no |
admin | yes | yes | yes |
For CI, developer is right.
Send the key as either header:
Rate limit on POST /api/scans is 10 requests per minute per key.
Trigger a scan
Response (HTTP 202):
scanners must be a non-empty subset of ["trivy", "grype", "syft", "dockle", "osv", "dive"].
Poll for completion
Status moves PENDING -> IN_PROGRESS -> COMPLETED (or FAILED). When COMPLETED, the response includes:
Gate on compliance (the grade) and/or on the raw counts if you want stricter rules than the grade encodes.
Pipeline examples
Tightening the gate
Grade-based gating is coarse. For finer control, read counts directly:
Failure modes to handle
- HTTP 429 - rate limit. Back off and retry.
- HTTP 402 - your org's plan scan limit was hit. Upgrade or wait.
status: FAILED- checklogson the scan detail page; common causes are private-registry pull failures and unreachable images.- Polling timeout - large images can exceed 10 minutes. Tune the loop.