Compliance API
This page documents the 2 gateway endpoints tagged compliance 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/eu-ai-act | Check one logged request against the EU AI Act |
| POST | /compliance/gdpr | Check one logged request against GDPR |
Endpoints
POST /compliance/eu-ai-act
Check one logged request against the EU AI Act
Tells you whether one logged request meets three EU AI Act checks, so a compliance reviewer can see at a glance which requests had safety screening and a complete audit trail. Send the fields of the spend log row for that request. Article 9 passes when any guardrail ran, Article 5 passes when a guardrail screened the content before it reached the model, and Article 12 passes when the record names the user, the model, the time and at least one guardrail result. Any key may call it. Nothing is stored or changed.
Request body (application/json, schema ComplianceCheckRequest):
| Field | Type | Required | Description |
|---|---|---|---|
guardrail_information | array of object or null | No | The guardrail results from the spend log row |
model | string or null | No | The model that served it |
request_id | string | Yes | The id of the logged request |
timestamp | string or null | No | When it was made |
user_id | string or null | No | The user the request was made for |
Example request:
curl -X POST "http://localhost:4000/compliance/eu-ai-act" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"guardrail_information": [
{
"guardrail_mode": "pre_call",
"guardrail_name": "pii-mask",
"guardrail_status": "success"
}
],
"model": "gpt-4o",
"request_id": "chatcmpl-3f2a9c1e-5b7d-4e8a-9c21-7d4b6a1e0f93",
"timestamp": "2026-11-20T14:05:11Z",
"user_id": "user-1234"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json ComplianceResponse |
| 400 | The request is malformed or breaks a rule named in the detail | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 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 |
|---|---|---|---|
checks | array of ComplianceCheckResult | Yes | The result of each check |
compliant | boolean | Yes | True when every check passed |
regulation | string | Yes | The regulation checked, EU AI Act or GDPR |
POST /compliance/gdpr
Check one logged request against GDPR
Tells you whether one logged request meets three GDPR checks, so a data protection officer can confirm that personal data was screened before it left for the model. Send the fields of the spend log row for that request. Article 32 passes when a guardrail ran before the model call, Article 5(1)(c) passes when that guardrail masked or blocked sensitive data or found none, and Article 30 passes when the record names the user, the model, the time and at least one guardrail result. Any key may call it. Nothing is stored or changed.
Request body (application/json, schema ComplianceCheckRequest):
| Field | Type | Required | Description |
|---|---|---|---|
guardrail_information | array of object or null | No | The guardrail results from the spend log row |
model | string or null | No | The model that served it |
request_id | string | Yes | The id of the logged request |
timestamp | string or null | No | When it was made |
user_id | string or null | No | The user the request was made for |
Example request:
curl -X POST "http://localhost:4000/compliance/gdpr" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"guardrail_information": [
{
"guardrail_mode": "pre_call",
"guardrail_name": "pii-mask",
"guardrail_status": "success"
}
],
"model": "gpt-4o",
"request_id": "chatcmpl-3f2a9c1e-5b7d-4e8a-9c21-7d4b6a1e0f93",
"timestamp": "2026-11-20T14:05:11Z",
"user_id": "user-1234"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json ComplianceResponse |
| 400 | The request is malformed or breaks a rule named in the detail | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 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 |
|---|---|---|---|
checks | array of ComplianceCheckResult | Yes | The result of each check |
compliant | boolean | Yes | True when every check passed |
regulation | string | Yes | The regulation checked, EU AI Act or GDPR |