Skip to content

Devices API

Manage your IoT devices programmatically.

Get all devices for your account.

GET /v1/devices
ParameterTypeDescription
pagenumberPage number (default: 1)
limitnumberItems per page (default: 20, max: 100)
typestringFilter by device type
statusstringFilter by status (online, offline, inactive)
searchstringSearch by name
Terminal window
curl -X GET "https://api.siliconwit.io/v1/devices?status=online" \
-H "Authorization: Bearer YOUR_API_KEY"
{
"success": true,
"data": [
{
"id": "dev_abc123",
"name": "Office Sensor",
"type": "temperature",
"status": "online",
"last_seen": "2024-01-15T14:30:00Z",
"created_at": "2024-01-01T00:00:00Z"
},
{
"id": "dev_def456",
"name": "Warehouse Tracker",
"type": "gps",
"status": "online",
"last_seen": "2024-01-15T14:29:00Z",
"created_at": "2024-01-05T00:00:00Z"
}
],
"pagination": {
"page": 1,
"limit": 20,
"total": 2,
"pages": 1
}
}

Retrieve a single device by ID.

GET /v1/devices/:id
Terminal window
curl -X GET "https://api.siliconwit.io/v1/devices/dev_abc123" \
-H "Authorization: Bearer YOUR_API_KEY"
{
"success": true,
"data": {
"id": "dev_abc123",
"name": "Office Sensor",
"type": "temperature",
"description": "Main office temperature monitor",
"status": "online",
"last_seen": "2024-01-15T14:30:00Z",
"last_data": {
"temperature": 25.5,
"humidity": 60
},
"settings": {
"report_interval": 60,
"offline_threshold": 300
},
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-15T14:30:00Z"
}
}

Register a new device.

POST /v1/devices
FieldTypeRequiredDescription
namestringYesDevice name
typestringYesDevice type
descriptionstringNoOptional description
settingsobjectNoDevice settings
Terminal window
curl -X POST "https://api.siliconwit.io/v1/devices" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "New Sensor",
"type": "temperature",
"description": "Kitchen temperature sensor"
}'
{
"success": true,
"data": {
"id": "dev_xyz789",
"name": "New Sensor",
"type": "temperature",
"description": "Kitchen temperature sensor",
"status": "inactive",
"access_token": "tok_xxxxxxxxxxxxxxxxxxxxxxxx",
"created_at": "2024-01-15T15:00:00Z"
}
}

Update device properties.

PUT /v1/devices/:id
FieldTypeDescription
namestringDevice name
descriptionstringDescription
settingsobjectDevice settings
Terminal window
curl -X PUT "https://api.siliconwit.io/v1/devices/dev_abc123" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Office Sensor (Main)",
"settings": {
"report_interval": 30
}
}'
{
"success": true,
"data": {
"id": "dev_abc123",
"name": "Office Sensor (Main)",
"type": "temperature",
"settings": {
"report_interval": 30,
"offline_threshold": 300
},
"updated_at": "2024-01-15T15:05:00Z"
}
}

Remove a device permanently.

DELETE /v1/devices/:id
Terminal window
curl -X DELETE "https://api.siliconwit.io/v1/devices/dev_abc123" \
-H "Authorization: Bearer YOUR_API_KEY"
{
"success": true,
"message": "Device deleted successfully"
}

Deleting a device also removes all associated data. This cannot be undone.

Generate a new access token for a device.

POST /v1/devices/:id/token
Terminal window
curl -X POST "https://api.siliconwit.io/v1/devices/dev_abc123/token" \
-H "Authorization: Bearer YOUR_API_KEY"
{
"success": true,
"data": {
"access_token": "tok_newxxxxxxxxxxxxxxxx"
}
}

Send a command to a connected device.

POST /v1/devices/:id/commands
FieldTypeRequiredDescription
commandstringYesCommand name
paramsobjectNoCommand parameters
Terminal window
curl -X POST "https://api.siliconwit.io/v1/devices/dev_abc123/commands" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"command": "set_interval",
"params": {
"seconds": 60
}
}'
{
"success": true,
"data": {
"command_id": "cmd_abc123",
"status": "sent",
"sent_at": "2024-01-15T15:10:00Z"
}
}

Common device types:

TypeDescription
temperatureTemperature sensors
humidityHumidity sensors
gpsGPS trackers
motionMotion detectors
doorDoor/window sensors
powerPower monitors
customCustom devices
CodeDescription
DEVICE_NOT_FOUNDDevice ID doesn’t exist
DEVICE_LIMIT_REACHEDPlan device limit exceeded
INVALID_DEVICE_TYPEUnknown device type
TOKEN_GENERATION_FAILEDCould not generate token