# Scrub Visitor Data

You can remove personally identifiable information (PII) for any website visitors that you have identified to Rep.ai using our [Identification API](/custom-user-identities.md).

For detailed information on the endpoints used, refer to the [Organization Resource](/api-resources/organization.md) page.&#x20;

{% tabs %}
{% tab title="Example Script" %}
This script assumes Python3 and that the Python [`requests`](https://docs.python-requests.org/en/latest/) library has been installed.&#x20;

{% code title="scrub\_visitors.py" %}

```python
import requests


# Setup re-usable values
# Note: The API Key value here is a fake example, storing 
#       in code is not recommended
base_url = "https://api.rep.ai"
headers = {
    "X-Api-Key": "vMLmfTyh.uN4C-cBme8iBfHqmMSkOwdlH_gdFipxglxEdOS7pKSU",
    "Content-Type": "application/json"
}


# Get the Organization ID tied to your API Key
response = requests.get(f"{base_url}/public/api/v1/org", 
                        headers=headers)
assert response.ok

# Save the Organization ID from the response
org_id = response.json()["id"]


# Setup the Visitors we'd like to search/scrub
# Can be customId's or email addresses
visitors = ["766554", "julie@gmail.com"]

# POST request to redact the information for those two visitors
# Note: Takes a JSON body with a list of the visitor identities
url = f"{base_url}/public/api/v1/org/{org_id}/visitorscrub"
response = requests.post(url, json={"identities": visitors},
                         headers=headers)
assert response.ok

# Response body example:
# [{'customId': None,
#   'customMetadata': {'displayName': 'REDACTED'},
#   'id': '747a2bd8-d1aa-4736-beb5-1ebe142439f0',
#   'orgId': 1222456005},
#  {'customId': None,
#   'customMetadata': {'displayName': 'REDACTED'},
#   'id': 'b81085e2-ae40-4303-9050-9c38784c7454',
#   'orgId': 1222456005}]
```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.rep.ai/api/scrub-visitor-data.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
