---
title: "PII Redaction Methods"
url: https://develop.sentry.dev/backend/application-domains/pii/methods/
---

# PII Redaction Methods

* `remove`

  Remove the entire field. Relay may choose to either set it to `null` or toremove it entirely.

```json
{
  "rules": {
    "remove_ip": {
      "type": "ip",
      "redaction": {
        "method": "remove"
      }
    }
  },
  "applications": {
    "$string": ["remove_ip"]
  }
}
```

* `replace`

  Replace the key with a static string.

```json
{
  "rules": {
    "replace_ip": {
      "type": "ip",
      "redaction": {
        "method": "replace",
        "text": [censored]"
      }
    }
  },
  "applications": {
    "$string": ["replace_ip"]
  }
}
```

### [`mask`](https://develop.sentry.dev/backend/application-domains/pii/methods.md#mask)

: Replace every character of the matched string with a "masking" char `*`. Compared to `replace` this preserves the length of the original string.

```javascript
{
  "rules": {
    "mask_ip": {
      "type": "ip",
      "redaction": {
        "method": "mask"
      }
    }
  },
  "applications": {
    "$string": ["mask_ip"]
  }
}
```

### [`hash`](https://develop.sentry.dev/backend/application-domains/pii/methods.md#hash)

: Replace the string with a hashed version of itself. Equal strings will produce the same hash, so if you, for example, decide to hash the user ID instead of replacing or removing it, you will still have an accurate count of users affected.

```javascript
{
  "rules": {
    "hash_ip": {
      "type": "ip",
      "redaction": {
        "method": "hash"
      }
    }
  }
  "applications": {
    "$string": ["mask_ip"]
  }
}
```
