Skip to main content
The Fairness API computes group-fairness metrics (demographic parity, disparate-impact ratio, four-fifths rule, equal-opportunity and equalized-odds gaps) over either caller-supplied samples or a slice of decision traces joined to a protected attribute. Every evaluation writes an AuditLog row for EU AI Act traceability. Both endpoints are tenant-scoped (authenticate with an API key or session). They are not role-gated. They are rate limited per tenant and fail closed.

POST /api/v1/fairness/evaluate

Compute a fairness report. Rate limit: 20 requests / 60 s.

Query parameters

Request body

A discriminated union on mode, plus optional advanced auto-run fields. Inline mode — pass samples directly:
Trace-join mode — pull decision traces in a window and match by customer:
Advanced auto-run fields (only used with metrics=advanced): modelKey, modelGroupKey, counterfactualGroup, limeBaseline, limeOptions ({ samples, seed }).

Response 200

When metrics=advanced, the response may also include intersectional, mitigations, giniByGroup, ksByGroup, counterfactualFairness, and lime. Any advanced primitive that could not run (e.g., no modelKey, no intersectional groups) is listed by reason in advancedAwaitingConfig.

Errors

POST /api/v1/fairness/report

Run the same evaluation and return a formatted EU AI Act conformity report instead of JSON. Rate limit: 10 requests / 60 s.

Request body

The same inline / trace-join body as /evaluate, plus:

Response 200

  • format: "csv"text/csv attachment (fairness-report-<ts>.csv).
  • format: "html"text/html document, suitable for headless-Chromium PDF rendering.
Not a JSON response. A fairness_report audit-log row is written on every generation so it is discoverable in DSAR exports.