Skip to content

Data API

Query historical data and push data points via the REST API.

Retrieve telemetry data from a device.

GET /v1/devices/:id/data
ParameterTypeDescription
fromstringStart time (ISO 8601)
tostringEnd time (ISO 8601)
fieldsstringComma-separated field names
aggregationstringavg, min, max, sum, count
intervalstring1m, 5m, 1h, 1d
limitnumberMax data points (default: 1000)
Terminal window
curl -X GET "https://api.siliconwit.io/v1/devices/dev_abc123/data?\
from=2024-01-01T00:00:00Z&\
to=2024-01-02T00:00:00Z&\
fields=temperature,humidity&\
aggregation=avg&\
interval=1h" \
-H "Authorization: Bearer YOUR_API_KEY"
{
"success": true,
"data": {
"device_id": "dev_abc123",
"from": "2024-01-01T00:00:00Z",
"to": "2024-01-02T00:00:00Z",
"aggregation": "avg",
"interval": "1h",
"points": [
{
"timestamp": "2024-01-01T00:00:00Z",
"temperature": 24.5,
"humidity": 55
},
{
"timestamp": "2024-01-01T01:00:00Z",
"temperature": 24.2,
"humidity": 56
},
{
"timestamp": "2024-01-01T02:00:00Z",
"temperature": 23.8,
"humidity": 58
}
]
}
}

Get the most recent data point.

GET /v1/devices/:id/data/latest
Terminal window
curl -X GET "https://api.siliconwit.io/v1/devices/dev_abc123/data/latest" \
-H "Authorization: Bearer YOUR_API_KEY"
{
"success": true,
"data": {
"timestamp": "2024-01-15T14:30:00Z",
"temperature": 25.5,
"humidity": 60,
"battery": 85
}
}

Send data via REST API (alternative to MQTT).

POST /v1/devices/:id/data
FieldTypeRequiredDescription
timestampstringNoISO 8601 timestamp (default: now)
*anyYesData fields
Terminal window
curl -X POST "https://api.siliconwit.io/v1/devices/dev_abc123/data" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"temperature": 25.5,
"humidity": 60,
"battery": 85
}'
{
"success": true,
"data": {
"id": "dp_abc123",
"timestamp": "2024-01-15T14:35:00Z",
"received": true
}
}

Send multiple data points at once.

POST /v1/devices/:id/data/batch
{
"points": [
{
"timestamp": "2024-01-15T14:30:00Z",
"temperature": 25.5
},
{
"timestamp": "2024-01-15T14:31:00Z",
"temperature": 25.6
},
{
"timestamp": "2024-01-15T14:32:00Z",
"temperature": 25.4
}
]
}
Terminal window
curl -X POST "https://api.siliconwit.io/v1/devices/dev_abc123/data/batch" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"points": [
{"timestamp": "2024-01-15T14:30:00Z", "temperature": 25.5},
{"timestamp": "2024-01-15T14:31:00Z", "temperature": 25.6}
]
}'
{
"success": true,
"data": {
"received": 2,
"failed": 0
}
}

Export data in various formats.

GET /v1/devices/:id/data/export
ParameterTypeDescription
fromstringStart time (ISO 8601)
tostringEnd time (ISO 8601)
formatstringcsv, json, xlsx
Terminal window
curl -X GET "https://api.siliconwit.io/v1/devices/dev_abc123/data/export?\
from=2024-01-01&to=2024-01-31&format=csv" \
-H "Authorization: Bearer YOUR_API_KEY" \
-o data.csv
FunctionDescription
avgAverage value
minMinimum value
maxMaximum value
sumSum of values
countNumber of points
firstFirst value
lastLast value
IntervalDescription
1m1 minute
5m5 minutes
15m15 minutes
1h1 hour
6h6 hours
1d1 day
1w1 week
PlanRetention
Starter7 days
Business90 days
EnterpriseCustom

Data older than retention period is automatically deleted.

CodeDescription
INVALID_TIME_RANGEfrom must be before to
TIME_RANGE_TOO_LARGEMax range is 1 year
INVALID_AGGREGATIONUnknown aggregation function
DATA_NOT_FOUNDNo data in time range