Test your mandate-check client with the sandbox scenario catalogue
GET /api/v1/sandbox/scenarios lists versioned scenarios for POST /api/v1/mandate/verify: fictional companies, the exact request body and the expected status and reason codes of each check. Key your tests by scenario id.
[Cite this as: Apier.no Docs v0.1.0 — last updated 2026-11-29]
POST /api/v1/mandate/verify checks a declared mandate against the
register: the company, the agent's operator, the signing rule and the
declared signers, and the requested action. Each check answers a result
and a list of reason codes, and the call answers one overall status.
The scenario catalogue gives you one test case per behaviour you need to handle. Each scenario holds a request body built from fictional companies and people, and the result the endpoint returns for it. Key your tests by scenario id and you get a stable set of cases that covers every status.
Step 1 — Fetch the catalogue
The listing needs no API key and costs nothing.
curl -s "https://www.apier.no/api/v1/sandbox/scenarios"The MCP tool list_sandbox_scenarios returns the same data. The body
carries:
catalogue_version: changes whenever a scenario or its expected result changes. Pin it in your tests, and re-read the list when it moves.default_check_date: the evaluation date most scenarios use.scenarios: one entry per scenario, in id order, withid,title(enandnb),orgnr,check_date,request(the exact request body) andexpected.reserved_slots: ids held for later scenarios, with the reason.not_reachable_in_sandbox: codes that come from operator or account state, not from the request (for exampleSERVICE_PAUSED), each with its HTTP status and the reason.uncovered_codes: reason codes no scenario reaches yet, with the reason.
Step 2 — Read one scenario
expected holds the overall status and, for each check (business,
agent, authority, scope), its result and reasons:
{
"id": "vs-09-company-only",
"title": {
"en": "Company only: no signer, mandate or action sent",
"nb": "Bare selskapet: ingen signaturberettiget, fullmakt eller handling sendt"
},
"check_date": "2026-06-15",
"expected": {
"status": "COMPANY_VERIFIED",
"business": { "result": "PASS", "reasons": [] },
"agent": { "result": "CLAIMED", "reasons": ["AGENT_CLAIMED_ONLY"] },
"authority": { "result": "NOT_CHECKED", "reasons": ["SIGNERS_MISSING", "MANDATE_MISSING"] },
"scope": { "result": "NOT_CHECKED", "reasons": ["ACTION_MISSING"] }
}
}The orgnr and request fields are left out above. Every organisation
number in the catalogue is a fictional number in a synthetic block, and
every person in it is invented, so no identifier can belong to a real
company or person. Read them from the listing; never copy them into code
that runs against production data.
Step 3 — Write a test keyed by scenario id
Your client turns a verify answer into a decision: go ahead, ask a human, or stop. Test that decision against the catalogue's expected results:
import { describe, expect, it } from "vitest";
import { decide } from "./mandate-client"; // your code
type Scenario = { id: string; expected: Record<string, unknown> };
type Catalogue = { catalogue_version: string; scenarios: Scenario[] };
const res = await fetch("https://www.apier.no/api/v1/sandbox/scenarios");
const { data } = (await res.json()) as { data: Catalogue };
const byId = new Map(data.scenarios.map((s): [string, Scenario] => [s.id, s]));
const scenario = (id: string): Scenario => {
const s = byId.get(id);
if (!s) throw new Error(`scenario ${id} is not in the catalogue`);
return s;
};
describe("mandate decisions", () => {
it("pins the catalogue version", () => {
expect(data.catalogue_version).toBe("1.1.0");
});
it("stops when a joint signer is missing", () => {
expect(decide(scenario("vs-04-joint-signer-missing").expected)).toBe("stop");
});
it("goes ahead when every check passes", () => {
expect(decide(scenario("vs-01-sole-signer-within-mandate").expected)).toBe("go");
});
});When catalogue_version changes, the version test fails first. Read the
new list, check what changed, then update the pin.
How the expected results are made
There is one engine. Each expected result is what
POST /api/v1/mandate/verify returns for that request body when it reads
the fixture companies instead of the live register, with the clock pinned
to the scenario's check_date (noon, Europe/Oslo). Apier's CI runs the
whole catalogue through the real route on every change and fails when a
result differs from expected. It runs the catalogue twice and fails
when the two runs differ.
The catalogue is test data. It is not a conformance suite, and a client that passes it is not certified for anything.
Known limits
- The production endpoint is paused. On
www.apier.no,POST /api/v1/mandate/verifyanswers 503SERVICE_PAUSEDuntil signed receipts ship, and there is no sandbox mirror of the route yet. Use the expected results as fixtures for your client's handling, as in Step 3. - You cannot set the check date. The request has no check-date field. Only the catalogue's own runs pin the date; a live call is evaluated on the day it is made.
vs-20-mandate-signers-onlyanswers noSIGNERS_MISSING. A mandate with nosignerslist but asigned_bylist givesALL_CHECKS_PASSED, because the engine countsmandate.signed_byas the signers. The specification describesSIGNERS_MISSINGas "no signers given". The scenario holds what the engine returns today.- Role history is off. The catalogue runs with the role-history read
switched off, so
ROLE_HISTORY_UNAVAILABLEappears on every authority check that runs, and the two role-history failure codes are listed underuncovered_codes. A deployment that turned role history on while reading the fixture companies would give different authority reasons. - No receipt per run yet. Each scenario stores its result without a signed sandbox receipt. A later release adds one.
- SD-JWT mandates. The id
vs-90-sdjwt-mandateis reserved for SD-JWT mandate scenarios and holds none yet.