curl -X POST https://api.bota.dev/v1/devices/dev_abc123/wifi-config/grant \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"expires_in_seconds": 900
}'
const response = await fetch('https://api.bota.dev/v1/devices/dev_abc123/wifi-config/grant', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk_live_...',
'Content-Type': 'application/json',
},
body: JSON.stringify({
expires_in_seconds: 900,
}),
});
const grant = await response.json();
// Send grant.grant_blob to device via BLE
import requests
response = requests.post(
'https://api.bota.dev/v1/devices/dev_abc123/wifi-config/grant',
headers={
'Authorization': 'Bearer sk_live_...',
'Content-Type': 'application/json',
},
json={
'expires_in_seconds': 900,
},
)
grant = response.json()
# Send grant['grant_blob'] to device via BLE
{
"grant_blob": "eyJhbGciOiJIUzI1NiIs...",
"expires_at": "2025-06-15T12:15:00Z"
}
{
"error": {
"code": "not_found",
"message": "Device not found"
}
}
Devices
Create WiFi Config Grant
Create a stateless grant for configuring WiFi credentials on a device via BLE
POST
/
devices
/
{id}
/
wifi-config
/
grant
curl -X POST https://api.bota.dev/v1/devices/dev_abc123/wifi-config/grant \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"expires_in_seconds": 900
}'
const response = await fetch('https://api.bota.dev/v1/devices/dev_abc123/wifi-config/grant', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk_live_...',
'Content-Type': 'application/json',
},
body: JSON.stringify({
expires_in_seconds: 900,
}),
});
const grant = await response.json();
// Send grant.grant_blob to device via BLE
import requests
response = requests.post(
'https://api.bota.dev/v1/devices/dev_abc123/wifi-config/grant',
headers={
'Authorization': 'Bearer sk_live_...',
'Content-Type': 'application/json',
},
json={
'expires_in_seconds': 900,
},
)
grant = response.json()
# Send grant['grant_blob'] to device via BLE
{
"grant_blob": "eyJhbGciOiJIUzI1NiIs...",
"expires_at": "2025-06-15T12:15:00Z"
}
{
"error": {
"code": "not_found",
"message": "Device not found"
}
}
Create a short-lived WiFi configuration grant that authorizes the companion app
to configure the device over BLE.
The SSID and password travel from the app to the device through the mobile SDK;
they are not sent to or stored by the Bota backend. The grant authorizes the
write but is not itself an encryption envelope.
Authentication
Requires an API key withdevices:write scope.
curl -X POST https://api.bota.dev/v1/devices/dev_abc123/wifi-config/grant \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"expires_in_seconds": 900
}'
const response = await fetch('https://api.bota.dev/v1/devices/dev_abc123/wifi-config/grant', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk_live_...',
'Content-Type': 'application/json',
},
body: JSON.stringify({
expires_in_seconds: 900,
}),
});
const grant = await response.json();
// Send grant.grant_blob to device via BLE
import requests
response = requests.post(
'https://api.bota.dev/v1/devices/dev_abc123/wifi-config/grant',
headers={
'Authorization': 'Bearer sk_live_...',
'Content-Type': 'application/json',
},
json={
'expires_in_seconds': 900,
},
)
grant = response.json()
# Send grant['grant_blob'] to device via BLE
Path Parameters
string
required
The device’s unique identifier (e.g.,
dev_abc123).Request Body
integer
default:900
How long the grant is valid, in seconds. Minimum 60 (1 minute), maximum 3600 (1 hour). Default is 900 (15 minutes).
Response
Returns the grant blob and its expiration timestamp.{
"grant_blob": "eyJhbGciOiJIUzI1NiIs...",
"expires_at": "2025-06-15T12:15:00Z"
}
{
"error": {
"code": "not_found",
"message": "Device not found"
}
}
Response Fields
| Field | Type | Description |
|---|---|---|
grant_blob | string | Signed grant token to pass to device via Bluetooth |
expires_at | string | Grant expiration timestamp (ISO 8601) |
Usage Flow
- App scans for WiFi networks — the SDK provides
scanNetworks()(Android) andgetCurrentSSID()(both platforms) so users can pick a network - App requests grant from your backend (this endpoint)
- App writes
grant_blobto the device’s Bluetooth WiFi Grant characteristic - App passes the SSID and password to the SDK
- SDK writes the release-compatible credential packet to the device
- Device connects to WiFi and reports status via the Bluetooth WiFi Status characteristic
scanNetworks() for step 1 and handles steps 3-6 automatically via BotaClient.devices.configureWiFi().
Request a fresh grant for each WiFi configuration attempt. Do not implement raw
GATT writes: the application-layer packet format is an SDK/firmware compatibility
contract and may change between releases.
Was this page helpful?

