Altinn 3 API client for creating instances, uploading data, and completing submissions.
Ported from wenche/altinn_client.py in the original Python Wenche project.
Handles instance creation, data submission, and completion for all three submission types: annual accounts, tax return, and shareholder register.
Summary
Functions
Moves the instance to the next process step.
Creates a new Altinn 3 app instance.
Advances the instance one process step (PUT /process/next) and returns the
configured Altinn inbox URL for later inspection.
Gets the current status of an instance.
Gets the current status of an instance.
Uploads the skattemelding envelope (skattemeldingOgNaeringsspesifikasjon) as a new data element on the instance.
Adds a new data element to an instance with POST.
Advances the instance one process step (PUT /process/next) without
returning the inbox URL. Use fullfoor_instans/3 for the final step.
Creates a new AltinnClient with the given token and environment.
Updates an existing data element in the instance with PUT.
Creates a new instance for the given submission type and organization.
Uploads/updates a data element on an existing instance.
Types
Functions
Moves the instance to the next process step.
Returns {:ok, response_body} or {:error, reason}.
Creates a new Altinn 3 app instance.
Returns {:ok, instance_body} or {:error, reason}.
Advances the instance one process step (PUT /process/next) and returns the
configured Altinn inbox URL for later inspection.
For Skatteetaten flows such as skattemelding and MVA, callers typically use an Altinn platform token derived from ID-porten and call this for the final process transition. Manual signing in the Altinn inbox is only relevant for app flows that explicitly stop on a confirmation/signing task, for example revisor confirmation.
Returns {:ok, %{inbox_url: inbox_url, response: body}} on success — body
is the raw response of the final process/next transition (for Skatteetaten
flows this is what the receipt/betalingsinformasjon is derived from). Returns
{:error, reason} otherwise.
Gets the current status of an instance.
Returns {:ok, response_body} or {:error, reason}.
Gets the current status of an instance.
Returns {:ok, response_body} or {:error, reason}.
Uploads the skattemelding envelope (skattemeldingOgNaeringsspesifikasjon) as a new data element on the instance.
The SKD formueinntekt-skattemelding-v2 app expects:
- POST (not PUT) to
/instances/{id}/data?dataType=skattemeldingOgNaeringsspesifikasjon Content-Type: text/xmlContent-Disposition: attachment; filename=skattemelding.xml— no quotes around the filename; the app's parser is sensitive to this.
Returns {:ok, response_body} or {:error, reason}.
Adds a new data element to an instance with POST.
Unlike oppdater_data_element/6 which updates an existing element,
this creates a new data element on the instance.
Returns {:ok, response_body} or {:error, reason}.
Advances the instance one process step (PUT /process/next) without
returning the inbox URL. Use fullfoor_instans/3 for the final step.
Returns {:ok, response_body} or {:error, reason}.
Creates a new AltinnClient with the given token and environment.
Options
:env—"test"or"prod"(default:"prod"):req_options— extra options passed toReq(default:[])
Updates an existing data element in the instance with PUT.
Altinn creates data elements automatically upon instance creation; we find the correct element via dataType and replace its contents.
Returns {:ok, response_body} or {:error, reason}.
Creates a new instance for the given submission type and organization.
App keys
"aarsregnskap"— Annual accounts (BRG)"aksjonaerregister"— Shareholder register (SKD)"skattemelding"— Tax return (SKD)
Returns {:ok, instance_map} or {:error, reason}.
Uploads/updates a data element on an existing instance.
Returns {:ok, response_body} or {:error, reason}.