Skip to main content
Skip table of contents

Authentication and token refresh

To use Blink API, you must authenticate using a bearer access token (id_token). You can obtain this token by sending a request to the authentication endpoint, along with your account username (<USERNAME>), password (<PASSWORD>) and system name (<SYSTEM>).

Request bearer access token

Request (Curl)

BASH
curl --location 'https://<SYSTEM>-api.blink.online/api/v2/auth' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data-raw '{  
   "AuthMode": "Pwd", 
   "Username": "<USERNAME>",
   "Password": "<PASSWORD>",  
   "Device": { 
     "Number": "<SYSTEM>",
     "Type": "AzureFunction",
     "DeviceInfo": "<SYSTEM>"
   } 
 }'

Response (JSON)

JSON
{
    "id_token": "eyJhbGciOi...",
    "access_token": null,
    "token_type": "bearer",
    "refresh_token": "eyJhbGciOi...."
}

Note that bearer access tokens are only valid for 24 hours. After that you will need to request a new token. This should be done using the refresh token (<REFRESH_TOKEN>) and system name (<SYSTEM>) (see below).

Request new bearer access token by refresh token

Request (Curl)

BASH
curl --location 'https://<SYSTEM>-api.blink.online/api/v1/Token/Refresh?refreshToken=<REFRESH_TOKEN>' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data-raw '{
    "Number": "<SYSTEM>",
    "Type": "AzureFunction",
    "DeviceInfo": "<SYSTEM>"
}'

Response (JSON)

JSON
{
    "id_token": "eyJhbGciOi...",
    "expires_in": 1706686564,
    "refresh_token": "eyJhbGciOi..",
    "access_token": null,
    "token_type": "Bearer"
}

Use the bearer access token (<ID_TOKEN>) for all requests against the Blink API.

Use bearer access token in any request

Example GET Request (Curl)

BASH
curl --location 'https://<SYSTEM>-api.blink.online/odata/v2/Locations' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <ID_TOKEN>'

Example POST Request (Curl)

BASH
curl --location 'https://<SYSTEM>-api.blink.online/odata/v2/Locations' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <ID_TOKEN>' \
--data-raw '{ ... }'
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.