Skip to main content

GET /api/static/scan

Check the status of a scan and retrieve results once completed.

Request

Headers:
  • x-api-key (required): Your Rafter API key
Query Parameters:
  • scan_id (required): The scan request ID to check
  • format (optional): Output format - json (default), md, or sarif. format only changes the response shape once the scan has completed; a pending, processing, or failed scan returns the same body regardless of format.

Example Requests

Check status (JSON format):
Get results in Markdown format (format=md):

Response

Scan Pending/Processing

Status: pending, queued, or processing

Scan Completed (JSON Format)

Status: completed

Scan Completed (Markdown Format - format=md)

Status: completed with format=md When format=md is specified, the response includes a markdown field containing a security report written as a prompt for an AI coding agent. Findings that share a description are grouped into one issue, with its severity, count, and file/line locations.
Rule IDs in the markdown report are hashed (R- plus five hex characters), so they do not match the rule_id values in the JSON format. The report opens with a security-engineer role prompt and ends with a request for a fix and a one-line note per finding. A scan with no findings returns a short “No Issues Found” report.

Scan Failed

Status: failed
error_code is drawn from a stable, closed catalog — programs should branch on it rather than on the error text, which can change. A failure that requires you to fix something in your account (for example a revoked GitHub token) also includes an action_url pointing at the page to fix it:
retryable is true when re-running the same scan unchanged might succeed (a timeout or a transient worker fault), and false when something about the input or your account has to change first. A handful of other error_code values you may see: REPO_NOT_FOUND, ACCESS_DENIED, NEEDS_TOKEN, SCAN_TIMEOUT, SCAN_FAILED (the generic fallback).

No Vulnerabilities Found

Status: completed with no issues

Error Responses

Error (400 Bad Request):
or, when scan_id is missing:
The API key is checked first, so a request missing both returns the API key error. Error (401 Unauthorized):
Error (404 Not Found):
Error (502 Bad Gateway):
Returned for a completed scan whose report could not be read from storage. It is never reported as an empty vulnerabilities list. Error (500 Internal Server Error):

Response Fields

Common Fields

Completed Scan Fields (JSON)

Vulnerability Object Fields

Failed Scan Fields

format=sarif on a completed scan returns the full SARIF 2.1.0 document directly — it is not wrapped in the status/scan_id envelope the way json and md are.

Examples

JavaScript

Python