Skip to main content

Compliance controls API

This page documents the 16 gateway endpoints tagged compliance controls in the gateway's OpenAPI document. Every example targets a gateway on http://localhost:4000 and authenticates with the SPANWAY_API_KEY environment variable, which holds the master key or a virtual key that has access to the route. Request and response fields are taken from the schema the running gateway publishes at /openapi.json, and the same document is bundled with this site as openapi.json.

MethodPathSummary
POST/compliance/data_subject/exportExport everything held about a person
POST/compliance/data_subject/eraseErase a person's data
GET/compliance/data_subject/listList data subject requests
GET/compliance/retentionRead the retention periods
PATCH/compliance/retentionSet or clear retention periods
POST/compliance/retention/runRun the retention cleanup now
GET/compliance/residencyCheck data residency
PATCH/compliance/residencySet the required model region
GET/compliance/controlsEvaluate the compliance controls
GET/compliance/reportBuild the compliance report
POST/compliance/report/snapshotStore a compliance report snapshot
GET/compliance/report/historyList stored compliance snapshots
GET/compliance/evidenceList stored compliance evidence bundles
POST/compliance/evidence/generateGenerate a new compliance evidence bundle
GET/compliance/evidence/bundleDownload one compliance evidence bundle as JSON
GET/compliance/evidence/reportDownload one compliance evidence bundle as a printable report

Endpoints​

POST /compliance/data_subject/export​

Export everything held about a person

Collects everything the gateway holds about one person, either a gateway user or an end user (a customer of your application), so you can answer a GDPR or CCPA access request: account details, keys, memberships, request logs, audit entries and the Lens copies, with secrets left out. The export is recorded as a data subject request and written to the audit log. When Lens could not be read the request is recorded as partial. Proxy admins and custom roles holding compliance.write may call it, and it needs the compliance license feature.

Docs

Request body (application/json, schema DataSubjectExportRequest):

FieldTypeRequiredDescription
subject_typeenum: "user", "end_user"Yesuser for a gateway user, end_user for a customer
subject_idstringYesThe user id or end user id

Example request:

curl -X POST "http://localhost:4000/compliance/data_subject/export" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"subject_type": "end_user",
"subject_id": "acct-48213"
}'

Responses:

StatusDescriptionBody
200The export, recorded as a data subject requestapplication/json DataSubjectExportResponse
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is neither a proxy admin nor a custom role holding compliance.write, the license lacks the compliance feature, or on Spanway Cloud the caller belongs to no organizationapplication/json ErrorDetail
404No user or end user has this idapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway has no database connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
requestSpanway_DataSubjectRequestTableYes
exportDataSubjectExportYes

POST /compliance/data_subject/erase​

Erase a person's data

Erases one person for a right to be forgotten request: their rows are deleted, their identifiers in request logs are replaced with a pseudonym and their Lens copies are erased. It cannot be undone, so the body must carry confirm: true. Proxy admins, the caller itself and the owner of an open Cloud workspace are refused, and a refusal is recorded as a failed request. When Lens did not confirm the erasure the request is recorded as partial, and running the same erasure again retries Lens. Every erasure is written to the audit log. Proxy admins and custom roles holding compliance.write may call it, and it needs the compliance license feature.

Docs

Request body (application/json, schema DataSubjectEraseRequest):

FieldTypeRequiredDescription
subject_typeenum: "user", "end_user"Yesuser for a gateway user, end_user for a customer
subject_idstringYesThe user id or end user id
confirmtrueYesMust be true, because an erasure cannot be undone

Example request:

curl -X POST "http://localhost:4000/compliance/data_subject/erase" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"subject_type": "end_user",
"subject_id": "acct-48213",
"confirm": true
}'

Responses:

StatusDescriptionBody
200What was deleted or pseudonymised, recorded as a data subject requestapplication/json DataSubjectEraseResponse
400The subject is the caller or a proxy adminapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is neither a proxy admin nor a custom role holding compliance.write, the license lacks the compliance feature, or on Spanway Cloud the caller belongs to no organizationapplication/json ErrorDetail
404No user or end user has this idapplication/json ErrorDetail
409The user owns a Cloud workspace that is still openapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500No database, or no key to derive pseudonymsapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
requestSpanway_DataSubjectRequestTableYes
summaryErasureSummaryYes

GET /compliance/data_subject/list​

List data subject requests

Lists the recorded data subject exports and erasures, newest first, a page at a time, so you can show an auditor what was requested and when. Filter with subject_id. It changes nothing. Proxy admins, admin viewers and custom roles holding compliance.read may call it, and it needs the compliance license feature. On Spanway Cloud a caller who is not a proxy admin sees only the end user requests of its own organization, and subject_id is matched within that organization.

Docs

Parameters:

NameInTypeRequiredDescription
subject_idquerystring or nullNo
pagequeryintegerNo
page_sizequeryintegerNo

Example request:

curl -X GET "http://localhost:4000/compliance/data_subject/list" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200One page of recorded requests, newest firstapplication/json DataSubjectRequestListResponse
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway has no database connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
requestsarray of Spanway_DataSubjectRequestTableYesRequests
totalintegerYesTotal
pageintegerYesPage
page_sizeintegerYesPage Size

GET /compliance/retention​

Read the retention periods

Shows every retention period the cleanup job honours, which sets how long request logs, audit logs and other records are kept, and when the job last finished on any instance. effective_seconds is the period the job really applies, which the request log period can shorten for tables that copy prompts and answers. It changes nothing. Proxy admins, admin viewers and custom roles holding compliance.read or compliance.write may call it, and it needs the compliance license feature.

Docs

Example request:

curl -X GET "http://localhost:4000/compliance/retention" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200Every retention period and the last cleanup runapplication/json RetentionSettingsResponse
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is not an admin, or the license lacks complianceapplication/json ErrorDetail
500The gateway has no database connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
periodsarray of RetentionPeriodYesEvery retention period the cleanup job honours
last_run_atstring or nullYesWhen the cleanup job last finished on any instance

PATCH /compliance/retention​

Set or clear retention periods

Sets or clears retention periods, such as 90d for request logs. Fields you leave out keep their value and fields sent as null are cleared, which keeps that data forever. Every period in the request is saved together or not at all: when one of them is set in the config file, nothing changes and the answer is 400. One audit row records the change with object_id general_settings and the before and after value of each period, and the cleanup job uses the new values on its next run. A period that is not valid, or a sanctions period under the legal minimum, is refused with 422. Proxy admins and custom roles holding compliance.write may call it, and it needs the compliance license feature.

Docs

Request body (application/json, schema RetentionUpdate):

FieldTypeRequiredDescription
maximum_spend_logs_retention_periodstring or nullNoRequest logs and log indexes: a period like 90d (units s, m, h, d, w, mo), null keeps all
maximum_autorouter_session_retention_periodstring or nullNoAuto-router session rollups: a period like 90d (units s, m, h, d, w, mo), null keeps all
maximum_health_check_retention_periodstring or nullNoModel health check rows: a period like 90d (units s, m, h, d, w, mo), null keeps all
maximum_daily_tag_spend_retention_periodstring or nullNoPer-day tag spend totals: a period like 90d (units s, m, h, d, w, mo), null keeps all
maximum_audit_log_retention_periodstring or nullNoAudit log entries: a period like 90d (units s, m, h, d, w, mo), null keeps all
maximum_memory_retention_periodstring or nullNoStored memories: a period like 90d (units s, m, h, d, w, mo), null keeps all
maximum_online_eval_score_retention_periodstring or nullNoOnline eval scores: a period like 90d (units s, m, h, d, w, mo), null keeps all
maximum_eval_review_retention_periodstring or nullNoHuman review items: a period like 90d (units s, m, h, d, w, mo), null keeps all
maximum_eval_feedback_retention_periodstring or nullNoEnd-user ratings and comments: a period like 90d (units s, m, h, d, w, mo), null keeps all
maximum_eval_dataset_retention_periodstring or nullNoDataset items copied from logs: a period like 90d (units s, m, h, d, w, mo), null keeps all
maximum_workflow_run_retention_periodstring or nullNoWorkflow runs: a period like 90d (units s, m, h, d, w, mo), null keeps all
maximum_custom_agent_run_retention_periodstring or nullNoCustom agent runs: a period like 90d (units s, m, h, d, w, mo), null keeps all
maximum_workflow_trigger_fire_retention_periodstring or nullNoWorkflow trigger fires: a period like 90d (units s, m, h, d, w, mo), null keeps all
maximum_approval_request_retention_periodstring or nullNoSettled approval requests: a period like 90d (units s, m, h, d, w, mo), null keeps all
maximum_environment_record_retention_periodstring or nullNoSettled environment plans: a period like 90d (units s, m, h, d, w, mo), null keeps all
maximum_code_index_run_retention_periodstring or nullNoFinished code index runs: a period like 90d (units s, m, h, d, w, mo), null keeps all
maximum_cloud_closed_tenant_retention_periodstring or nullNoClosed Cloud tenant details: a period like 90d (units s, m, h, d, w, mo), null keeps all
maximum_deleted_record_retention_periodstring or nullNoDeleted key and team archives: a period like 90d (units s, m, h, d, w, mo), null keeps all
maximum_access_request_retention_periodstring or nullNoSettled access requests: a period like 90d (units s, m, h, d, w, mo), null keeps all
maximum_eval_run_retention_periodstring or nullNoFinished eval runs: a period like 90d (units s, m, h, d, w, mo), null keeps all
maximum_red_team_run_retention_periodstring or nullNoFinished red team runs: a period like 90d (units s, m, h, d, w, mo), null keeps all
maximum_error_log_retention_periodstring or nullNoLegacy error logs: a period like 90d (units s, m, h, d, w, mo), null keeps all
maximum_code_repo_retention_periodstring or nullNoDisconnected code repositories: a period like 90d (units s, m, h, d, w, mo), null keeps all
maximum_managed_file_retention_periodstring or nullNoManaged files: a period like 90d (units s, m, h, d, w, mo), null keeps all
maximum_adaptive_router_session_retention_periodstring or nullNoAdaptive router sessions: a period like 90d (units s, m, h, d, w, mo), null keeps all
maximum_invitation_retention_periodstring or nullNoExpired invitation links: a period like 90d (units s, m, h, d, w, mo), null keeps all
maximum_compliance_snapshot_retention_periodstring or nullNoCompliance report snapshots: a period like 90d (units s, m, h, d, w, mo), null keeps all
maximum_compliance_evidence_retention_periodstring or nullNoCompliance evidence bundles: a period like 90d (units s, m, h, d, w, mo), null keeps all
maximum_data_subject_request_retention_periodstring or nullNoData subject request records: a period like 90d (units s, m, h, d, w, mo), null keeps all
maximum_sanctions_record_retention_periodstring or nullNoSanctions records: at least 3653d, recorded only, the cleanup job never deletes them

Example request:

curl -X PATCH "http://localhost:4000/compliance/retention" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"maximum_spend_logs_retention_period": "90d",
"maximum_audit_log_retention_period": "365d"
}'

Responses:

StatusDescriptionBody
200The retention periods now in forceapplication/json RetentionSettingsResponse
400No period was sent, or a period is set in the config fileapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller lacks proxy admin or compliance.write, or the license lacks complianceapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway has no database connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
periodsarray of RetentionPeriodYesEvery retention period the cleanup job honours
last_run_atstring or nullYesWhen the cleanup job last finished on any instance

POST /compliance/retention/run​

Run the retention cleanup now

Runs the retention cleanup once, now, instead of waiting for its schedule, and reports what it deleted per table. Nothing runs when no period is set, and the answer then has ran false. When another gateway instance is already running the cleanup the answer is 409, and when the run fails it is 500 with the error class. Each call writes an audit row with object_id retention:run that lists the counts, with action deleted when rows were removed and invoked when the run found nothing to delete. Proxy admins and custom roles holding compliance.write may call it, and it needs the compliance license feature.

Docs

Request body (application/json, object):

Example request:

curl -X POST "http://localhost:4000/compliance/retention/run" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'

Responses:

StatusDescriptionBody
200What the cleanup deleted, per tableapplication/json RetentionRunResponse
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller lacks proxy admin or compliance.write, or the license lacks complianceapplication/json ErrorDetail
409Another gateway instance holds the cleanup lockapplication/json ErrorDetail
500No database, or the cleanup run failedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
ranbooleanYesWhether anything ran, false when no period is set
resultsarray of RetentionRunResultYesWhat was deleted, per table

GET /compliance/residency​

Check data residency

Shows the required model region, whether the gateway enforces it on every request, and every end user, key, team, organization and deployment that contradicts it, so you can check that data stays in, for example, the EU. It also shows how many deployments meet the zero retention and no training policies. It changes nothing. Proxy admins, admin viewers and custom roles holding compliance.read or compliance.write may call it, and it needs the compliance license feature.

Docs

Example request:

curl -X GET "http://localhost:4000/compliance/residency" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200The residency policy and what contradicts itapplication/json ResidencyReport
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
500The gateway hit an internal error, usually the database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
required_model_regionenum: "eu", "uk", "ch", "us", "ca", "apac" or nullYesThe region every request must stay in, empty when none is required
enforcedbooleanYesWhether the gateway refuses requests that would leave the required region
end_usersarray of EntityViolationYesEnd users whose allowed region contradicts the policy
deploymentsarray of EntityViolationYesModel deployments that run outside the required region
scopesarray of ScopeViolationYesKeys, teams and organizations whose data policy contradicts it
end_users_checkedintegerYesHow many end users were checked
deployments_checkedintegerYesHow many deployments were checked
scopes_checkedintegerYesHow many keys, teams and organizations were checked
data_policyDataPolicyReport or nullNoHow many deployments meet the zero retention and no training policies

PATCH /compliance/residency​

Set the required model region

Sets or clears the required model region and turns its enforcement on every request on or off. Fields left out keep their stored value. Existing end users, keys, teams and deployments are not changed, and the answer shows which of them now contradict the policy. The change is validated and written to the audit log. Proxy admins and custom roles holding compliance.write may call it, and it needs the compliance license feature.

Docs

Request body (application/json, schema ResidencyUpdate):

FieldTypeRequiredDescription
required_model_regionenum: "eu", "uk", "ch", "us", "ca", "apac" or nullNoThe region every request must stay in, null clears it
enforceboolean or nullNoRefuse requests that would leave the required region

Example request:

curl -X PATCH "http://localhost:4000/compliance/residency" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"required_model_region": "eu",
"enforce": true
}'

Responses:

StatusDescriptionBody
200The residency report under the new policyapplication/json ResidencyReport
400The region would be empty while it is enforcedapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway has no database connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
required_model_regionenum: "eu", "uk", "ch", "us", "ca", "apac" or nullYesThe region every request must stay in, empty when none is required
enforcedbooleanYesWhether the gateway refuses requests that would leave the required region
end_usersarray of EntityViolationYesEnd users whose allowed region contradicts the policy
deploymentsarray of EntityViolationYesModel deployments that run outside the required region
scopesarray of ScopeViolationYesKeys, teams and organizations whose data policy contradicts it
end_users_checkedintegerYesHow many end users were checked
deployments_checkedintegerYesHow many deployments were checked
scopes_checkedintegerYesHow many keys, teams and organizations were checked
data_policyDataPolicyReport or nullNoHow many deployments meet the zero retention and no training policies

GET /compliance/controls​

Evaluate the compliance controls

Checks each control of a regime, such as GDPR, HIPAA or SOC 2, against how the gateway is set up right now, with the evidence for every result. regime picks one regime or all. It changes nothing. Proxy admins, admin viewers and custom roles holding compliance.read may call it, and it needs the compliance license feature.

Docs

Parameters:

NameInTypeRequiredDescription
regimequeryenum: "gdpr", "uk_gdpr", "ccpa_cpra", "hipaa", "eu_ai_act", "soc2", "iso_27001", "pipeda", ... or "all"No

Example request:

curl -X GET "http://localhost:4000/compliance/controls" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200Each control with its result and evidenceapplication/json ControlsResponse
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway hit an internal error, usually the database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
regimesarray of enum: "gdpr", "uk_gdpr", "ccpa_cpra", "hipaa", "eu_ai_act", "soc2", "iso_27001", "pipeda", ...YesRegimes
evaluated_atstringYesEvaluated At
controlsarray of EvaluatedControlYesControls

GET /compliance/report​

Build the compliance report

Builds the compliance report: every control with its result, the counts, and a score that is the share of applicable controls that pass. regime picks one regime or all. It changes nothing. Proxy admins, admin viewers and custom roles holding compliance.read may call it, and it needs the compliance license feature.

Docs

Parameters:

NameInTypeRequiredDescription
regimequeryenum: "gdpr", "uk_gdpr", "ccpa_cpra", "hipaa", "eu_ai_act", "soc2", "iso_27001", "pipeda", ... or "all"No

Example request:

curl -X GET "http://localhost:4000/compliance/report" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200The controls with counts and a scoreapplication/json ComplianceReport
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway hit an internal error, usually the database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
regimesarray of enum: "gdpr", "uk_gdpr", "ccpa_cpra", "hipaa", "eu_ai_act", "soc2", "iso_27001", "pipeda", ...YesThe regimes evaluated
evaluated_atstringYesWhen the controls were evaluated
controlsarray of EvaluatedControlYesEach control with its result and evidence
summaryReportSummaryYesCounts and the score

POST /compliance/report/snapshot​

Store a compliance report snapshot

Evaluates the regime now and stores the report, so auditors can see how the posture changed over time. Each snapshot is written to the audit log. Proxy admins and custom roles holding compliance.write may call it, and it needs the compliance license feature.

Docs

Request body (application/json, schema SnapshotRequest):

FieldTypeRequiredDescription
regimeenum: "gdpr", "uk_gdpr", "ccpa_cpra", "hipaa", "eu_ai_act", "soc2", "iso_27001", "pipeda", ... or "all"NoThe regime to evaluate, or all

Example request:

curl -X POST "http://localhost:4000/compliance/report/snapshot" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"regime": "gdpr"
}'

Responses:

StatusDescriptionBody
200The stored snapshotapplication/json Spanway_ComplianceSnapshotTable
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway has no database connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
snapshot_idstringYesId of the stored snapshot
regimestringYesThe regime evaluated, or all
scorenumberYesShare of applicable controls that passed, from 0 to 100
reportobjectYesThe full compliance report as it was at that time
created_bystringYesThe admin who stored the snapshot
created_atstring or nullNoWhen the snapshot was stored

GET /compliance/report/history​

List stored compliance snapshots

Lists the stored compliance report snapshots, newest first, a page at a time. Filter with regime. It changes nothing. Proxy admins, admin viewers and custom roles holding compliance.read may call it, and it needs the compliance license feature.

Docs

Parameters:

NameInTypeRequiredDescription
regimequeryenum: "gdpr", "uk_gdpr", "ccpa_cpra", "hipaa", "eu_ai_act", "soc2", "iso_27001", "pipeda", ... or "all" or nullNo
pagequeryintegerNo
page_sizequeryintegerNo

Example request:

curl -X GET "http://localhost:4000/compliance/report/history" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200One page of stored snapshots, newest firstapplication/json SnapshotHistoryResponse
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway has no database connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
snapshotsarray of Spanway_ComplianceSnapshotTableYesSnapshots
totalintegerYesTotal
pageintegerYesPage
page_sizeintegerYesPage Size

GET /compliance/evidence​

List stored compliance evidence bundles

Lists the evidence bundles already generated for auditors, newest first, so you can pick one to download. Each row shows when it was made, by whom, the period it covers and its SHA-256 fingerprint, but not the bundle contents. Proxy admins, proxy admin viewers and custom roles with read access may call it. Nothing is changed.

Parameters:

NameInTypeRequiredDescription
pagequeryintegerNo
page_sizequeryintegerNo

Example request:

curl -X GET "http://localhost:4000/compliance/evidence" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200Successful Responseapplication/json EvidenceListResponse
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller may not read evidence, or the license lacks compliance_evidenceapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
bundlesarray of EvidenceSummaryYesThe bundles on this page, newest first
totalintegerYesHow many bundles exist
pageintegerYesThe page number, counting from 1
page_sizeintegerYesHow many bundles a page holds

POST /compliance/evidence/generate​

Generate a new compliance evidence bundle

Collects the evidence an auditor asks for over the last window_days days (90 by default, at most 366): the control map, compliance report, audit log summary, retention and access settings, guardrail coverage, eval and red team runs, and the change history. The bundle is stored with its SHA-256 fingerprint so any later change to it can be detected, and an audit log row records who generated it. Proxy admins and custom roles with write access may call it.

Request body (application/json, schema EvidenceGenerateRequest):

FieldTypeRequiredDescription
window_daysintegerNoHow many days back the bundle covers, from 1 to 366

Example request:

curl -X POST "http://localhost:4000/compliance/evidence/generate" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"window_days": 90
}'

Responses:

StatusDescriptionBody
200Successful Responseapplication/json EvidenceSummary
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller may not generate evidence, or the license lacks compliance_evidenceapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
evidence_idstringYesThe id of the bundle
triggerenum: "manual", "scheduled"Yesmanual or scheduled
window_startstringYesThe start of the period the bundle covers
window_endstringYesThe end of the period the bundle covers
sha256stringYesThe SHA-256 fingerprint of the bundle contents
created_bystringYesWho generated it
created_atstring or nullYesWhen it was generated

GET /compliance/evidence/bundle​

Download one compliance evidence bundle as JSON

Returns the full contents of one stored evidence bundle as JSON, for handing to an auditor. checksum_valid is false when the stored contents no longer match the SHA-256 fingerprint taken when the bundle was made, which means it was changed afterwards. Every download writes an audit log row. Proxy admins, proxy admin viewers and custom roles with read access may call it. Answers 404 when no bundle has that id.

Parameters:

NameInTypeRequiredDescription
evidence_idquerystringYes

Example request:

curl -X GET "http://localhost:4000/compliance/evidence/bundle?evidence_id=evidence_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200Successful Responseapplication/json EvidenceBundleResponse
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller may not read evidence, or the license lacks compliance_evidenceapplication/json ErrorDetail
404No bundle has that idapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
evidenceEvidenceSummaryYesWhen and by whom the bundle was made
checksum_validbooleanYesFalse when the contents no longer match their fingerprint
bundleobjectYesThe evidence itself, as JSON

GET /compliance/evidence/report​

Download one compliance evidence bundle as a printable report

Returns one stored evidence bundle as a self-contained HTML report you can open in a browser or print to PDF for an auditor. The X-Evidence-SHA256 header carries the bundle's fingerprint. The download is refused with 409 when the stored contents no longer match that fingerprint, and every download writes an audit log row. Proxy admins, proxy admin viewers and custom roles with read access may call it.

Parameters:

NameInTypeRequiredDescription
evidence_idquerystringYes

Example request:

curl -X GET "http://localhost:4000/compliance/evidence/report?evidence_id=evidence_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200The bundle rendered as a printable HTML reporttext/html any
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller may not read evidence, or the license lacks compliance_evidenceapplication/json ErrorDetail
404No bundle has that idapplication/json ErrorDetail
409The stored bundle no longer matches its fingerprintapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The database is not connectedapplication/json ErrorDetail