> ## Documentation Index
> Fetch the complete documentation index at: https://docs.falkordb.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> FalkorDB is a graph database that speaks the Redis protocol. Queries are issued as OpenCypher through the GRAPH.QUERY and GRAPH.RO_QUERY commands, not over Bolt or a SQL connection.
> FalkorDB implements a subset of OpenCypher with proprietary extensions. Do not assume Neo4j-only syntax or procedures are available — check /cypher/cypher-support and /cypher/known-limitations before using a clause.
> FalkorDB is the successor to RedisGraph, but they are separate products. Do not present RedisGraph commands, versions, or limitations as current FalkorDB behavior.
> Use the official clients listed in /getting-started/clients rather than generic Redis or Neo4j drivers, and prefer the language the user is already working in.
> Configuration parameters are set with GRAPH.CONFIG SET or at startup; cite the exact parameter name from /getting-started/configuration rather than inventing one.
> This site covers four products: FalkorDB (core), FalkorDB Cloud, FalkorDB Enterprise, and the GraphRAG SDK. Name which one an answer applies to, since setup and operations differ.

# map.removeKeys

> Returns a copy of a map with multiple specified keys removed.

## Description

Creates a new map with multiple specified keys removed. The original map is not modified.

## Syntax

```cypher theme={null}
flex.map.removeKeys(map, keys)
```

## Parameters

| Parameter | Type | Required | Description                     |
| --------- | ---- | -------- | ------------------------------- |
| `map`     | map  | Yes      | The map to remove keys from     |
| `keys`    | list | Yes      | An array of key names to remove |

## Returns

**Type:** map (object)

A new map containing all properties from the input map except the specified keys. Returns an empty map if input is not a valid object.

## Examples

### Example 1: Basic Multiple Key Removal

```cypher theme={null}
WITH {name: 'Alice', age: 30, email: 'alice@example.com', password: 'secret'} AS user
RETURN flex.map.removeKeys(user, ['password', 'email']) AS sanitized
```

**Output:**

```text theme={null}
sanitized
-----------------------
{name: 'Alice', age: 30}
```

### Example 2: Removing Internal Fields

```cypher theme={null}
MATCH (p:Product)
WITH properties(p) AS props
RETURN flex.map.removeKeys(props, ['internalId', 'createdBy', 'updatedAt']) AS public
```

### Example 3: Filtering Node Properties for API Response

```cypher theme={null}
MATCH (u:User {id: $userId})
WITH properties(u) AS allProps
WITH flex.map.removeKeys(allProps, ['password', 'salt', 'resetToken']) AS safeProps
RETURN safeProps AS user
```

### Example 4: Removing Non-Existent Keys

```cypher theme={null}
WITH {a: 1, b: 2, c: 3} AS map
RETURN flex.map.removeKeys(map, ['d', 'e']) AS result
```

**Output:**

```text theme={null}
result
-----------------
{a: 1, b: 2, c: 3}
```

(Non-existent keys are ignored)

## Notes

* Returns empty map if input is not a valid object or is `null`
* `null` values in the keys array are ignored
* Keys that don't exist in the map are silently ignored
* Creates a new map; does not modify the original
* More efficient than calling `removeKey` multiple times
* Useful for bulk removal of sensitive or internal fields

## See Also

* [map.removeKey](/udfs/flex/map/removeKey) - Remove a single key
* [map.submap](/udfs/flex/map/submap) - Keep only specific keys (inverse operation)
* [map.merge](/udfs/flex/map/merge) - Combine multiple maps

## Frequently Asked Questions

<AccordionGroup>
  <Accordion title="How does flex.map.removeKeys differ from removeKey?">
    `removeKeys` accepts a **list** of keys to remove in a single call, while `removeKey` removes only one key at a time.
  </Accordion>

  <Accordion title="What happens if some keys in the list do not exist?">
    Non-existent keys are silently ignored. Only keys present in the map are removed from the result.
  </Accordion>
</AccordionGroup>
