---
title: "Revoke a fullmakt: retire a delegation and flip its agent principal to revoked"
method: POST
path: "/api/v1/fullmakt/revoke"
tags: ["Fullmakt"]
---

# Revoke a fullmakt: retire a delegation and flip its agent principal to revoked

`POST /api/v1/fullmakt/revoke`

## Request

- Base URL: `https://www.apier.no`
- URL: `https://www.apier.no/api/v1/fullmakt/revoke`
- Auth: HTTP bearer

The revocation leg of the Fullmakt Rails. Given an agent principal the calling consumer owns, Apier revokes the delegation bound to that principal's systembruker and flips the principal to terminal 'revoked' (a revoked principal is never resurrected — create a new principal to act again). The delegations store is append-only, so revocation is REVOKE-BY-INSERT: a new status='revoked' marker row supersedes the original, and every Apier read and enforcement surface (GET /v1/auth/permissions/{org}, GET /v1/fullmakt/{org}, POST /v1/actions/execute, and the NAV/Skatteetaten delegation gates) honours the marker immediately — the delegation confers no authority anywhere in Apier after this call returns. The caller supplies ONLY agent_principal_id: the systembruker is resolved from the principal's write-once binding and the org from the delegation row itself, so a request body can never redirect the revoke at another delegation. Idempotent by design: revoking an already-revoked principal or delegation is a 200 no-op, so blind retries are safe (and Idempotency-Key is additionally supported). Ordering contract: the delegation marker is inserted FIRST, then the principal is flipped — if the flip fails after the marker landed, the response is still 200 with `principal_revoke_failed` in `data.warnings` (the delegation IS revoked; reconcile the principal, never assume full success). Altinn-side revocation is NOT yet propagated upstream: the upstream flow is a documented not-implemented stub pending live partner validation, surfaced honestly as `upstream_revoke_unconfirmed` — LOCAL revocation takes effect in Apier's own local check (Apier's recorded state, not a confirmation from Altinn). Recorded in the append-only audit log as `fullmakt.revoke`.

## Headers

- `Idempotency-Key` string
- `X-Agent-Vendor` string
- `X-Agent-Model` string
- `X-Agent-Run-Id` string

## Request body

- object
  - `agent_principal_id` string, uuid, required: The agent principal whose delegation is being revoked. Must be owned by the calling consumer — an unknown id and another consumer's id both return the identical 404 FULLMAKT_PRINCIPAL_NOT_FOUND (no cross-consumer existence leak). The systembruker and org are resolved from this principal server-side; they are deliberately NOT accepted from the request body.
  - `reason` string: Optional operator-facing reason, recorded on the immutable audit row only. Never persisted on the delegation marker, never echoed to any other consumer. Send it with content or omit it — an empty string is rejected with 400 VALIDATION_FAILED.

## Response `200`

The delegation-revocation outcome is authoritative — including the idempotent no-op where the principal/delegation was ALREADY revoked (a blind retry never errors). The PRINCIPAL flip may still have degraded: inspect `data.warnings`. An empty array is the clean path (both legs landed); a non-empty array carries NAMED outcome tokens with distinct meanings — `principal_revoke_failed` is a genuine local degradation (the delegation is revoked but the principal is still in its prior state; reconcile and retry), while `delegation_not_found` (unbound principal — the principal revocation itself proceeded) and `upstream_revoke_unconfirmed` (best-effort Altinn-side propagation returned no ack; expected while the upstream flow is a documented stub) are expected outcomes, not local failures. Read the specific token.

- object
  - `success` true, required
  - `data` object, required
    - `revoked` true, required: Stable acknowledgement that the revocation flow completed (always true on a 200 — failure paths return error envelopes instead). Per-leg degradations ride in `warnings`, not here.
    - `agent_principal` object, required: The agent principal's state AFTER this request. On the clean path status is 'revoked' (terminal). When `warnings` contains `principal_revoke_failed` the status is the principal's actual unchanged state — the delegation is still revoked; re-inspect and retry.
      - `id` string, uuid, required
      - `status` 'pending' | 'active' | 'suspended' | 'revoked', required: Principal lifecycle status after this request. 'revoked' is terminal — the principal is never resurrected.
    - `warnings` string[], required: Machine-readable degradation tokens (closed set, append-only). `delegation_not_found` — no live delegation row existed behind the principal's binding (unbound principal, expired-only history, or an earlier persist failure); the principal flip still proceeded, so no live authority remains either way. `principal_revoke_failed` — the revoked delegation marker IS inserted (the delegation confers no authority anywhere) but the principal's flip to 'revoked' failed; re-inspect the principal and retry (the retry is idempotent). `upstream_revoke_unconfirmed` — the best-effort Altinn-side revoke returned no ack; the upstream flow is a documented not-implemented stub pending live partner validation, and LOCAL revocation takes effect in Apier's own local check (Apier's recorded state, not a confirmation from Altinn). `receipt_generation_failed` — the revocation is durable but signing or persisting the delegation_revoked receipt failed; `receipt_id` and `signed_receipt` are null (the revocation itself stands — receipt failure is never fatal to the revoke). Empty array on the clean path.
    - `receipt_id` string, uuid, nullable, required: The signed delegation receipt's id (also carried INSIDE `signed_receipt` — the id is part of the signed HMAC domain). Null on the idempotent already-revoked no-op and no-delegation paths (no NEW lifecycle event happened in this call — nothing fresh to prove) and when receipt generation failed — see `warnings`.
    - `signed_receipt` SignedDelegationReceipt, required: HMAC-signed fullmakt delegation receipt — cryptographic proof that at `signed_at`, consumer `consumer_id` obtained (`delegation_granted`) or revoked (`delegation_revoked`) a scoped systembruker delegation for `org_number`. Signed through the SAME HMAC-SHA256-v1 core as the filing `SignedReceipt` (one crypto primitive, two payload domains): the signature covers EVERY field except `signature` itself — `signature_algorithm` INCLUDED, so flipping the algorithm tag without recomputing the signature fails verification (downgrade-attack defence). Verification model (be precise about the guarantee): the HMAC secret never leaves Apier, so this receipt is APIER-VERIFIABLE integrity — Apier's attestation, re-checkable by Apier at any time — NOT an independently/offline consumer-verifiable signature (that would require an asymmetric scheme; the versioned `signature_algorithm` field leaves room for such a migration). Holding the receipt still pins every signed field: any later tampering is provable the moment Apier re-verifies. The signature is safe to hold client-side (it contains no secret material). Emitted inline by POST /v1/fullmakt/request (201, event_type=delegation_granted) and POST /v1/fullmakt/revoke (200, event_type=delegation_revoked, fresh revocations only); re-fetchable via GET /v1/fullmakt/receipts, whose entries nest this exact object — the shape Apier's verifier accepts.
      - `receipt_id` string, uuid, required: Route-minted receipt identifier — INSIDE the signed HMAC domain (minted before signing, so the id itself is tamper-evident). Unique per receipt.
      - `event_type` 'delegation_granted' | 'delegation_revoked', required: Which fullmakt lifecycle event this receipt proves. `delegation_granted` — a delegation was brokered and durably recorded. `delegation_revoked` — a live delegation was durably revoked (revoke-by-insert marker). Closed set.
      - `consumer_id` string, uuid, required: The Apier consumer that held the API key which performed the event — the C in "consumer C obtained a delegation for org O".
      - `org_number` string, required: Norwegian organisation number of the CUSTOMER company the delegation applies to (Brønnøysund format, exactly 9 digits).
      - `system_user_id` string, nullable, required: The Altinn systembruker the delegation binds — the S in "under systembruker S". Nullable in the schema for forward-compatibility; both current emitters always carry the bound id.
      - `agent_principal_id` string, uuid, required: The agent principal the lifecycle event anchors to.
      - `scopes` string[], required: Scope set the delegation carried at event time — what "scoped" means in the proof. Frozen verbatim; part of the signed domain.
      - `granted_packages` string[], nullable, required: PROVISIONAL Altinn access packages the delegation row carried (intended-mapping-derived, NOT Altinn-confirmed). Null = unknown. Frozen verbatim so the receipt records what Apier believed at event time.
      - `delegation_status` 'pending' | 'active' | 'expired' | 'revoked', required: Delegation lifecycle state AT SIGNING TIME — 'pending'/'active' on a grant (pending until the signing authority approves), 'revoked' on a revocation.
      - `valid_until` string, date-time, nullable, required: Delegation expiry at event time (null = indefinite). On a delegation_revoked receipt this is the REVOCATION instant — when the authority ended. Millisecond-precision UTC (the exact string form is inside the signed domain).
      - `audit_log_id` string, uuid, required: The immutable audit_log row for the fullmakt.request / fullmakt.revoke action that produced this receipt — the receipt-to-audit forensic join.
      - `correlation_id` string, uuid, required: X-Correlation-ID of the originating request. Joins audit_log / provenance_log on the shared forensic axis.
      - `signed_at` string, date-time, required: When the receipt was signed — the T in "at time T". Millisecond-precision UTC; inside the signed domain.
      - `signature_algorithm` 'HMAC-SHA256-v1', required: Versioned algorithm tag — INSIDE the signed domain (downgrade-attack defence). A future rotation introduces a new enum value; historical receipts keep verifying under the tag they were signed with.
      - `signature` string, required: HMAC-SHA256 hex over the canonical-JSON serialisation of every other field. Verifiable ONLY by Apier (the HMAC secret never leaves the server) — treat a verified receipt as Apier's attestation, never as a third-party- or offline-consumer-verifiable signature.
  - `_meta` TrustMetadata, required: Metadata included in every response for trust and verifiability.
    - `rulebook_version` string, required: Current Rulebook version. Internal rule-version records carry structured origin metadata (`initial_seed` | `human_review` | `lovdata_drift_response` | `audit_finding` | `customer_question` | `legal_correction`) for operator forensics, but that attribution is deliberately NOT exposed on public responses to avoid leaking operational signal.
    - `data_freshness` string, date-time, required: When this data was last fetched (ISO 8601 UTC).
    - `last_verified` string, date-time, required: When this data was last verified against source (ISO 8601 UTC).
    - `source` string, required: Origin of this data. Defaults to `apier.no`. The agent-readiness probe (`GET /api/v1/health/agent-readiness`) is the one surface that may instead emit `apier.no telemetry` — it does so when at least one of its endpoint rates came from measured live telemetry, and falls back to `apier.no` when every rate is a static default; all other endpoints always emit `apier.no`.
    - `data_source` string: Authoritative origin of the underlying data (listed alongside rulebook_version, data_freshness, last_verified, legal_basis for Rulebook-influenced endpoints). Distinct from `source` (the response origin): `data_source` identifies the authoritative data publisher — e.g. 'Brønnøysund Enhetsregisteret + Apier Universal Rulebook'. Present on registry-backed endpoints.
    - `served_from` 'cache' | 'live' | 'static': Cache-aware endpoints only — 'cache' when the response was served from the local copy, 'live' when the gateway just refreshed from the upstream, 'static' when the payload was computed deterministically from pure code with no DB or upstream read (e.g. /v1/public/deadlines). Absent on endpoints that don't carry this semantic.
    - `stale` boolean: Cache-aware endpoints only — true when the upstream was unreachable and a within-limit cached row was served as a fallback. Absent on normal responses.
    - `schema_version` string, required: OpenAPI contract version at the time of the response; matches `info.version`. Always present on every `/v1/*` response so a future schema break can be traced to the exact rows / audit events that predate / postdate it. Agent-facing machine interfaces (v1/capabilities, workflows.json) may override with their own narrower surface version; all other endpoints inherit the manifest-level version.
    - `legal_basis` string: Legal basis under which the response data is reused. Present on Rulebook-influenced endpoints (v1/company/{org}/obligations, /v1/company/{org}/deadlines). Common value: 'NLOD — public registry reuse'.
    - `rule_count` integer: Rule-evaluation count — total rules evaluated for this request. Present on endpoints that invoke the Rulebook evaluator (v1/company/{org}/obligations).
    - `applicable_count` integer: Count of rules whose evaluation_result is 'applicable'. Present on evaluator endpoints.
    - `not_applicable_count` integer: Count of rules whose evaluation_result is 'not_applicable'. Present on evaluator endpoints.
    - `insufficient_data_count` integer: Count of rules whose evaluation_result is 'insufficient_data' (Tier 2 gated). Present on evaluator endpoints. rule_count = applicable_count + not_applicable_count + insufficient_data_count.
    - `cache_age_ms` integer, nullable: Cache layer: milliseconds since the cached row was computed, or null on a cache miss (served_from === 'live'). Agents use it alongside data_freshness as a staleness signal. Present on endpoints wired to the cache (v1/company/{org}/obligations, /deadlines, /summary, /v1/public/obligations, /v1/public/deadlines).
    - `response_time_ms` integer: Speed signal: total server-side processing time in milliseconds, measured via performance.now() at the route boundary. Mirrored on the `X-Apier-Response-Time-Ms` header so agents can key on it without parsing the body. Present on every endpoint.
    - `response_timestamp` string, date-time: RFC 3339 / ISO 8601 UTC timestamp stamped by the response builder at wire-exit. Mirrored on the `provenance_log.response_timestamp` column by a fire-and-forget writer. Distinct from `data_freshness` (when upstream data was fetched) and `last_verified` (when the citation was verified); this is the moment the envelope left the server. Always populated at runtime — deliberately left out of the `required` list to avoid a cascading contract change that would invalidate every pre-existing example envelope in this spec (append-only response contracts). A future revision may promote it into the `required` list alongside a bulk example refresh.
    - `response_hash` string: SHA-256 hash of the canonical-JSON form of the envelope with `_meta` stripped before hashing, prefixed with `sha256:`. Mirrored on `provenance_log.response_hash` so a consumer can independently re-hash the bytes they received and compare against what we persisted (integrity receipt). Stripping `_meta` is load-bearing: volatile fields (response_time_ms, cache_age_ms, served_from) and the hash itself would otherwise feed into the digest and break the cache-hit-bytewise-identical invariant.
    - `source_snapshot_id` string: Optional free-text pointer into an upstream sync snapshot the response derives from — e.g. a Brreg sync's `brreg-<ISO>` snapshot id. Absent when the response is not tied to a specific upstream snapshot (capabilities, tools, static deadlines).
    - `is_sandbox` true: Present and `true` only when the response was generated from sandbox fixture data (currently `ALTINN_MODE=sandbox` on `/api/v1/altinn/list-acting-capacity`). Absent (NOT `false`) on every other response — the absent-vs-false distinction is deliberate so downstream agents branching on `if (response._meta.is_sandbox)` cannot be misled into treating non-sandbox responses as positively-confirmed-not-sandbox. Distinct from the `/v1/sandbox/*` `is_sandbox: true` literal in `SandboxMeta` (which carries the sandbox surface tag); this flag rides through the production `/api/v1/altinn/*` surface to forensically tag a sandbox-mode response that an OEM evaluator received.
    - `cost_nok` number: What this call debited from the caller's prepaid credit balance, in NOK, rendered from the integer-øre ledger (50 øre → 0.5; the ledger itself never leaves whole øre and no float arithmetic touches a balance). Present on the 2xx body of every metered company-data read — the same debit that sets the `X-Credits-Cost-Ore` header, so the two never disagree. `0` when nothing was charged: credit enforcement running dark (the response then also carries `X-Credit-Check: shadow`) or the sandbox surface. Absent on unmetered endpoints and on error envelopes — a refunded 5xx/403/404 claims no cost rather than a wrong one. Lives under `_meta`, which `response_hash` excludes, so the provenance receipt is unaffected; the route's ETag is computed before the credit wrapper stamps it, so a conditional request can still short-circuit to 304. Append-only addition.
    - `wallet_remaining_nok` number, nullable: The prepaid credit balance remaining AFTER this call's debit, in NOK (same rendering as `cost_nok`; mirrors the `X-Credits-Balance-Ore` header). `null` when no balance was read: credit enforcement running dark, or the sandbox surface. Present wherever `cost_nok` is. An agent planning a sequence of metered calls can divide this by the per-call price from GET /api/v1/pricing to know how many reads remain before a 402 INSUFFICIENT_CREDITS. Append-only addition.
    - `spend_cap_remaining_nok` number: What the calling key may still spend under its tighter spend cap (Europe/Oslo calendar day or month) AFTER this call's debit, in NOK (same rendering as `cost_nok`; never below 0). Present on the 2xx body of a metered read only when credit enforcement is live AND the key has a daily or monthly cap (set with PATCH /api/v1/account/keys/{id}); absent otherwise. When it reaches 0 the next metered call on this key returns 402 SPEND_CAP_REACHED until the cap resets. Append-only addition.

## Other responses

- `400`: Request validation failed — malformed JSON body, non-UUID agent_principal_id, empty or over-500-char reason, or an unknown key (the body schema is strict).
- `401`: Authentication failed — missing, malformed, invalid, or revoked API key.
- `403`: The API key lacks the fullmakt:write scope (error_code=SCOPE_INSUFFICIENT). Same assignable WRITE scope as the sibling create-principal and request surfaces — a key that can broker a fullmakt can always revoke it, and never needs more to do so.
- `404`: No agent principal with this id exists for the calling consumer (error_code=FULLMAKT_PRINCIPAL_NOT_FOUND). An unknown id and another consumer's id return this IDENTICAL response — existence is not disclosed across consumers.
- `409`: Another request with the same Idempotency-Key is still mid-flight (error_code=IDEMPOTENCY_IN_PROGRESS) — retry after it settles. Note that an ALREADY-REVOKED principal/delegation is NOT a conflict here: it returns the idempotent 200 no-op.
- `422`: This Idempotency-Key was previously used with a different request body. Idempotency keys must be unique per unique request.
- `429`: Rate limit reached on at least one of TWO independent dimensions running in parallel: per-(api_key, endpoint) per-minute (the established per-tier scaling — Free / Starter / Professional / Enterprise unlimited) AND per-(api_key, org_number) per-day (bounds runaway-agent failure modes per client org so one org's traffic cannot starve siblings sharing the same key; daily bucket window is one calendar day in Europe/Oslo, DST-aware). The `X-RateLimit-Dimension` header identifies which bucket tripped: `per_key`, `per_org`, or `both` (when the same request exceeds both — the binding Retry-After is the per-org value because the per-org window is hours/days vs the per-minute window). The `Retry-After` header indicates how many seconds to wait before the binding window resets; `X-RateLimit-Limit` / `X-RateLimit-Remaining` / `X-RateLimit-Reset` describe the per-minute bucket state. The per-day per-org limits per tier (sized at ~100× typical daily volume — the dimension exists to bound failure modes, not to monetize) are: Free 1000/org/day, Starter 5000, Professional 25000, Enterprise unlimited. On rare infrastructure-side failures the gateway fails OPEN and passes the request through with `X-RateLimit-Check: skipped` on the response — clients can treat that as a transient signal that quota enforcement was briefly degraded.
- `500`: Unexpected server failure — principal lookup infrastructure error, the delegation revoke insert failed before anything was persisted, or the call changed nothing at all (no delegation found AND the principal flip failed). Internal details are never leaked. All 500 paths are retry-safe: either nothing was persisted, or the retry resolves idempotently.
- `503`: The idempotency reservation service is temporarily unavailable (error_code=UPSTREAM_UNAVAILABLE). Clients using Idempotency-Key should retry with the same key.

---

[API](https://skmtc.dev/apier/apis/apier-no-api.md) · [All operations](https://skmtc.dev/apier/apis/apier-no-api/llms.txt) · [OpenAPI document](https://skmtc.dev/apier/apis/apier-no-api/revisions/9ec19bc87311?raw)
