Skip to main content

POST /api/static/scan

Trigger a new security scan for a specific repository and branch.

Request

Headers:
  • x-api-key (required): Your Rafter security API key
  • Content-Type: application/json
Body:
The github_token field is optional. When omitted, the scan uses the OAuth credentials linked to your Rafter account. Use this field for scanning private repositories without OAuth — the token only needs Contents:Read permission.
Fields:

Example Request

Response

Success (200 OK):
Error (400 Bad Request):
Error (401 Unauthorized):
Error (403 Forbidden — scan limit reached):
Error (403 Forbidden — insufficient scope):
Error (429 Too Many Requests):
The CLI maps this to exit code 3 (quota exhausted). Error (404 Not Found):
Error (500 Internal Server Error):

Response Fields

Rate Limiting

The API implements rate limiting to ensure fair usage:
  • Rate Limit: 100 requests per minute per IP address
  • Quota: Based on your subscription plan

Examples

JavaScript

Python

Next Steps

After triggering a scan, you can:
  1. Check scan status using the scan_id with the Get Results endpoint
  2. Wait for completion by polling the status endpoint
  3. Retrieve results once the scan is complete

Workflow Example