Compliance check
Pre-flight verification — voucher gaps, year-end readiness, before submitting to Skatteverket.
Endpoints
GET/api/v1/companies/:companyId/compliance/check— Run a structured compliance pre-flight check.
GET /api/v1/companies/:companyId/compliance/check {#get-compliance-check}
compliance.check · scope compliance:read
Run a structured compliance pre-flight check.
Generalised pre-flight that consolidates the gnubok pre-close validators under one envelope. Supported check types: year_end_readiness (BFNAR 2017:3 + ÅRL 2:1 blockers), voucher_gaps (BFNAR 2013:2 kap 8 § series continuity). vat_close is planned for a follow-up PR (the underlying function currently lives in the MCP extension and core routes cannot import from extensions; it will be extracted into lib/reports/ then exposed here). New types can be added without changing the response shape.
Use when: Before committing to an irreversible action (VAT close, year-end close), or as a periodic audit sweep to surface blockers before they become urgent.
Don't use for: Executing the underlying action — this is read-only. After a passing check, call the corresponding async endpoint (POST /fiscal-periods/{id}/year-end, etc).
Pitfalls
- year_end_readiness and voucher_gaps require fiscal_period_id (UUID).
- A passing check is a SNAPSHOT — the state can change between the check and the action. The same blocker logic runs again on commit.
- vat_close is documented in the plan but NOT yet supported by this endpoint — call gnubok_vat_close_check via the MCP server until the function is extracted into lib/reports/.
Risk: low · Idempotent: yes · Reversible: no · Dry-run supported: no
Example response
{
"data": {
"type": "year_end_readiness",
"ready": false,
"findings": [
{
"severity": "blocker",
"code": "YEAR_END_DRAFTS_PRESENT",
"message": "3 draft journal entries must be committed or cancelled before year-end.",
"details": {
"draft_count": 3
}
}
],
"summary": "Period is NOT ready (1 blocker(s)).",
"generated_at": "2026-05-12T14:00:00Z",
"params": {
"fiscal_period_id": "a8f1…"
}
},
"meta": {
"request_id": "req_…",
"api_version": "2026-05-12"
}
}