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

# Remove keys by accessor

> Removes certain parts of the context data based on accessors.

export const FormField = ({property, label, required = false, diType, uiPatterns, children}) => {
  const patterns = Array.isArray(uiPatterns) ? uiPatterns : uiPatterns ? [uiPatterns] : [];
  return <div style={{
    margin: '1.5rem 0'
  }}>
      <div style={{
    display: 'flex',
    alignItems: 'baseline',
    flexWrap: 'wrap',
    gap: '0.5rem',
    marginBottom: '0.25rem'
  }}>
        <strong>{label}</strong>
        <span style={{
    fontSize: '0.7rem',
    fontWeight: 600,
    textTransform: 'uppercase',
    letterSpacing: '0.04em',
    color: required ? '#6241f5' : '#6b7280'
  }}>
          {required ? 'Required' : 'Optional'}
        </span>
      </div>

      <div>{children}</div>

      {diType || patterns.length > 0 ? <p style={{
    fontSize: '0.85rem',
    color: '#6b7280',
    marginBottom: 0
  }}>
          {diType ? <>
              See the <a href={`/references/${diType}`}>{diType}</a> reference.{' '}
            </> : null}
          {patterns.length > 0 ? <>
              Accepts a <a href={`/documentation/placeholders-and-patterns/patterns#${patterns[0]}`}>pattern</a>.
            </> : null}
        </p> : null}
    </div>;
};

Removes fields from your data. You point at the part you want to clean up with an accessor, and the transformer deletes the keys it finds there. You can optionally add one or more checks that each key name must pass before it is removed, so you can target only certain fields instead of all of them. Use this to strip out helper fields, internal notes, or anything the receiving system should not see.

This documentation describes: [Schema](/schemas/transformer/key-filter)

## Fields

<FormField property="accessor" label="Accessor" required diType="accessor">
  Selects which part of the data to look at and which keys are candidates for removal. See [Accessors](/references/accessor) for the available options.
</FormField>

<FormField property="conditions" label="Conditions" diType="condition">
  An optional list of checks applied to each key name the accessor finds. A key is only removed when it passes every check in the list, so you can keep most fields and remove just the ones that match. Leave it empty to remove every key the accessor selects. See [Conditions](/references/condition) for the available checks.
</FormField>

## Sample data

| Field      | Value                                              |
| ---------- | -------------------------------------------------- |
| Accessor   | Pattern accessor matching `*` (all top-level keys) |
| Conditions | Is one of: `internal_notes`, `_debug`              |

Input:

```json theme={null}
{
    "sku": "A1",
    "name": "Wool scarf",
    "internal_notes": "check stock",
    "_debug": true
}
```

Output:

```json theme={null}
{
    "sku": "A1",
    "name": "Wool scarf"
}
```

Only the keys whose names matched the check were removed; `sku` and `name` were left in place. With no conditions set, every key the accessor selects would be removed instead.

```json Configuration theme={null}
{
  "prototype": "key-filter",
  "parameters": {
    "accessor": {
      "prototype": "pattern",
      "parameters": { "pattern": "*" }
    },
    "conditions": [
      {
        "prototype": "one-of",
        "parameters": { "value": ["internal_notes", "_debug"] }
      }
    ]
  }
}
```
