Ingest persists a CycloneDX SBOM's components keyed by image digest.
Ingest persists a CycloneDX SBOM's components keyed by image digest.
POST /v1/sbom
| Address | https://api.hanzo.ai/v1/sbom |
| Method | POST |
| Operation | post_sbom |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Ingest persists a CycloneDX SBOM's components keyed by image digest. Gated to a validated SuperAdmin (owner == AdminOrg) — the canonical cloud super-admin check, which the build fleet / CI carries. Re-ingest is idempotent: rows share the (digest, name, version, purl) ORDER BY, so ReplacingMergeTree keeps the latest by ingested_at (and resolve reads FINAL).
Request
6 fields, body application/json (required).
| Field | In | Type | Required | Description |
|---|---|---|---|---|
document | body | any | — | Document is the raw CycloneDX bill of materials, any JSON. |
format | body | string | — | Format names the document format; "cyclonedx" is the only one parsed. |
gitSha | body | string | — | GitSha is the commit the image was built from. |
imageDigest | body | string | — | ImageDigest is the content-addressed digest (sha256:…) the components are keyed under. |
imageRef | body | string | — | ImageRef is the human-readable image reference the digest was published as. |
sourceRepo | body | string | — | SourceRepo is the repository the image was built from. |
Response
| Status | Body | Meaning |
|---|---|---|
201 | SbomIngested | created |
201 body — 2 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
componentCount | body | integer | — | ComponentCount is how many components the CycloneDX document yielded and this call persisted. |
imageDigest | body | string | — | ImageDigest is the content-addressed digest the components were keyed under. |
Failure carries the platform error shape — see Errors.
Examples
hanzo sbom createimport { Configuration, SbomApi } from 'hanzoai';
const api = new SbomApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postSbom({ document: "<document>", format: "<format>" });from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import SbomApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = SbomApi(client).post_sbom(document="<document>", format="<format>")cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.SbomAPI.PostSbom(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::apis::{configuration::Configuration, sbom_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = sbom_api::post_sbom(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.SbomApi;
ApiClient client = new ApiClient();
client.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + System.getenv("HANZO_API_KEY")));
var result = new SbomApi(client).postSbom();curl -X POST https://api.hanzo.ai/v1/sbom \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"document": "<document>",
"format": "<format>"
}'The door reaches sbom through the sbom tool, which names its 3 operations with its own verbs — this one among them, under a name only the door 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": "get_sbom"
}
}
}'How is this guide?