Create scans

Runs the detection engine over a batch of files and answers 201 with the scan summary: how many files were read, how many findings fired, and the tally by severity.

POST /v1/security/scans

Addresshttps://api.hanzo.ai/v1/security/scans
MethodPOST
Operationpost_security_scans
AuthAuthorization: Bearer $HANZO_API_KEY

Runs the detection engine over a batch of files and answers 201 with the scan summary: how many files were read, how many findings fired, and the tally by severity.

THE SUBMITTED CONTENT IS NEVER STORED. It is scanned in memory; what persists is the finding — its rule, its path and line, a MASKED preview (first and last characters kept, the middle starred) and the SHA-256 fingerprint of the raw secret. The fingerprint is what makes the same secret recognisable across scans and after rotation without the secret ever being written down.

It requires a validated org, which scopes the stored scan and every finding on it; a caller with no org is refused. Bounded at 500 files and 8 MiB of total content per submission — split a larger tree across scans. One scan is one metered unit, and the scan is recorded in the audit log with its tally, never with its findings.

Request

4 fields, body application/json (required).

FieldInTypeRequiredDescription
filesbodysecurity.scan[]yesFiles is the batch to scan, at most 500 files and 8 MiB of content in total.
files[].contentbodystring—Content is the source to scan.
files[].pathbodystring—Path is where the file lives, recorded on any finding so a result can be located in the tree it came from.
projectbodystring—Project names the sub-scope the scan is filed under.

Response

StatusBodyMeaning
201security.scanViewcreated
defaultproblem-detailsrefused

201 body — 9 fields.

FieldInTypeAlwaysDescription
createdAtbodyinteger (int64)—CreatedAt is when the scan ran, in Unix milliseconds.
criticalbodyinteger (int64)—Critical is how many findings carry the highest severity.
filesbodyinteger (int64)—Files is how many files the scan read.
findingsbodyinteger (int64)—Findings is how many secrets fired across them.
highbodyinteger (int64)—High is how many findings rank high.
idbodystring—ID addresses this scan and every finding on it.
lowbodyinteger (int64)—Low is how many findings rank low.
mediumbodyinteger (int64)—Medium is how many findings rank medium.
projectbodystring—Project is the sub-scope the scan was filed under.

Failure carries the platform error shape — see Errors.

Examples

hanzo security scans create --files '[{"content":"<content>","path":"<path>"}]'
import { Configuration, SecurityApi } from 'hanzoai';

const api = new SecurityApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postSecurityScans({ files: [{"content":"<content>","path":"<path>"}] });
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import SecurityApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = SecurityApi(client).post_security_scans(files=[{"content":"<content>","path":"<path>"}])
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.SecurityAPI.PostSecurityScans(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::apis::{configuration::Configuration, security_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = security_api::post_security_scans(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.SecurityApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new SecurityApi(client).postSecurityScans();
curl -X POST https://api.hanzo.ai/v1/security/scans \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "files": [
         {
           "content": "<content>",
           "path": "<path>"
         }
       ]
     }'

MCP reaches security through the security tool, which names its 7 operations with its own verbs — this one among them, under a name only MCP declares. describe explains any of them:

curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "describe",
         "arguments": {
           "op": "list_security_findings"
         }
       }
     }'

Security API · All Hanzo APIs · Interactive reference

Was this page useful?