Age Verification
Age verification checks that a user is within an age range, without telling you who they are. You send the user to the
url you get back, they identify themselves with BankID, and you only get back whether their age matched.
Start age verification
The POST /v3/bankid-no/age-verification endpoint is used to start an age verification using BankID.
POST /v3/bankid-no/age-verification
Authorization: Basic ${ base64(accountId + ':' + secretKey) }
{
"minAge": 18,
"maxAge": 100,
"callbackUrl": "https://...",
"redirectUrl": "https://...",
"refId": "12398698"
}
- curl
- C#
- Dart
- Go
- JavaScript
- Java / Kotlin
- PHP
- Python
- Ruby
- Rust
- Swift
curl -u "$ACCOUNT_ID:$SECRET_KEY" https://api.idkollen.se/v3/bankid-no/age-verification \
-H 'Content-Type: application/json' \
-d '{
"minAge": 18,
"maxAge": 100,
"refId": "12398698",
"callbackUrl": "https://example.com/callback",
"redirectUrl": "https://example.com/return"
}'
var status = await client.BankIdNo.AgeVerificationAsync(new AgeVerificationRequest
{
MinAge = 18,
MaxAge = 100,
RefId = "12398698",
CallbackUrl = "https://example.com/callback",
RedirectUrl = "https://example.com/return",
});
final status = await client.bankIdNo.ageVerification(const AgeVerificationRequest(
minAge: 18,
maxAge: 100,
refId: '12398698',
callbackUrl: 'https://example.com/callback',
redirectUrl: 'https://example.com/return',
));
// func ptr[T any](v T) *T { return &v }
status, err := client.BankIdNo().AgeVerification(ctx, identisure.AgeVerificationRequest{
MinAge: ptr(18),
MaxAge: ptr(100),
RefId: ptr("12398698"),
CallbackUrl: ptr("https://example.com/callback"),
RedirectUrl: ptr("https://example.com/return"),
})
const status = await client.bankidNo().ageVerification({
minAge: 18,
maxAge: 100,
refId: "12398698",
callbackUrl: "https://example.com/callback",
redirectUrl: "https://example.com/return",
});
import com.identisure.client.models.*;
var status = client.bankIdNo().ageVerification(new AgeVerificationRequest()
.setMinAge(18)
.setMaxAge(100)
.setRefId("12398698")
.setCallbackUrl("https://example.com/callback")
.setRedirectUrl("https://example.com/return")
).join();
use Identisure\Client\Models\AgeVerification\AgeVerificationRequest;
$status = $client->bankIdNo()->ageVerification(new AgeVerificationRequest(
minAge: 18,
maxAge: 100,
refId: '12398698',
callbackUrl: 'https://example.com/callback',
redirectUrl: 'https://example.com/return',
));
from identisure_client.models import AgeVerificationRequest
status = client.bankid_no().age_verification(
AgeVerificationRequest(
min_age=18,
max_age=100,
ref_id="12398698",
callback_url="https://example.com/callback",
redirect_url="https://example.com/return",
)
)
status = client.bank_id_no.age_verification(
Identisure::AgeVerification::Request.new(
min_age: 18,
max_age: 100,
ref_id: '12398698',
callback_url: 'https://example.com/callback',
redirect_url: 'https://example.com/return',
)
)
use identisure_client::models::{AgeVerificationRequest, Url};
let request = AgeVerificationRequest::new()
.min_age(18)
.max_age(100)
.ref_id("12398698")
.callback_url(Url::parse("https://example.com/callback")?)
.redirect_url(Url::parse("https://example.com/return")?);
let status = client.bankid_no().age_verification(request).await?;
let status = try await client.bankIdNo.ageVerification(AgeVerificationRequest(
minAge: 18,
maxAge: 100,
refId: "12398698",
callbackUrl: "https://example.com/callback",
redirectUrl: "https://example.com/return"
))
| Parameter | Required | Description |
|---|---|---|
| minAge | No1 | The minimum age (inclusive). This field can be null, indicating that there is no minimum. |
| maxAge | No1 | The maximum age (inclusive). This field can be null, indicating that there is no maximum. |
| callbackUrl | No | A URL where IDkollen will send a callback on successful or failed requests. Must be whitelisted, see Callbacks. |
| redirectUrl | No | A URL where IDkollen will redirect the user on successful or failed requests. |
| refId | No | Reference ID which will be included in the result 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.
{
"id": "1668b9da-bff1-4dfc-ad48-60507b5a8d12",
"refId": "12398698",
"status": "PENDING",
"url": "https://..."
}
| Property | Description |
|---|---|
| id | Authentication id, used to cancel or get the status of this age verification request. |
| refId | The refId given in the request, if any. |
| url | The URL where the end user can authenticate themselves. |
Fetch result
The GET /v3/bankid-no/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. See Errors.
GET /v3/bankid-no/age-verification/{{id}}
Authorization: Basic ${ base64(accountId + ':' + secretKey) }
- curl
- C#
- Dart
- Go
- JavaScript
- Java / Kotlin
- PHP
- Python
- Ruby
- Rust
- Swift
curl -u "$ACCOUNT_ID:$SECRET_KEY" https://api.idkollen.se/v3/bankid-no/age-verification/$ID
var status = await client.BankIdNo.AgeVerificationStatusAsync(id);
final status = await client.bankIdNo.ageVerificationStatus(id);
status, err := client.BankIdNo().AgeVerificationStatus(ctx, id)
const status = await client.bankidNo().ageVerificationStatus(id);
var status = client.bankIdNo().ageVerificationStatus(id).join();
$status = $client->bankIdNo()->ageVerificationStatus($id);
status = client.bankid_no().age_verification_status(id)
status = client.bank_id_no.age_verification_status(id)
let status = client.bankid_no().age_verification_status(&id).await?;
let status = try await client.bankIdNo.ageVerificationStatus(id: id)
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://..."
}
| Parameter | Description |
|---|---|
| refId | The refId given in the request, if any. |
| url | The URL where the end user can authenticate themselves. |
Completed
{
"id": "1668b9da-bff1-4dfc-ad48-60507b5a8d12",
"refId": "12398698",
"status": "COMPLETED",
"ageVerified": true
}
| Parameter | Description |
|---|---|
| refId | The refId given in the request, if any. |
| ageVerified | true if the authenticated user matches the requested age, otherwise false. |
Failed
{
"id": "1668b9da-bff1-4dfc-ad48-60507b5a8d12",
"refId": "12398698",
"status": "FAILED",
"error": "INVALID_ID"
}
| Parameter | Description |
|---|---|
| refId | The refId given in the request, if any. |
| error | An error code describing the reason for why the age verification failed. |
The error may be one of the following values:
| Code | Description |
|---|---|
| AUTH_FAILED | A generic code for any kind of failure. |
| CANCELLED | The age verification was cancelled either by the user or the partner. |
| INVALID_ID | The ID has expired or is otherwise invalid. |
| INTERNAL_ERROR | An internal error occurred causing the age verification to fail. |
| SESSION_TIMEOUT | The age verification expired or timed out. |
| UNSUPPORTED_CLIENT | The 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-no/age-verification/{{id}} endpoint is used to cancel an ongoing BankID age verification.
DELETE /v3/bankid-no/age-verification/{{id}}
Authorization: Basic ${ base64(accountId + ':' + secretKey) }
- curl
- C#
- Dart
- Go
- JavaScript
- Java / Kotlin
- PHP
- Python
- Ruby
- Rust
- Swift
curl -u "$ACCOUNT_ID:$SECRET_KEY" -X DELETE https://api.idkollen.se/v3/bankid-no/age-verification/$ID
await client.BankIdNo.CancelAgeVerificationAsync(id);
await client.bankIdNo.cancelAgeVerification(id);
err := client.BankIdNo().CancelAgeVerification(ctx, id)
await client.bankidNo().cancelAgeVerification(id);
client.bankIdNo().cancelAgeVerification(id).join();
$client->bankIdNo()->cancelAgeVerification($id);
client.bankid_no().cancel_age_verification(id)
client.bank_id_no.cancel_age_verification(id)
client.bankid_no().cancel_age_verification(&id).await?;
try await client.bankIdNo.cancelAgeVerification(id: id)
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.