Skip to main content

Age Verification

Start age verification

The POST /v3/bankid-se/age-verification endpoint is used to start an age verification using BankID.

POST /v3/bankid-se/age-verification
Authorization: Basic ${ base64(accountId + ':' + secretKey) }
{
"minAge": 18,
"maxAge": 100,
"callbackUrl": "https://...",
"redirectUrl": "https://...",
"refId": "12398698"
}
ParameterRequiredDescription
minAgeNo1The minimum age (inclusive). This field can be null, indicating that there is no minimum.
maxAgeNo1The maximum age (inclusive). This field can be null, indicating that there is no maximum.
callbackUrlNoA URL where IDkollen will send a callback on successful or failed requests.
redirectUrlNoA URL where IDkollen will redirect the user on successful or failed requests.
refIdNoReference ID which will be included in a Collect and in the callback.

1 Either minAge or maxAge, or both, must be provided.

Response:

IDkollen will respond with HTTP status 201 for successful request, or 4xx/5xx on errors. For more information about errors, please see the Errors section.

HTTP/2.0 201 Created
{
"id": "1668b9da-bff1-4dfc-ad48-60507b5a8d12",
"refId": "12398698",
"status": "PENDING",
"url": "https://..."
}
PropertyDescription
idAuthentication id, used to cancel or get the status of this age verification request.
refIdThe refId given in the request, if any.
urlThe URL where the end user can authenticate themselves.

Fetch result

The GET /v3/bankid-se/age-verification/{{id}} endpoint is used to check the status of an age verification request.

NOTE: This endpoint is rate limited to one request per second.

GET /v3/bankid-se/age-verification/{{id}}
Authorization: Basic ${ base64(accountId + ':' + secretKey) }

This endpoint will respond with a HTTP status of 404 if the age verification session has expired.

The status of an age verification can be either one of: PENDING, COMPLETED or FAILED.

Pending

{
"id": "1668b9da-bff1-4dfc-ad48-60507b5a8d12",
"refId": "12398698",
"status": "PENDING",
"url": "https://..."
}
ParameterDescription
refIdThe refId given in the request, if any.
urlThe URL where the end user can authenticate themselves.

Completed

{
"id": "1668b9da-bff1-4dfc-ad48-60507b5a8d12",
"refId": "12398698",
"status": "COMPLETED",
"ageVerified": true
}
ParameterDescription
refIdThe refId given in the request, if any.
ageVerifiedtrue if the authenticated user matches the requested age, otherwise false.

Failed

{
"id": "1668b9da-bff1-4dfc-ad48-60507b5a8d12",
"refId": "12398698",
"status": "FAILED",
"error": "INVALID_ID"
}
ParameterDescription
refIdThe refId given in the request, if any.
errorAn error code describing the reason for why the age verification failed.

The error may be one of the following values:

CodeDescription
AUTH_FAILEDA generic code for any kind of failure.
CANCELLEDThe age verification was cancelled either by the user or the partner.
INVALID_IDThe ID has expired or is otherwise invalid.
INTERNAL_ERRORAn internal error occurred causing the age verification to fail.
SESSION_TIMEOUTThe age verification expired or timed out.
UNSUPPORTED_CLIENTThe client used for the age verification is not supported.

New error codes may be added in the future without prior notice. The partner should therefore handle unknown error codes in their implementations.

Cancel age verification

The DELETE /v3/bankid-se/age-verification/{{id}} endpoint is used to cancel an ongoing BankID (SE) age verification.

DELETE /v3/bankid-se/age-verification/{{id}}
Authorization: Basic ${ base64(accountId + ':' + secretKey) }

IDkollen will respond with HTTP status 204 for successful request, or 4xx/5xx on errors. For more information about errors, please see the Errors section.