ThingsBoard icon

ThingsBoard

Interact with ThingsBoard REST API

Telemetry → Delete Entity Timeseries

AI-generated

Summary

Deletes time series data for specified keys from an entity in ThingsBoard, optionally filtering by time range.

Inputs

  • authentication — Method for accessing the ThingsBoard API (API Key or Username/Password). Defaults to API Key.
  • entityId (required) — The ID of the entity (e.g., a device) to delete telemetry from. Expects a UUID string.
  • entityType — Type of the entity (e.g., DEVICE). Defaults to 'DEVICE'.
  • timeseriesKeys (required) — Comma-separated list of timeseries keys to delete data for.
  • deleteAllDataForKeys — If true, deletes all historical data for the specified keys. If false, only data within the specified time range is deleted. Defaults to false.
  • deleteStartTs — Start timestamp in milliseconds (UTC) for the time range. Required when deleteAllDataForKeys is false.
  • deleteEndTs — End timestamp in milliseconds (UTC) for the time range. Required when deleteAllDataForKeys is false.
  • deleteLatest — If true, deletes the latest telemetry value if its timestamp falls within the time range. Defaults to true.
  • rewriteLatestIfDeleted — If true and the latest value was deleted, it is rewritten with the most recent value that existed before the time range. Defaults to false.

Output shape

No body — returns a status object indicating success.

The operation returns a JSON object { status: 'Entity timeseries deleted successfully' } or an error if the API request fails.

Examples

Example 1: Delete all historical data for a specific key from a device.

Entity ID: device-uuid, Timeseries Keys: temperature, Delete All Data For Keys: true

Example 2: Remove telemetry data older than 30 days for a device.

Entity ID: device-uuid, Timeseries Keys: voltage, Start Timestamp: 1704067200000, End Timestamp: 1735689599999, Delete All Data For Keys: false

Example 3: Clean up old telemetry and preserve the latest value.

Entity ID: device-uuid, Timeseries Keys: humidity, Start Timestamp: 1609459200000, End Timestamp: 1672531199999, Delete Latest: false, Rewrite Latest If Deleted: true

Links

Discussion