---
title: Rename Keys
description: Rename and move keys on an item
---

Rename fields on your items, one by one or all at once with a pattern, without touching their values.

## What it does

Rename Keys changes field names on every incoming item. It has two modes:

* **Named keys**: you list each rename as **From** and **To**. Dots reach nested fields, and a dot path in **To** moves the value there. `user.firstName` to `first_name` both renames the field and lifts it to the top level.
* **Pattern**: a regular expression is run on every field name and the matched part is replaced with **Replacement**. `^data_` with an empty replacement strips that prefix from every field.

Values never change, only names and positions. A field that an item does not have is skipped, not treated as an error. Renames are worked out against the original item, so swapping `a` and `b` keeps both values.

## When to use it

* Fix one badly named field on a large scraped object without rebuilding the rest.
* Strip or change a prefix on every field, such as `data_` or `prop_`.
* Match the field names another service expects before you send data to it.
* To add, change or remove fields, use [Edit Fields](/nodes/builtin/datatransformation/editfields/). To keep only one field, use [Pick Field](/nodes/builtin/datatransformation/pickfield/).

## Inputs and settings

* **Pattern** replaces every match inside a name, not just the first. If the result would be an empty name, the field keeps its old name.
* **Apply To Nested Keys** is for Pattern mode. Off, only top-level names change. On, names at every depth change, including inside lists of objects.
* **On Collision** decides what happens when the new name already exists: *Fail* stops the run (the default, so no value is lost by accident), *Overwrite* replaces the existing value, and *Keep the existing key* skips that rename.

## Outputs

The same items with the new field names. A single incoming item comes out as a single item; a list comes out as a list of the same length.

## Dependencies and credentials

None. This node needs no connection and has no slots for other nodes.

## Example workflow

1. [HTML Extract](/nodes/builtin/datatransformation/html-extract/) returns items with fields `data_title`, `data_price` and `data_url`.
2. Rename Keys with **Mode** *Pattern*, **Pattern** `^data_` and an empty **Replacement**. The fields become `title`, `price` and `url`.
3. A second Rename Keys with **Mode** *Named keys* and one rename, **From** `url` **To** `link`, to match your sheet's column.
4. A [Google Sheets](/nodes/builtin/integration/google-sheets/) node (*Data*, *Append Values into Worksheet*) adds the items to your sheet.

## Common issues

* **"Renaming "…" to "…" would overwrite a value that is already there."** The new name is already used on the item. Pick another name, or set **On Collision** to *Overwrite* or *Keep the existing key*.
* **"Renaming "…" to "…" would overwrite a key of that name produced by another rename."** In Pattern mode, two names become the same, for example `data_id` and `id` after stripping `data_`. Make the pattern more specific, or change **On Collision**.
* **"No renames configured. Add at least one, or switch to the Pattern mode."** Named keys mode needs at least one rename with both **From** and **To** filled.
* **"The Pattern mode needs a pattern. Add one, for example ^data\_ ."** Fill **Pattern**.
* **A field did not change.** Names are case sensitive: turn on **Ignore Case** in Pattern mode, or check the spelling in **From**. For nested fields in Pattern mode, turn on **Apply To Nested Keys**.

## Related nodes

* [Edit Fields](/nodes/builtin/datatransformation/editfields/): add, change or remove fields.
* [Pick Field](/nodes/builtin/datatransformation/pickfield/): keep a single field.
* [Regex](/nodes/builtin/datatransformation/regex/): change values, not names, with a pattern.