{"openapi":"3.1.0","info":{"title":"Kanon API","version":"1.0.0","description":"Send inventory records and events, upload evidence, and read checks and inventory.\n\nScopes: `ingest:write` (Send inventory records and events); `evidence:write` (Upload evidence (links start as proposed)); `checks:read` (Read checks and their results); `inventory:read` (Read the asset inventory).\n\nOutbound webhooks (configured in the app) are signed POSTs of {id, type, created_at, org_id, data} with headers X-Kanon-Event, X-Kanon-Delivery, X-Kanon-Timestamp and X-Kanon-Signature: v1=<hex HMAC-SHA256 of \"<timestamp>.<raw body>\">. Events: `check.failed` (A check started failing); `check.recovered` (A failing check recovered); `sync.failed` (A sync failed); `connection.disconnected` (A connection was disconnected); `finding.created` (A finding was created); `finding.status_changed` (A finding changed status); `cycle.closed` (An assessment cycle was closed). A delivery is retried with growing delays for up to 24 hours."},"servers":[{"url":"https://kanon.pistoslabs.com"}],"tags":[{"name":"Ingest"},{"name":"Evidence"},{"name":"Checks"},{"name":"Inventory"},{"name":"Inbound webhooks"}],"components":{"securitySchemes":{"ApiKey":{"type":"http","scheme":"bearer","description":"An API key created by a company admin under Settings, API and webhooks. Send it as \"Authorization: Bearer kn_...\"."}},"schemas":{"AssetRecord":{"type":"object","properties":{"external_id":{"type":"string","minLength":1,"maxLength":500,"description":"The record's id in the sending system. Sending it again updates the same asset."},"name":{"type":"string","maxLength":300,"description":"A display name. Defaults to the external id."},"attributes":{"type":"object","additionalProperties":{},"description":"The attributes of the asset class (see the inventory documentation). Unknown or invalid attributes reject that record."}},"required":["external_id","attributes"]},"EventRecord":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":200,"description":"Your own id for the event. Sending the same id twice stores it once."},"type":{"type":"string","minLength":1,"maxLength":100,"example":"training.completed"},"occurred_at":{"type":"string","format":"date-time","example":"2026-10-04T09:30:00Z"},"subject":{"type":"string","maxLength":300,"description":"Who or what the event is about, for example an email address."},"data":{"type":"object","additionalProperties":{}}},"required":["type","occurred_at"]},"RecordError":{"type":"object","properties":{"index":{"type":"integer"},"message":{"type":"string"}},"required":["index","message"]},"IngestBatch":{"type":"object","properties":{"batch_id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["queued","processing","complete","failed"]},"kind":{"type":"string","enum":["assets","events"]},"received":{"type":"integer"},"accepted":{"type":"integer"},"rejected":{"type":"integer"},"errors":{"type":"array","items":{"$ref":"#/components/schemas/RecordError"},"description":"Up to the first 100 rejected records."},"result":{"type":"object","additionalProperties":{},"description":"Counts once processing has finished."}},"required":["batch_id","status","kind","received","accepted","rejected","errors","result"]},"Error":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]},"IngestAssetsRequest":{"type":"object","properties":{"asset_class":{"type":"string","description":"One asset class per batch, for example identity_user, person, device, storage_bucket.","example":"person"},"complete":{"type":"boolean","default":false,"description":"True when this batch is the whole current set for this source and asset class: records no longer sent are marked deleted. A batch with any rejected record is refused outright when this is true."},"records":{"type":"array","items":{"$ref":"#/components/schemas/AssetRecord"},"minItems":1,"maxItems":1000}},"required":["asset_class","records"]},"IngestEventsRequest":{"type":"object","properties":{"events":{"type":"array","items":{"$ref":"#/components/schemas/EventRecord"},"minItems":1,"maxItems":1000}},"required":["events"]},"EvidenceUploaded":{"type":"object","properties":{"artifact_id":{"type":"string","format":"uuid"},"version_id":{"type":"string","format":"uuid"},"version_no":{"type":"integer"},"control_link":{"type":["string","null"],"enum":["proposed"],"description":"The link to the control starts as proposed: a reviewer decides whether it counts."}},"required":["artifact_id","version_id","version_no","control_link"]},"CheckSummary":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string"},"version":{"type":"integer"},"title":{"type":"string"},"asset_class":{"type":"string"},"status":{"type":"string","enum":["pass","fail","stale","error","no_data","never"]},"total":{"type":"integer"},"passed":{"type":"integer"},"failed":{"type":"integer"},"waived":{"type":"integer"},"not_applicable":{"type":"integer"},"evaluated_at":{"type":["string","null"],"format":"date-time"},"data_as_of":{"type":["string","null"],"format":"date-time"}},"required":["id","key","version","title","asset_class","status","total","passed","failed","waived","not_applicable","evaluated_at","data_as_of"]},"CheckPage":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CheckSummary"}},"next_cursor":{"type":["string","null"]}},"required":["data","next_cursor"]},"CheckResult":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"asset_id":{"type":"string","format":"uuid"},"asset_name":{"type":"string"},"external_id":{"type":"string"},"status":{"type":"string","enum":["pass","fail","waived","not_applicable","error"]},"reason":{"type":"string"}},"required":["id","asset_id","asset_name","external_id","status","reason"]},"CheckResultPage":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CheckResult"}},"next_cursor":{"type":["string","null"]}},"required":["data","next_cursor"]},"Asset":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"asset_class":{"type":"string"},"source":{"type":"string"},"connection_id":{"type":["string","null"],"format":"uuid"},"external_id":{"type":"string"},"name":{"type":"string"},"attributes":{"type":"object","additionalProperties":{}},"first_seen_at":{"type":"string","format":"date-time"},"last_seen_at":{"type":"string","format":"date-time"},"deleted_at":{"type":["string","null"],"format":"date-time"},"is_sample":{"type":"boolean"}},"required":["id","asset_class","source","connection_id","external_id","name","attributes","first_seen_at","last_seen_at","deleted_at","is_sample"]},"AssetPage":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Asset"}},"next_cursor":{"type":["string","null"]}},"required":["data","next_cursor"]}},"parameters":{}},"paths":{"/api/v1/ingest/{sourceKey}/assets":{"post":{"tags":["Ingest"],"summary":"Send a batch of asset records","description":"Upserts up to 1000 records (5 MB) of one asset class from the system called {sourceKey}. Valid records are accepted and invalid ones are listed in the response; the batch is then written to the inventory in the background (poll the batch). With \"complete\": true the batch is the whole current set for this source and class, so records left out are marked deleted; a complete batch with any invalid record is refused as a whole.","security":[{"ApiKey":["ingest:write"]}],"parameters":[{"schema":{"type":"string","pattern":"^[a-z0-9][a-z0-9_-]{1,40}$","description":"Your name for the sending system: lower case letters, digits, \"-\" and \"_\", 2 to 41 characters.","example":"hr-system"},"required":true,"name":"sourceKey","in":"path"},{"schema":{"type":"string","minLength":8,"maxLength":200,"description":"Required. A new value for each distinct request. Repeating a request with the same key and body returns the first response and changes nothing; the same key with a different body is a 409. Kept for 24 hours."},"required":true,"name":"Idempotency-Key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestAssetsRequest"}}}},"responses":{"202":{"description":"Accepted. status is \"queued\" until the worker has written it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestBatch"}}}},"400":{"description":"The request is not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The key is missing, wrong, revoked or expired.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the permission, or is not allowed from this address.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The Idempotency-Key was used with a different body.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Larger than 5 MB.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Nothing was valid, or a complete batch had invalid records.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Wait for the number of seconds in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/ingest/{sourceKey}/events":{"post":{"tags":["Ingest"],"summary":"Send append-only events","description":"Stores up to 1000 events (training completions, offboarding tickets...). Events cannot be changed afterwards. An event with an \"id\" that was already stored is ignored.","security":[{"ApiKey":["ingest:write"]}],"parameters":[{"schema":{"type":"string","pattern":"^[a-z0-9][a-z0-9_-]{1,40}$","description":"Your name for the sending system: lower case letters, digits, \"-\" and \"_\", 2 to 41 characters.","example":"hr-system"},"required":true,"name":"sourceKey","in":"path"},{"schema":{"type":"string","minLength":8,"maxLength":200,"description":"Required. A new value for each distinct request. Repeating a request with the same key and body returns the first response and changes nothing; the same key with a different body is a 409. Kept for 24 hours."},"required":true,"name":"Idempotency-Key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestEventsRequest"}}}},"responses":{"202":{"description":"Accepted and stored (status \"complete\").","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestBatch"}}}},"400":{"description":"The request is not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The key is missing, wrong, revoked or expired.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the permission, or is not allowed from this address.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The Idempotency-Key was used with a different body.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Larger than 5 MB.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Wait for the number of seconds in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/ingest/batches/{batchId}":{"get":{"tags":["Ingest"],"summary":"Check on a batch","security":[{"ApiKey":["ingest:write"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"batchId","in":"path"}],"responses":{"200":{"description":"The batch and, once finished, its counts.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestBatch"}}}},"400":{"description":"The request is not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The key is missing, wrong, revoked or expired.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the permission, or is not allowed from this address.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such batch.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Wait for the number of seconds in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/evidence":{"post":{"tags":["Evidence"],"summary":"Upload an evidence file","description":"Stores a file (up to 25 MB) as evidence, uploaded by this key. If control_id is given, the link between the evidence and the control starts as \"proposed\": a reviewer in the app decides whether it counts, as with every link.","security":[{"ApiKey":["evidence:write"]}],"parameters":[{"schema":{"type":"string","minLength":8,"maxLength":200,"description":"Required. A new value for each distinct request. Repeating a request with the same key and body returns the first response and changes nothing; the same key with a different body is a 409. Kept for 24 hours."},"required":true,"name":"Idempotency-Key","in":"header"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"},"title":{"type":"string","minLength":2,"maxLength":200},"description":{"type":"string","maxLength":5000},"control_id":{"type":"string","format":"uuid"}},"required":["file","title"]}}}},"responses":{"201":{"description":"Stored.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EvidenceUploaded"}}}},"400":{"description":"The request is not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The key is missing, wrong, revoked or expired.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the permission, or is not allowed from this address.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such control.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The Idempotency-Key was used with a different request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Larger than 25 MB.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Wait for the number of seconds in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/checks":{"get":{"tags":["Checks"],"summary":"List live checks with their latest result","security":[{"ApiKey":["checks:read"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"The next_cursor of the previous page."},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"string","description":"Page size, 1 to 200. Default 50.","example":"50"},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"A page of checks.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckPage"}}}},"400":{"description":"The request is not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The key is missing, wrong, revoked or expired.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the permission, or is not allowed from this address.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Wait for the number of seconds in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/checks/{key}/results":{"get":{"tags":["Checks"],"summary":"Per-asset results of a check's latest evaluation","security":[{"ApiKey":["checks:read"]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"key","in":"path"},{"schema":{"type":"string","format":"uuid","description":"The next_cursor of the previous page."},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"string","description":"Page size, 1 to 200. Default 50.","example":"50"},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"A page of results.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/CheckResultPage"},{"type":"object","properties":{"evaluation":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string"},"evaluated_at":{"type":["string","null"]},"data_as_of":{"type":["string","null"]},"check_version":{"type":"integer"}},"required":["id","status","evaluated_at","data_as_of","check_version"]}},"required":["evaluation"]}]}}}},"400":{"description":"The request is not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The key is missing, wrong, revoked or expired.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the permission, or is not allowed from this address.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No live check has that key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Wait for the number of seconds in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/inventory/assets":{"get":{"tags":["Inventory"],"summary":"List assets","security":[{"ApiKey":["inventory:read"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"The next_cursor of the previous page."},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"string","description":"Page size, 1 to 200. Default 50.","example":"50"},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"asset_class","in":"query"},{"schema":{"type":"string","description":"For example \"api:hr-system\" for records sent to the ingest API, or a connector key such as \"github\"."},"required":false,"name":"source","in":"query"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"include_deleted","in":"query"}],"responses":{"200":{"description":"A page of assets.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetPage"}}}},"400":{"description":"The request is not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The key is missing, wrong, revoked or expired.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the permission, or is not allowed from this address.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Wait for the number of seconds in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/hooks/{hookId}":{"post":{"tags":["Inbound webhooks"],"summary":"Call an inbound hook","description":"Authenticated by signature, not by API key. Send X-Kanon-Timestamp (unix seconds, within 5 minutes of now), X-Kanon-Nonce (8 to 200 characters, never reused) and X-Kanon-Signature: v1=<hex HMAC-SHA256 of \"<timestamp>.<nonce>.<raw body>\" with the hook's secret>. A hook either queues a re-sync of one connection or records an event. A hook made for pistos.io is called by pistos.io itself: it is signed with Pistos-Signature: t=<unix>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\"> using the whsec_ secret pistos.io showed, Pistos-Event-Id is its nonce, and it re-syncs every pistos.io connection.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"hookId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"X-Kanon-Timestamp","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Kanon-Nonce","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Kanon-Signature","in":"header"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":{}}}}},"responses":{"202":{"description":"Accepted.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["queued","already_queued","skipped","recorded","nothing_to_sync"]},"connections":{"type":"integer"}},"required":["status"]}}}},"401":{"description":"Unknown hook, bad signature or stale timestamp (all look alike).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"This nonce was already used.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Larger than 256 KB.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"webhooks":{}}