# Create scans

URL: https://docs.hanzo.ai/docs/openapi/security/post-security-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`

> [Security →](https://docs.hanzo.ai/docs/openapi/security) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                          |
| ------------- | ---------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/security/scans` |
| **Method**    | `POST`                                   |
| **Operation** | `post_security_scans`                    |
| **Auth**      | `Authorization: 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).

| Field             | In   | Type             | Required | Description                                                                                                |
| ----------------- | ---- | ---------------- | -------- | ---------------------------------------------------------------------------------------------------------- |
| `files`           | body | security.scan\[] | yes      | Files is the batch to scan, at most 500 files and 8 MiB of content in total.                               |
| `files[].content` | body | string           | —        | Content is the source to scan.                                                                             |
| `files[].path`    | body | string           | —        | Path is where the file lives, recorded on any finding so a result can be located in the tree it came from. |
| `project`         | body | string           | —        | Project names the sub-scope the scan is filed under.                                                       |

## Response

| Status    | Body              | Meaning |
| --------- | ----------------- | ------- |
| `201`     | security.scanView | created |
| `default` | problem-details   | refused |

`201` body — 9 fields.

| Field       | In   | Type            | Always | Description                                               |
| ----------- | ---- | --------------- | ------ | --------------------------------------------------------- |
| `createdAt` | body | integer (int64) | —      | CreatedAt is when the scan ran, in Unix milliseconds.     |
| `critical`  | body | integer (int64) | —      | Critical is how many findings carry the highest severity. |
| `files`     | body | integer (int64) | —      | Files is how many files the scan read.                    |
| `findings`  | body | integer (int64) | —      | Findings is how many secrets fired across them.           |
| `high`      | body | integer (int64) | —      | High is how many findings rank high.                      |
| `id`        | body | string          | —      | ID addresses this scan and every finding on it.           |
| `low`       | body | integer (int64) | —      | Low is how many findings rank low.                        |
| `medium`    | body | integer (int64) | —      | Medium is how many findings rank medium.                  |
| `project`   | body | string          | —      | Project is the sub-scope the scan was filed under.        |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo security scans create --files '[{"content":"<content>","path":"<path>"}]'
```

**SDK**

**.ts**

```ts
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>"}] });
```

**.py**

```python
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>"}])
```

**.go**

```go
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
}
```

**.rs**

```rust
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?;
```

**.java**

```java
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();
```

**HTTP**

```bash
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**

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:

```bash
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](https://docs.hanzo.ai/docs/openapi/security) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
