Apier
Apier.no
Guides

Error handling and the Compliance Explainer

Structured error codes, Norwegian-language fix steps, and the human-agent handover boundary.

[Cite this as: Apier.no Docs v0.1.0 — last updated 2026-04-22]

Placeholder. The guide will cover the structured error envelope that every 4xx/5xx carries — top-level { success: false, error_code, explanation, _meta } (the Rulebook-version / data-freshness _meta block rides on errors too, so agents can diff the version they last saw against the version that just failed) — where the nested ApiErrorExplanation type carries a required summary plus optional why, fix_steps, relevant_link, legal_basis, and handover. The ten canonical error codes the Compliance Explainer recognises live in src/types/explainer.ts. The handover pointer, when present, is one of company_admin, accountant, altinn_user, or apier_support (the full set is exported as the HandoverActor union; the enriched payload carrying who, where, what, why is HandoverAction). Together these tell an agent when to stop retrying and escalate to the right human.