Skip to main content

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.

MethodPathSummary
POST/compliance/eu-ai-actCheck one logged request against the EU AI Act
POST/compliance/gdprCheck 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):

FieldTypeRequiredDescription
guardrail_informationarray of object or nullNoThe guardrail results from the spend log row
modelstring or nullNoThe model that served it
request_idstringYesThe id of the logged request
timestampstring or nullNoWhen it was made
user_idstring or nullNoThe 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:

StatusDescriptionBody
200Successful Responseapplication/json ComplianceResponse
400The request is malformed or breaks a rule named in the detailapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
422Validation Errorapplication/json HTTPValidationError
500The gateway hit an internal error, usually the database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
checksarray of ComplianceCheckResultYesThe result of each check
compliantbooleanYesTrue when every check passed
regulationstringYesThe 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):

FieldTypeRequiredDescription
guardrail_informationarray of object or nullNoThe guardrail results from the spend log row
modelstring or nullNoThe model that served it
request_idstringYesThe id of the logged request
timestampstring or nullNoWhen it was made
user_idstring or nullNoThe 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:

StatusDescriptionBody
200Successful Responseapplication/json ComplianceResponse
400The request is malformed or breaks a rule named in the detailapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
422Validation Errorapplication/json HTTPValidationError
500The gateway hit an internal error, usually the database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
checksarray of ComplianceCheckResultYesThe result of each check
compliantbooleanYesTrue when every check passed
regulationstringYesThe regulation checked, EU AI Act or GDPR