# Provisioning

Device provisioning and activation

## Get provision token

> Generate a provision token for device activation\
> \
> Required permissions, when user-scoped authentication is used: \`PROVISION\_DEVICES\`.\
> User-scoped tokens that set \`ownerId\` different from authenticated user ID also require \`ORG\_VIEW\_USERS\`.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"Provisioning","description":"Device provisioning and activation"}],"servers":[{"url":"https://{server_address}","description":"Blynk Server","variables":{"server_address":{"default":"blynk.cloud","description":"Your Blynk server domain"}}}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth2 Bearer token obtained from authentication endpoint"}},"schemas":{"ProvisionTokenResponse":{"type":"object","properties":{"token":{"type":"string","description":"Provision token value"},"deviceId":{"type":"integer","format":"int32","description":"ID of the device associated with this token"}},"required":["token","deviceId"]},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/device/provision/token":{"post":{"tags":["Provisioning"],"summary":"Get provision token","description":"Generate a provision token for device activation\n\nRequired permissions, when user-scoped authentication is used: `PROVISION_DEVICES`.\nUser-scoped tokens that set `ownerId` different from authenticated user ID also require `ORG_VIEW_USERS`.\n","operationId":"getProvisionToken","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"orgId":{"type":"integer","format":"int32","description":"Organization ID, in which device should be created."},"ownerId":{"type":"integer","format":"int64","description":"User ID, to which device will be assigned."}},"required":["orgId","ownerId"]}}}},"responses":{"200":{"description":"Provision token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProvisionTokenResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Organization/user not found or access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## Send reconfigure message to device

> Send a reconfigure command to a device, putting it into access point mode for re-provisioning.\
> \
> Required permissions, when user-scoped authentication is used: \`PROVISION\_DEVICES\`.\
> Required device view permission: \`OWN\_DEVICES\_VIEW\` or \`ORG\_DEVICES\_VIEW\`.\
> User-scoped tokens can reconfigure only owned devices unless \`ORG\_DEVICES\_VIEW\` is granted.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"Provisioning","description":"Device provisioning and activation"}],"servers":[{"url":"https://{server_address}","description":"Blynk Server","variables":{"server_address":{"default":"blynk.cloud","description":"Your Blynk server domain"}}}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth2 Bearer token obtained from authentication endpoint"}},"schemas":{"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/device/provision/reconfigure":{"post":{"tags":["Provisioning"],"summary":"Send reconfigure message to device","description":"Send a reconfigure command to a device, putting it into access point mode for re-provisioning.\n\nRequired permissions, when user-scoped authentication is used: `PROVISION_DEVICES`.\nRequired device view permission: `OWN_DEVICES_VIEW` or `ORG_DEVICES_VIEW`.\nUser-scoped tokens can reconfigure only owned devices unless `ORG_DEVICES_VIEW` is granted.\n","operationId":"sendReconfigureMessage","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"deviceId":{"type":"integer","format":"int32","description":"Device ID"}},"required":["deviceId"]}}}},"responses":{"200":{"description":"Reconfigure message sent successfully","content":{"application/json":{"schema":{"type":"object","properties":{"deviceIsOffline":{"type":"boolean","description":"Whether the device is offline (true if both Blynk and MQTT channels are offline)"}}}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Device not found or access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## Get re-provision token

> Generate a re-provision token for an existing device. Re-provisioning creates a new token\
> but preserves the device ID and all other device data.\
> \
> Required permissions, when user-scoped authentication is used: \`PROVISION\_DEVICES\`.\
> Required device view permission: \`OWN\_DEVICES\_VIEW\` or \`ORG\_DEVICES\_VIEW\`.\
> User-scoped tokens can re-provision only owned devices unless \`ORG\_DEVICES\_VIEW\` is granted.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"Provisioning","description":"Device provisioning and activation"}],"servers":[{"url":"https://{server_address}","description":"Blynk Server","variables":{"server_address":{"default":"blynk.cloud","description":"Your Blynk server domain"}}}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth2 Bearer token obtained from authentication endpoint"}},"schemas":{"ProvisionTokenResponse":{"type":"object","properties":{"token":{"type":"string","description":"Provision token value"},"deviceId":{"type":"integer","format":"int32","description":"ID of the device associated with this token"}},"required":["token","deviceId"]},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/device/provision/reprovision/token":{"post":{"tags":["Provisioning"],"summary":"Get re-provision token","description":"Generate a re-provision token for an existing device. Re-provisioning creates a new token\nbut preserves the device ID and all other device data.\n\nRequired permissions, when user-scoped authentication is used: `PROVISION_DEVICES`.\nRequired device view permission: `OWN_DEVICES_VIEW` or `ORG_DEVICES_VIEW`.\nUser-scoped tokens can re-provision only owned devices unless `ORG_DEVICES_VIEW` is granted.\n","operationId":"getReProvisionToken","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"deviceId":{"type":"integer","format":"int32","description":"ID of the existing device to re-provision."}},"required":["deviceId"]}}}},"responses":{"200":{"description":"Re-provision token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProvisionTokenResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Device not found or access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.blynk.io/en/blynk.cloud/platform-https-api/provisioning.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
