Skip to content

Cookie preferences

We use cookies for our own analytics, to see how our campaigns perform and, if you allow it, to load content from other services such as the Google site search. We never sell your data. Necessary cookies keep the site working and cannot be switched off. See our Cookie Policy for details and our Privacy Policy for how we handle personal data.

Security, load balancing and remembering your cookie choice.

Show us which pages people read, how they find the site and where they get stuck, so we can improve it (Google Analytics, Microsoft Clarity).

Show us which of our ad campaigns bring visitors to the site and remember the campaign or partner link you arrived from (Google Ads, LinkedIn, Meta, partner program). We do not use these cookies to build advertising profiles.

Load the site search from Google when you use it. Google sets its own cookies and shows ads in the search results.

© 2026 The ThingsBoard Authors
22.5k Try for free

ThingsBoard Cloud

Choose your data region

Your data stays in the region you choose, for residency and compliance. No credit card required.

Rather run it yourself? Install on your own servers

Delete Key-Value Pairs

Use this node to strip internal or sensitive fields from a message before forwarding it to external systems, or to clean up temporary keys added by upstream enrichment nodes. Java regular expressions let you remove entire groups of keys (e.g., all temp_* fields) with a single pattern.

  • Delete key-values from — required. Where to delete keys:
    • Message — deletes from message data.
    • Metadata — deletes from message metadata.
  • Keys — a set of key names or Java regular expression patterns. Keys not present in the source are silently ignored.
  1. Determine the deletion target (message data or metadata).
  2. For each source key, check whether it matches any configured pattern.
  3. Remove all matching key–value pairs.
  4. If at least one key was removed, forward the updated message via Success. Otherwise forward unchanged.
  5. On unexpected error, route via Failure.
Connection Condition
Success Processing completed (including when no keys were deleted).
Failure An unexpected error occurred.

Example 1 — Delete specific keys from data

Section titled “Example 1 — Delete specific keys from data”
{ "deleteFrom": "DATA", "keys": ["internal_id", "deviceName"] }

Incoming data: { "temperature": 25.4, "humidity": 62, "internal_id": "xyz-123", "deviceName": "Sensor-A1" }

Outgoing data: { "temperature": 25.4, "humidity": 62 }


{ "deleteFrom": "METADATA", "keys": ["rssi", "snr"] }

Incoming metadata: { "deviceType": "Thermostat", "location": "Floor 1", "rssi": "-56", "snr": "12.1" }

Outgoing metadata: { "deviceType": "Thermostat", "location": "Floor 1" }


Example 3 — Regex pattern deletes multiple keys

Section titled “Example 3 — Regex pattern deletes multiple keys”
{ "deleteFrom": "DATA", "keys": ["temp_.*"] }

Incoming data: { "temp_main": 33.1, "humidity": 45, "pressure": 1012, "temp_ambient": 21.5 }

Outgoing data: { "humidity": 45, "pressure": 1012 } — both temp_* keys removed.


Example 4 — No matching keys — message passes unchanged

Section titled “Example 4 — No matching keys — message passes unchanged”
{ "deleteFrom": "DATA", "keys": ["pressure"] }

Incoming data: { "temperature": 22.5, "humidity": 55 } — pressure doesn’t exist.

Outgoing data: unchanged. Routes via Success.

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "TbDeleteKeysNodeConfiguration",
"type": "object",
"required": ["deleteFrom", "keys"],
"additionalProperties": false,
"properties": {
"deleteFrom": {
"type": "string",
"enum": ["DATA", "METADATA"],
"description": "Where to delete: DATA = message data, METADATA = message metadata."
},
"keys": {
"type": "array",
"items": { "type": "string" },
"description": "Key names or Java regex patterns to delete."
}
}
}