Static Tokens
Device static tokens
Generate one or more static authentication tokens for a given template (product).
Each generated token is created in the UNCLAIMED state and can later be claimed by a user (see the claim endpoint) or used directly by a device for authentication.
Note: to generate the QR code, that is acceptable by the official Blynk mobile applications, use the following format: {token}+{orgId}.
The optional metaMapping array assigns meta field values to each generated token. When provided, its size must equal count, and each entry maps a template meta field id to its value.
Required permissions, when user-scoped authentication is used: MANAGE_STATIC_TOKENS.
OAuth2 Bearer token obtained from authentication endpoint
Template (product) ID, that the tokens will be generated for
201Number of static tokens to generate
3Organization ID (optional). If not provided, the organization, that is associated with the authentication token, will be used.
101Static tokens generated successfully
Static authentication token, that should be used for device claiming
sqr_gCCsLSydh3d0ArmZj50l9zr79JXVooBROrganization ID, that the token belongs to
101Template ID, that the token belongs to
201Device token, that should be used on the device for authentication.
BoLtnO92MSlsTKVXQ8ggGmGd47sX9LtsToken creation timestamp
1707244800000Static token status
UNCLAIMEDPossible values: User ID of the claimed device owner
202Device ID of the claimed device
101Organization ID, that the device was claimed to
101Bad request
Forbidden
Template or organization not found or access denied
Too many requests
Internal server error
POST /api/v1/organization/static-tokens/generate HTTP/1.1
Host: blynk.cloud
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 27
{
"productId": 201,
"count": 3
}[
{
"token": "sqr_gCCsLSydh3d0ArmZj50l9zr79JXVooBR",
"orgId": 101,
"productId": 201,
"deviceToken": "BoLtnO92MSlsTKVXQ8ggGmGd47sX9Lts",
"createdAt": 1707244800000,
"status": "UNCLAIMED",
"ownerId": 202,
"deviceId": 101,
"claimedOrgId": 101
}
]Retrieve all static authentication tokens for devices
Note: to generate the QR code, that is acceptable by the official Blynk mobile applications, use the following format: {token}+{orgId}.
Required permissions, when user-scoped authentication is used: MANAGE_STATIC_TOKENS.
OAuth2 Bearer token obtained from authentication endpoint
Organization ID (optional). If not provided, the organization, that is associated with the authentication token, will be used.
Page number (0-indexed)
0Page size (max 1000)
50List of static tokens
Total number of static tokens in the organization
1Bad request
Forbidden
Organization not found or access denied
Too many requests
Internal server error
GET /api/v1/organization/static-tokens HTTP/1.1
Host: blynk.cloud
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"content": [
{
"token": "sqr_gCCsLSydh3d0ArmZj50l9zr79JXVooBR",
"orgId": 101,
"productId": 201,
"deviceToken": "BoLtnO92MSlsTKVXQ8ggGmGd47sX9Lts",
"createdAt": 1707244800000,
"status": "UNCLAIMED",
"ownerId": 202,
"deviceId": 101,
"claimedOrgId": 101
}
],
"totalElements": 1
}Claim a device using its static token (QR code). This endpoint creates a new device or transfers an existing device to the specified user's organization.
The QR code can be in two formats:
Plain token:
sqr_gCCsLSydh3d0ArmZj50l9zr79JXVooBRQR format with organization ID:
sqr_gCCsLSydh3d0ArmZj50l9zr79JXVooBR+1
If the device doesn't exist, it will be created in the user's organization. If it exists in a different organization, it will be transferred to the user's organization (requires proper access permissions).
Important:
The static token should not be already claimed
The OAuth client must have access to both the user specified in
userIdand the organization where the static token was created
Required permissions, when user-scoped authentication is used: ORG_DEVICES_CREATE. Required device view permission: OWN_DEVICES_VIEW or ORG_DEVICES_VIEW. User-scoped tokens that set userId different from authenticated user ID also require ORG_VIEW_USERS.
OAuth2 Bearer token obtained from authentication endpoint
Static token QR code value (plain token or token+orgId format)
sqr_gCCsLSydh3d0ArmZj50l9zr79JXVooBR+1Device name (optional). If not provided or empty, defaults to "New Device". Only letters, digits, spaces, apostrophes, underscores, and hyphens are allowed.
Living Room SensorPattern: ^[a-zA-Z0-9 '\-_]+$User ID who will own the claimed device
12345Device claimed successfully
Device ID
1Device name
Living Room SensorTemplate ID this device belongs to
101Original template ID from the template hierarchy (the root template ID this device is ultimately derived from)
3Organization ID this device belongs to
101Device authentication token
ZJW2kImth5rGzPUBVcSPkqS_YsoFEFJmDevice activation timestamp
1707244800000Device owner identifier
202Bad request
Forbidden
Resource not found
Too many requests
Internal server error
POST /api/v1/organization/static-tokens/claim HTTP/1.1
Host: blynk.cloud
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 101
{
"qrCode": "sqr_gCCsLSydh3d0ArmZj50l9zr79JXVooBR+1",
"deviceName": "Kitchen Thermometer",
"userId": 12345
}{
"id": 1,
"name": "Living Room Sensor",
"templateId": 101,
"originalTemplateId": 3,
"orgId": 101,
"token": "ZJW2kImth5rGzPUBVcSPkqS_YsoFEFJm",
"activatedAt": 1707244800000,
"ownerUserId": 202,
"hardwareInfo": {
"version": "1.0.0",
"fwType": "TMPL8RITg_f9Q",
"blynkVersion": "1.0.0",
"boardType": "Arduino",
"build": "10 Jan 2025",
"templateId": "TMPL8RITg_f9Q"
}
}Remove device associations from static tokens. The static token itself won't be deleted.
Returns 400 if no valid tokens were found to unclaim (tokens may be invalid, already unclaimed, or do not exist).
Required permissions, when user-scoped authentication is used: MANAGE_STATIC_TOKENS, ORG_DEVICES_DELETE.
OAuth2 Bearer token obtained from authentication endpoint
List of QR code tokens to unclaim
sqr_gCCsLSydh3d0ArmZj50l9zr79JXVooBR+1Tokens unclaimed successfully
No content
Bad request
Forbidden or no access to the token's organization
Too many requests
Internal server error
POST /api/v1/organization/static-tokens/unclaim HTTP/1.1
Host: blynk.cloud
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 54
{
"qrCodes": [
"sqr_gCCsLSydh3d0ArmZj50l9zr79JXVooBR+1"
]
}No content
Last updated
Was this helpful?

