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.
| Method | Path | Summary |
|---|---|---|
| POST | /compliance/data_subject/export | Export everything held about a person |
| POST | /compliance/data_subject/erase | Erase a person's data |
| GET | /compliance/data_subject/list | List data subject requests |
| GET | /compliance/retention | Read the retention periods |
| PATCH | /compliance/retention | Set or clear retention periods |
| POST | /compliance/retention/run | Run the retention cleanup now |
| GET | /compliance/residency | Check data residency |
| PATCH | /compliance/residency | Set the required model region |
| GET | /compliance/controls | Evaluate the compliance controls |
| GET | /compliance/report | Build the compliance report |
| POST | /compliance/report/snapshot | Store a compliance report snapshot |
| GET | /compliance/report/history | List stored compliance snapshots |
| GET | /compliance/evidence | List stored compliance evidence bundles |
| POST | /compliance/evidence/generate | Generate a new compliance evidence bundle |
| GET | /compliance/evidence/bundle | Download one compliance evidence bundle as JSON |
| GET | /compliance/evidence/report | Download 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.
Request body (application/json, schema DataSubjectExportRequest):
| Field | Type | Required | Description |
|---|---|---|---|
subject_type | enum: "user", "end_user" | Yes | user for a gateway user, end_user for a customer |
subject_id | string | Yes | The 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:
| Status | Description | Body |
|---|---|---|
| 200 | The export, recorded as a data subject request | application/json DataSubjectExportResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The 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 organization | application/json ErrorDetail |
| 404 | No user or end user has this id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
request | Spanway_DataSubjectRequestTable | Yes | |
export | DataSubjectExport | Yes |
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.
Request body (application/json, schema DataSubjectEraseRequest):
| Field | Type | Required | Description |
|---|---|---|---|
subject_type | enum: "user", "end_user" | Yes | user for a gateway user, end_user for a customer |
subject_id | string | Yes | The user id or end user id |
confirm | true | Yes | Must 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:
| Status | Description | Body |
|---|---|---|
| 200 | What was deleted or pseudonymised, recorded as a data subject request | application/json DataSubjectEraseResponse |
| 400 | The subject is the caller or a proxy admin | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The 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 organization | application/json ErrorDetail |
| 404 | No user or end user has this id | application/json ErrorDetail |
| 409 | The user owns a Cloud workspace that is still open | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | No database, or no key to derive pseudonyms | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
request | Spanway_DataSubjectRequestTable | Yes | |
summary | ErasureSummary | Yes |
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.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
subject_id | query | string or null | No | |
page | query | integer | No | |
page_size | query | integer | No |
Example request:
curl -X GET "http://localhost:4000/compliance/data_subject/list" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | One page of recorded requests, newest first | application/json DataSubjectRequestListResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
requests | array of Spanway_DataSubjectRequestTable | Yes | Requests |
total | integer | Yes | Total |
page | integer | Yes | Page |
page_size | integer | Yes | Page 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.
Example request:
curl -X GET "http://localhost:4000/compliance/retention" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Every retention period and the last cleanup run | application/json RetentionSettingsResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is not an admin, or the license lacks compliance | application/json ErrorDetail |
| 500 | The gateway has no database connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
periods | array of RetentionPeriod | Yes | Every retention period the cleanup job honours |
last_run_at | string or null | Yes | When 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.
Request body (application/json, schema RetentionUpdate):
| Field | Type | Required | Description |
|---|---|---|---|
maximum_spend_logs_retention_period | string or null | No | Request logs and log indexes: a period like 90d (units s, m, h, d, w, mo), null keeps all |
maximum_autorouter_session_retention_period | string or null | No | Auto-router session rollups: a period like 90d (units s, m, h, d, w, mo), null keeps all |
maximum_health_check_retention_period | string or null | No | Model health check rows: a period like 90d (units s, m, h, d, w, mo), null keeps all |
maximum_daily_tag_spend_retention_period | string or null | No | Per-day tag spend totals: a period like 90d (units s, m, h, d, w, mo), null keeps all |
maximum_audit_log_retention_period | string or null | No | Audit log entries: a period like 90d (units s, m, h, d, w, mo), null keeps all |
maximum_memory_retention_period | string or null | No | Stored memories: a period like 90d (units s, m, h, d, w, mo), null keeps all |
maximum_online_eval_score_retention_period | string or null | No | Online eval scores: a period like 90d (units s, m, h, d, w, mo), null keeps all |
maximum_eval_review_retention_period | string or null | No | Human review items: a period like 90d (units s, m, h, d, w, mo), null keeps all |
maximum_eval_feedback_retention_period | string or null | No | End-user ratings and comments: a period like 90d (units s, m, h, d, w, mo), null keeps all |
maximum_eval_dataset_retention_period | string or null | No | Dataset items copied from logs: a period like 90d (units s, m, h, d, w, mo), null keeps all |
maximum_workflow_run_retention_period | string or null | No | Workflow runs: a period like 90d (units s, m, h, d, w, mo), null keeps all |
maximum_custom_agent_run_retention_period | string or null | No | Custom agent runs: a period like 90d (units s, m, h, d, w, mo), null keeps all |
maximum_workflow_trigger_fire_retention_period | string or null | No | Workflow trigger fires: a period like 90d (units s, m, h, d, w, mo), null keeps all |
maximum_approval_request_retention_period | string or null | No | Settled approval requests: a period like 90d (units s, m, h, d, w, mo), null keeps all |
maximum_environment_record_retention_period | string or null | No | Settled environment plans: a period like 90d (units s, m, h, d, w, mo), null keeps all |
maximum_code_index_run_retention_period | string or null | No | Finished code index runs: a period like 90d (units s, m, h, d, w, mo), null keeps all |
maximum_cloud_closed_tenant_retention_period | string or null | No | Closed Cloud tenant details: a period like 90d (units s, m, h, d, w, mo), null keeps all |
maximum_deleted_record_retention_period | string or null | No | Deleted key and team archives: a period like 90d (units s, m, h, d, w, mo), null keeps all |
maximum_access_request_retention_period | string or null | No | Settled access requests: a period like 90d (units s, m, h, d, w, mo), null keeps all |
maximum_eval_run_retention_period | string or null | No | Finished eval runs: a period like 90d (units s, m, h, d, w, mo), null keeps all |
maximum_red_team_run_retention_period | string or null | No | Finished red team runs: a period like 90d (units s, m, h, d, w, mo), null keeps all |
maximum_error_log_retention_period | string or null | No | Legacy error logs: a period like 90d (units s, m, h, d, w, mo), null keeps all |
maximum_code_repo_retention_period | string or null | No | Disconnected code repositories: a period like 90d (units s, m, h, d, w, mo), null keeps all |
maximum_managed_file_retention_period | string or null | No | Managed files: a period like 90d (units s, m, h, d, w, mo), null keeps all |
maximum_adaptive_router_session_retention_period | string or null | No | Adaptive router sessions: a period like 90d (units s, m, h, d, w, mo), null keeps all |
maximum_invitation_retention_period | string or null | No | Expired invitation links: a period like 90d (units s, m, h, d, w, mo), null keeps all |
maximum_compliance_snapshot_retention_period | string or null | No | Compliance report snapshots: a period like 90d (units s, m, h, d, w, mo), null keeps all |
maximum_compliance_evidence_retention_period | string or null | No | Compliance evidence bundles: a period like 90d (units s, m, h, d, w, mo), null keeps all |
maximum_data_subject_request_retention_period | string or null | No | Data subject request records: a period like 90d (units s, m, h, d, w, mo), null keeps all |
maximum_sanctions_record_retention_period | string or null | No | Sanctions 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:
| Status | Description | Body |
|---|---|---|
| 200 | The retention periods now in force | application/json RetentionSettingsResponse |
| 400 | No period was sent, or a period is set in the config file | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller lacks proxy admin or compliance.write, or the license lacks compliance | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
periods | array of RetentionPeriod | Yes | Every retention period the cleanup job honours |
last_run_at | string or null | Yes | When 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.
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:
| Status | Description | Body |
|---|---|---|
| 200 | What the cleanup deleted, per table | application/json RetentionRunResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller lacks proxy admin or compliance.write, or the license lacks compliance | application/json ErrorDetail |
| 409 | Another gateway instance holds the cleanup lock | application/json ErrorDetail |
| 500 | No database, or the cleanup run failed | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
ran | boolean | Yes | Whether anything ran, false when no period is set |
results | array of RetentionRunResult | Yes | What 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.
Example request:
curl -X GET "http://localhost:4000/compliance/residency" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The residency policy and what contradicts it | application/json ResidencyReport |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 500 | The gateway hit an internal error, usually the database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
required_model_region | enum: "eu", "uk", "ch", "us", "ca", "apac" or null | Yes | The region every request must stay in, empty when none is required |
enforced | boolean | Yes | Whether the gateway refuses requests that would leave the required region |
end_users | array of EntityViolation | Yes | End users whose allowed region contradicts the policy |
deployments | array of EntityViolation | Yes | Model deployments that run outside the required region |
scopes | array of ScopeViolation | Yes | Keys, teams and organizations whose data policy contradicts it |
end_users_checked | integer | Yes | How many end users were checked |
deployments_checked | integer | Yes | How many deployments were checked |
scopes_checked | integer | Yes | How many keys, teams and organizations were checked |
data_policy | DataPolicyReport or null | No | How 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.
Request body (application/json, schema ResidencyUpdate):
| Field | Type | Required | Description |
|---|---|---|---|
required_model_region | enum: "eu", "uk", "ch", "us", "ca", "apac" or null | No | The region every request must stay in, null clears it |
enforce | boolean or null | No | Refuse 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:
| Status | Description | Body |
|---|---|---|
| 200 | The residency report under the new policy | application/json ResidencyReport |
| 400 | The region would be empty while it is enforced | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
required_model_region | enum: "eu", "uk", "ch", "us", "ca", "apac" or null | Yes | The region every request must stay in, empty when none is required |
enforced | boolean | Yes | Whether the gateway refuses requests that would leave the required region |
end_users | array of EntityViolation | Yes | End users whose allowed region contradicts the policy |
deployments | array of EntityViolation | Yes | Model deployments that run outside the required region |
scopes | array of ScopeViolation | Yes | Keys, teams and organizations whose data policy contradicts it |
end_users_checked | integer | Yes | How many end users were checked |
deployments_checked | integer | Yes | How many deployments were checked |
scopes_checked | integer | Yes | How many keys, teams and organizations were checked |
data_policy | DataPolicyReport or null | No | How 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.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
regime | query | enum: "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:
| Status | Description | Body |
|---|---|---|
| 200 | Each control with its result and evidence | application/json ControlsResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway hit an internal error, usually the database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
regimes | array of enum: "gdpr", "uk_gdpr", "ccpa_cpra", "hipaa", "eu_ai_act", "soc2", "iso_27001", "pipeda", ... | Yes | Regimes |
evaluated_at | string | Yes | Evaluated At |
controls | array of EvaluatedControl | Yes | Controls |
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.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
regime | query | enum: "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:
| Status | Description | Body |
|---|---|---|
| 200 | The controls with counts and a score | application/json ComplianceReport |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway hit an internal error, usually the database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
regimes | array of enum: "gdpr", "uk_gdpr", "ccpa_cpra", "hipaa", "eu_ai_act", "soc2", "iso_27001", "pipeda", ... | Yes | The regimes evaluated |
evaluated_at | string | Yes | When the controls were evaluated |
controls | array of EvaluatedControl | Yes | Each control with its result and evidence |
summary | ReportSummary | Yes | Counts 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.
Request body (application/json, schema SnapshotRequest):
| Field | Type | Required | Description |
|---|---|---|---|
regime | enum: "gdpr", "uk_gdpr", "ccpa_cpra", "hipaa", "eu_ai_act", "soc2", "iso_27001", "pipeda", ... or "all" | No | The 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:
| Status | Description | Body |
|---|---|---|
| 200 | The stored snapshot | application/json Spanway_ComplianceSnapshotTable |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
snapshot_id | string | Yes | Id of the stored snapshot |
regime | string | Yes | The regime evaluated, or all |
score | number | Yes | Share of applicable controls that passed, from 0 to 100 |
report | object | Yes | The full compliance report as it was at that time |
created_by | string | Yes | The admin who stored the snapshot |
created_at | string or null | No | When 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.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
regime | query | enum: "gdpr", "uk_gdpr", "ccpa_cpra", "hipaa", "eu_ai_act", "soc2", "iso_27001", "pipeda", ... or "all" or null | No | |
page | query | integer | No | |
page_size | query | integer | No |
Example request:
curl -X GET "http://localhost:4000/compliance/report/history" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | One page of stored snapshots, newest first | application/json SnapshotHistoryResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
snapshots | array of Spanway_ComplianceSnapshotTable | Yes | Snapshots |
total | integer | Yes | Total |
page | integer | Yes | Page |
page_size | integer | Yes | Page 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:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
page | query | integer | No | |
page_size | query | integer | No |
Example request:
curl -X GET "http://localhost:4000/compliance/evidence" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json EvidenceListResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller may not read evidence, or the license lacks compliance_evidence | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
bundles | array of EvidenceSummary | Yes | The bundles on this page, newest first |
total | integer | Yes | How many bundles exist |
page | integer | Yes | The page number, counting from 1 |
page_size | integer | Yes | How 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):
| Field | Type | Required | Description |
|---|---|---|---|
window_days | integer | No | How 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:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json EvidenceSummary |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller may not generate evidence, or the license lacks compliance_evidence | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
evidence_id | string | Yes | The id of the bundle |
trigger | enum: "manual", "scheduled" | Yes | manual or scheduled |
window_start | string | Yes | The start of the period the bundle covers |
window_end | string | Yes | The end of the period the bundle covers |
sha256 | string | Yes | The SHA-256 fingerprint of the bundle contents |
created_by | string | Yes | Who generated it |
created_at | string or null | Yes | When 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:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
evidence_id | query | string | Yes |
Example request:
curl -X GET "http://localhost:4000/compliance/evidence/bundle?evidence_id=evidence_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json EvidenceBundleResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller may not read evidence, or the license lacks compliance_evidence | application/json ErrorDetail |
| 404 | No bundle has that id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
evidence | EvidenceSummary | Yes | When and by whom the bundle was made |
checksum_valid | boolean | Yes | False when the contents no longer match their fingerprint |
bundle | object | Yes | The 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:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
evidence_id | query | string | Yes |
Example request:
curl -X GET "http://localhost:4000/compliance/evidence/report?evidence_id=evidence_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The bundle rendered as a printable HTML report | text/html any |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller may not read evidence, or the license lacks compliance_evidence | application/json ErrorDetail |
| 404 | No bundle has that id | application/json ErrorDetail |
| 409 | The stored bundle no longer matches its fingerprint | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |