Request consent
Prerequisites
- The data consumer must have a registered Maskinporten client.
- The data consumer must have been delegated the consent scope from Digdir. (altinn:consentrequests.write & altinn:consentrequests.read)
- The necessary scopes must be added to the Maskinporten client.
- Access to request consent for the relevant resource(s) must be granted.
API Endpoint
- Test:
POST https://platform.tt02.altinn.no/accessmanagement/api/v1/enterprise/consentrequests/ - Production:
POST https://platform.altinn.no/accessmanagement/api/v1/enterprise/consentrequests/
Request (example)
{
"id": "77ed8698-e619-4066-9eb4-5c1eb3f165a1", // per-request unique ID
"from": "urn:altinn:person:identifier-no:21818297804",
"to": "urn:altinn:organization:identifier-no:991825827",
"validTo": "2026-07-18T06:18:12.2597103+00:00",
"consentRights": [
{
"action": ["consent"],
"resource": [
{
"type": "urn:altinn:resource",
"value": "standard-samtykke-for-dele-data"
}
],
"metaData": {
"inntektsaar": "2023"
}
},
{
"action": ["consent"],
"resource": [
{
"type": "urn:altinn:resource",
"value": "standard-samtykke-for-dele-data"
}
],
"metaData": {
"inntektsaar": "2024"
}
}
],
"redirectUrl": "https://bankenmin.no/huslaan?consentId=77ed8698-e619-4066-9eb4-5c1eb3f165a1"
}
Redirect URL
As part of the consent request, the consumer specifies which URL the user should be returned to after the consent process is completed.
If there is a need to receive an identifier back in the response, this can be added as a query parameter in the redirect URL with the desired parameter name. For example, authorizationCode can be used, which was the terminology used in Altinn 2.
Example of redirect URL with parameter:
https://bankenmin.no/huslaan/?consentId=77ed8698-e619-4066-9eb4-5c1eb3f165a1&authorizationCode={id}
Response (example)
{
"id": "77ed8698-e619-4066-9eb4-5c1eb3f165a1",
"from": "urn:altinn:person:identifier-no:21818297804",
"to": "urn:altinn:organization:identifier-no:991825827",
"requiredDelegator": null,
"handledBy": null,
"validTo": "2026-07-18T06:18:12.25971+00:00",
"consentRights": [
{
"action": ["consent"],
"resource": [
{
"type": "urn:altinn:resource",
"value": "standard-samtykke-for-dele-data"
}
],
"metaData": {
"inntektsaar": "2023"
}
},
{
"action": ["consent"],
"resource": [
{
"type": "urn:altinn:resource",
"value": "standard-samtykke-for-dele-data"
}
],
"metaData": {
"inntektsaar": "2024"
}
}
],
"requestMessage": null,
"consented": null,
"redirectUrl": "https://altinn.no",
"consentRequestEvents": [
{
"consentEventID": "01981c2f-1de4-7b9f-a7c7-854f1dd4f115",
"created": "2025-07-18T06:18:26.65293+00:00",
"performedBy": "urn:altinn:organization:identifier-no:991825827",
"eventType": "Created",
"consentRequestID": "77ed8698-e619-4066-9eb4-5c1eb3f165a1"
}
],
"viewUri": "https://am.ui.tt02.altinn.no/accessmanagement/ui/consent/request?id=77ed8698-e619-4066-9eb4-5c1eb3f165a1"
}