For the complete documentation index, see llms.txt. This page is also available as Markdown.

Static Tokens

Device static tokens

Generate static tokens

post

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.

Authorizations
AuthorizationstringRequired

OAuth2 Bearer token obtained from authentication endpoint

Body
productIdinteger · int32Required

Template (product) ID, that the tokens will be generated for

Example: 201
countinteger · int32 · min: 1 · max: 100000Required

Number of static tokens to generate

Example: 3
orgIdinteger · int32Optional

Organization ID (optional). If not provided, the organization, that is associated with the authentication token, will be used.

Example: 101
Responses
201

Static tokens generated successfully

application/json
tokenstringRequired

Static authentication token, that should be used for device claiming

Example: sqr_gCCsLSydh3d0ArmZj50l9zr79JXVooBR
orgIdinteger · int32Required

Organization ID, that the token belongs to

Example: 101
productIdinteger · int32Required

Template ID, that the token belongs to

Example: 201
deviceTokenstringRequired

Device token, that should be used on the device for authentication.

Example: BoLtnO92MSlsTKVXQ8ggGmGd47sX9Lts
createdAtinteger · int64Required

Token creation timestamp

Example: 1707244800000
statusstring · enumRequired

Static token status

Example: UNCLAIMEDPossible values:
ownerIdinteger · int64Optional

User ID of the claimed device owner

Example: 202
deviceIdinteger · int32Optional

Device ID of the claimed device

Example: 101
claimedOrgIdinteger · int32Optional

Organization ID, that the device was claimed to

Example: 101
post/api/v1/organization/static-tokens/generate
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
  }
]

Get static tokens

get

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.

Authorizations
AuthorizationstringRequired

OAuth2 Bearer token obtained from authentication endpoint

Query parameters
orgIdinteger · int32Optional

Organization ID (optional). If not provided, the organization, that is associated with the authentication token, will be used.

pageinteger · int32Optional

Page number (0-indexed)

Default: 0
sizeinteger · int32 · min: 1 · max: 1000Optional

Page size (max 1000)

Default: 50
Responses
200

List of static tokens

application/json
totalElementsinteger · int64Required

Total number of static tokens in the organization

Example: 1
get/api/v1/organization/static-tokens
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 device by static token

post

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_gCCsLSydh3d0ArmZj50l9zr79JXVooBR

  • QR 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 userId and 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.

Authorizations
AuthorizationstringRequired

OAuth2 Bearer token obtained from authentication endpoint

Body
qrCodestring · max: 200Required

Static token QR code value (plain token or token+orgId format)

Example: sqr_gCCsLSydh3d0ArmZj50l9zr79JXVooBR+1
deviceNamestring · max: 50Optional

Device name (optional). If not provided or empty, defaults to "New Device". Only letters, digits, spaces, apostrophes, underscores, and hyphens are allowed.

Example: Living Room SensorPattern: ^[a-zA-Z0-9 '\-_]+$
userIdinteger · int64Required

User ID who will own the claimed device

Example: 12345
Responses
200

Device claimed successfully

application/json
idinteger · int32Required

Device ID

Example: 1
namestringRequired

Device name

Example: Living Room Sensor
templateIdinteger · int32Required

Template ID this device belongs to

Example: 101
originalTemplateIdinteger · int32Required

Original template ID from the template hierarchy (the root template ID this device is ultimately derived from)

Example: 3
orgIdinteger · int32Required

Organization ID this device belongs to

Example: 101
tokenstringRequired

Device authentication token

Example: ZJW2kImth5rGzPUBVcSPkqS_YsoFEFJm
activatedAtinteger · int64Optional

Device activation timestamp

Example: 1707244800000
ownerUserIdinteger · int64Optional

Device owner identifier

Example: 202
post/api/v1/organization/static-tokens/claim
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"
  }
}

Unclaim static tokens

post

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.

Authorizations
AuthorizationstringRequired

OAuth2 Bearer token obtained from authentication endpoint

Body
qrCodesstring[] · min: 1 · max: 10000Required

List of QR code tokens to unclaim

Example: sqr_gCCsLSydh3d0ArmZj50l9zr79JXVooBR+1
Responses
204

Tokens unclaimed successfully

No content

post/api/v1/organization/static-tokens/unclaim
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?