Sensor information¶
A sensor reports a single numeric value (temperature, humidity, level, ...). See API usage information for authentication and the response envelope.
Add sensor¶
/add/sensorCreates a new sensor for the logged-in user and returns its id and token.
Request¶
Auth: api_key (query param or cookie) · Content-type: application/x-www-form-urlencoded
Request body:
Send the fields as form data.
| Field name | Description | Type |
|---|---|---|
sensor_name |
Name of the sensor | str |
sensor_type |
Free-text sensor type, e.g. Temperature |
str |
update_period |
Expected seconds between updates; used to decide Online/Offline |
int |
sensor_token |
[Optional] Token used to authenticate updates. Generated when omitted | str |
sensor_value |
[Optional] Initial value. Default 0 |
int |
sensor_status |
[Optional] Initial status. Default Online |
str |
sensor_details |
[Optional] JSON string stored with the sensor. Default {} |
json |
last_modified |
[Optional] Initial last-update time (epoch seconds). Default: now | int |
Request example:
https://spoilerinterface.com/interface/add/sensor?api_key=3b9e1f0c7a5d4e2f8a6b0c1d
Form data:
Response¶
{
"success": {
"sensor_id": 231659085216623,
"sensor_token": "9f2c4e7a1b3d5f60718293a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2"
}
}
Field description¶
| Field name | Description | Type |
|---|---|---|
sensor_id |
Generated sensor id. Use it with the token to push updates | int |
sensor_token |
The supplied token, or a generated 100-character hex token | str |
Fails with Maximum number of devices reached. Please upgrade your account. when the account's device limit is reached.
Sensor count¶
/sensor/countReturns the number of sensors owned by the user.
Request¶
Auth: api_key (query param or cookie)
Request body:
None
Request example:
https://spoilerinterface.com/interface/sensor/count?api_key=3b9e1f0c7a5d4e2f8a6b0c1d
Response¶
List sensors¶
/sensor/listLists every sensor owned by the user, with its token and current status.
Request¶
Auth: api_key (query param or cookie)
Request body:
None
Request example:
https://spoilerinterface.com/interface/sensor/list?api_key=3b9e1f0c7a5d4e2f8a6b0c1d
Response¶
{
"success": [
{
"sensor_id": 231659085216623,
"sensor_name": "Cold room",
"sensor_type": "Temperature",
"sensor_details": "{}",
"update_time": 1763025300,
"sensor_status": "Online",
"sensor_value": 4.5,
"sensor_token": "9f2c4e7a1b3d5f60718293a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2",
"update_period": 300,
"last_modified": 1763025300,
"notification_enabled": true,
"alarms": [
{
"alarm_id": 1675276699283,
"device_id": 231659085216623,
"alarm_name": "High value",
"alarm_enabled": true,
"alarm_threshold_value": 30.0,
"alarm_condition": ">",
"alarm_trigger_time": null,
"alarm_repeat_delay": 300,
"alarm_akn": null,
"update_time": 1675276699,
"alarm_triggered": false,
"condition_parameter": null
}
],
"whatsapp_enabled": null,
"value_units": "C",
"sms_enabled": null,
"notification_users": []
}
]
}
Field description¶
| Field name | Description | Type |
|---|---|---|
sensor_id |
Sensor id | int |
sensor_name |
Sensor name | str |
sensor_type |
Sensor type | str |
sensor_details |
Details JSON as stored | json |
update_time |
Same value as last_modified |
int |
sensor_status |
Online or Offline |
str |
sensor_value |
Latest value | float |
sensor_token |
Sensor token | str |
update_period |
Expected seconds between updates. The device is reported Offline when no update arrives within this period |
int |
last_modified |
Epoch time (seconds) of the last update, shifted by the account's time_offset (minutes) |
int |
notification_enabled |
Email status notifications enabled. null in the database is reported as true by /status and /list |
bool |
alarms |
Alarms configured for the device | arr |
whatsapp_enabled |
WhatsApp notifications enabled (may be null) |
bool |
value_units |
Display units (empty string when not set) | str |
sms_enabled |
SMS notifications enabled (may be null) |
bool |
notification_users |
Extra notification recipients (see /edit) |
arr |
sensor_status is recalculated on every request: Online when the last update is within update_period seconds, otherwise Offline.
Sensor status¶
/sensor/statusReturns the current status of a single sensor. Authenticated with the device id and token.
Request¶
Auth: Device id + token (no api_key) · Content-type: application/json (only when sending a JSON body)
Request body:
Send as query parameters or a JSON body.
| Field name | Description | Type |
|---|---|---|
sensor_id |
Sensor id | int |
sensor_token |
Sensor token | str |
Request example:
Params:
https://spoilerinterface.com/interface/sensor/status?sensor_id=231659085216623&sensor_token=9f2c4e7a1b3d5f60718293a4
JSON body:
Response¶
{
"success": {
"sensor_id": 231659085216623,
"sensor_status": "Online",
"sensor_value": 4.5,
"sensor_details": "{}",
"update_period": 300,
"last_modified": 1763025300,
"notification_enabled": true,
"value_units": "C",
"alarms": [
{
"alarm_id": 1675276699283,
"device_id": 231659085216623,
"alarm_name": "High value",
"alarm_enabled": true,
"alarm_threshold_value": 30.0,
"alarm_condition": ">",
"alarm_trigger_time": null,
"alarm_repeat_delay": 300,
"alarm_akn": null,
"update_time": 1675276699,
"alarm_triggered": false,
"condition_parameter": null
}
],
"notification_users": null
}
}
Field description¶
| Field name | Description | Type |
|---|---|---|
sensor_id |
Sensor id | int |
sensor_status |
Online or Offline |
str |
sensor_value |
Latest value | float |
sensor_details |
Details JSON as stored | json |
update_period |
Expected seconds between updates. The device is reported Offline when no update arrives within this period |
int |
last_modified |
Epoch time (seconds) of the last update, shifted by the account's time_offset (minutes) |
int |
notification_enabled |
Email status notifications enabled. null in the database is reported as true by /status and /list |
bool |
value_units |
Display units (empty string when not set) | str |
alarms |
Alarms configured for the device | arr |
notification_users |
Extra notification recipients (see /edit) |
arr |
Update sensor¶
/update/sensorPushes a new sensor value. The value is stored in the history and becomes the current value.
Request¶
Auth: Device id + token (no api_key) · Content-type: application/json (only when sending a JSON body)
Request body:
Send as query parameters or a JSON body (query parameters win when both are present).
| Field name | Description | Type |
|---|---|---|
sensor_id |
Sensor id | int |
sensor_token |
Sensor token | str |
sensor_value |
New value | float |
sensor_details |
[Optional] JSON object as a string, e.g. "{\"battery\": 87}" (single quotes are converted to double quotes). Default {}. Stored in the history record only |
json |
epoch_time |
[Optional] Measurement time (epoch seconds). Default: server time. Stored as last_modified |
int |
Request example:
Params:
https://spoilerinterface.com/interface/update/sensor?sensor_id=231659085216623&sensor_token=9f2c4e7a1b3d5f60718293a4&sensor_value=4.5
JSON body:
{
"sensor_id": 231659085216623,
"sensor_token": "9f2c4e7a1b3d5f60718293a4",
"sensor_value": 4.5,
"sensor_details": "{\"battery\": 87}",
"epoch_time": 1763025300
}
Response¶
Updates are rate limited by the owner's account type (account type 1 or unset: 59 s, types 2-4: 30 s, type 5 and above: 1 s between updates, measured against the previous last_modified). A blocked update returns HTTP 400:
{
"failed": {
"message": "Please wait for the update period to lapse. Remaining time is: 21",
"remaining_time_sec": 21
}
}
Sensor history¶
/sensor/historyReturns the recorded history of the user's sensors, oldest record first.
Request¶
Auth: api_key (query param or cookie) · Content-type: application/json
Request body:
Send the filters as a JSON body. A body is required, even if it is only {} (without one the request fails). limit and offset may also be sent as query parameters, but min_epoch_tm_sec, max_epoch_tm_sec and device_id are only read from the JSON body.
| Field name | Description | Type |
|---|---|---|
min_epoch_tm_sec |
[Optional] Start of the window (epoch seconds). Default: now minus 2 days (172800 s) | float |
max_epoch_tm_sec |
[Optional] End of the window (epoch seconds). Default: now | float |
device_id |
[Optional] Return only this sensor (must belong to the user, otherwise Invalid device_id). Default: all of the user's sensors |
int |
limit |
[Optional] Maximum records per device. Default and maximum: 20000 | int |
offset |
[Optional] Records to skip per device (for paging). Default: 0 | int |
Request example:
https://spoilerinterface.com/interface/sensor/history?api_key=3b9e1f0c7a5d4e2f8a6b0c1d
JSON body:
{
"min_epoch_tm_sec": 1762992000,
"max_epoch_tm_sec": 1763078400,
"device_id": 231659085216623,
"limit": 1000,
"offset": 0
}
Response¶
{
"success": [
{
"sensor_id": 231659085216623,
"sensor_name": "Cold room",
"sensor_type": "Temperature",
"min_time": 1700000000,
"max_time": 1763025300,
"data": [
{
"sensor_value": 4.5,
"update_time": "2026-11-13T09:15:00"
}
]
}
]
}
Field description¶
| Field name | Description | Type |
|---|---|---|
sensor_id |
Sensor id | int |
sensor_name |
Sensor name | str |
sensor_type |
Sensor type | str |
min_time |
Earliest last_modified across all of the user's history records of this type (not only the requested window), plus the account's time_offset |
int |
max_time |
Latest last_modified across all of the user's history records of this type, plus the account's time_offset |
int |
data |
History records in the requested window | arr |
has_more |
Present (true) only when the device returned 20000 records; request the next page with offset |
bool |
Each data item:
| Field name | Description | Type |
|---|---|---|
sensor_value |
Recorded value | float |
update_time |
Record time as an ISO date-time string, shifted by the account's time_offset |
str |
Edit sensor¶
/edit/sensorChanges the name, token, update period, display units or notification recipients of a sensor owned by the user.
Request¶
Auth: api_key (query param or cookie) · Content-type: application/json (only when sending a JSON body)
Request body:
Send as query parameters or a JSON body (query parameters win).
| Field name | Description | Type |
|---|---|---|
sensor_id |
Sensor id (must belong to the user) | int |
sensor_name |
[Optional] New name | str |
sensor_token |
[Optional] New token. Devices must use the new token afterwards | str |
update_period |
[Optional] New update period (seconds) | int |
value_units |
[Optional] Display units. Reset to an empty string when omitted | str |
notification_users |
[Optional] JSON string holding an array of extra notification recipients. Each item: email (required), name, status_alerts, threshold_alerts, sms_alerts, whatsapp_alerts (booleans) and mobile_number (required, + and country code, when sms_alerts or whatsapp_alerts is true). Omit it to keep the current list |
json |
Request example:
https://spoilerinterface.com/interface/edit/sensor?api_key=3b9e1f0c7a5d4e2f8a6b0c1d
JSON body:
{
"sensor_id": 231659085216623,
"sensor_name": "Cold room",
"update_period": 300,
"value_units": "C",
"notification_users": "[{\"name\": \"Jane Doe\", \"email\": \"jane@example.com\", \"status_alerts\": true, \"threshold_alerts\": false, \"sms_alerts\": false, \"whatsapp_alerts\": false}]"
}
Response¶
Fails with Not allowed... when the device belongs to another user, and with Validation error in notification_users: ... when notification_users is invalid.
Delete sensor¶
/delete/sensorDeletes a sensor and all of its history records.
Request¶
Auth: api_key (query param or cookie) · Content-type: application/x-www-form-urlencoded
Request body:
Send the fields as form data.
| Field name | Description | Type |
|---|---|---|
sensor_id |
Sensor id | int |
sensor_token |
Sensor token | str |
Request example:
https://spoilerinterface.com/interface/delete/sensor?api_key=3b9e1f0c7a5d4e2f8a6b0c1d
Form data:
Response¶
Only the owner can delete a device (Not allowed otherwise).
Notification settings¶
/notifications/{device_type}/{alert_type}/{action}Enables or disables email, WhatsApp or SMS notifications for one sensor. Replaces the old per-type enable/disable endpoints.
Request¶
Auth: api_key (query param or cookie) and device id + token · Content-type: application/json (only when sending a JSON body)
Request body:
device_type is sensor. alert_type is alerts (email status notifications, notification_enabled), whatsapp (whatsapp_enabled) or sms (sms_enabled). action is enable or disable.
Send the device credentials as query parameters or a JSON body.
| Field name | Description | Type |
|---|---|---|
device_id |
Sensor id | int |
device_token |
Sensor token | str |
URLs for this device type:
https://spoilerinterface.com/interface/notifications/sensor/alerts/enablehttps://spoilerinterface.com/interface/notifications/sensor/alerts/disablehttps://spoilerinterface.com/interface/notifications/sensor/whatsapp/enablehttps://spoilerinterface.com/interface/notifications/sensor/whatsapp/disablehttps://spoilerinterface.com/interface/notifications/sensor/sms/enablehttps://spoilerinterface.com/interface/notifications/sensor/sms/disable
Request example:
https://spoilerinterface.com/interface/notifications/sensor/alerts/disable?api_key=3b9e1f0c7a5d4e2f8a6b0c1d&device_id=231659085216623&device_token=9f2c4e7a1b3d5f60718293a4
JSON body (with ?api_key= in the URL or the cookie):
Response¶
The change is logged in the notification history (e.g. Notifications disabled). See Notifications for details and error messages.