# User Data Deletion Requests API

{% callout type="info" %}
User data deletion requests are for Enterprise contracts only. Contact the support team, your sales contact, or the [Slack community](https://statsig.com/slack) to enable Enterprise features.
Statsig currently only supports deleting data for unit type `user_id`.
{% /callout %}

GDPR and similar laws may require that you delete a user's data when they request it. To support deletion requests, Statsig provides this API.

## How to use the API

All requests must include the `STATSIG-API-KEY` field in the header. The value should be a Server API Key, which you can create in the Project Settings on console.statsig.com/api\_keys.

## Send a deletion request

Data deletion requests take the following parameters:

| Parameter | Required | Description |
| --- | --- | --- |
| `unit_type` | Yes | The unit type corresponding to the IDs you want deleted. Currently only `user_id` is supported. |
| `ids` | Yes | A comma-separated list of the IDs to delete data for. |
| `delimiter` | No | If your IDs contain commas, specify a different delimiter. |
| `request_id` | No | A unique request ID from your system. If omitted, Statsig provides one in the response. The ID must be unique; otherwise the request fails with a 400 error. |

```bash
curl \
  --header "statsig-api-key: <YOUR-API-KEY>" \
  --header "Content-Type: application/json" \
  --request POST \
  --data '{"unit_type": "user_id", "ids": "1,2,3", "request_id": "test_request_1"}' \
  "https://api.statsig.com/v1/delete_user_data"
```

Response:
`{"request_id":"test_request_1"}`

## Check deletion status

Using the request ID, check the status of a deletion.

Input: `request_id`: the ID of the request.

Output:

* `COMPLETE`: data has been deleted
* `PENDING`: data is still pending deletion
* `UNKNOWN`: invalid request ID

```bash
curl \
  --header "statsig-api-key: <YOUR-API-KEY>" \
  --header "Content-Type: application/json" \
  --request POST \
  --data '{"request_id": "test_request_1"}' \
  "https://api.statsig.com/v1/get_delete_user_data_request_status"
```

Response:
`PENDING`

## Deletion SLA

Statsig doesn't handle data deletion requests synchronously. Statsig batches requests and performs mass deletions periodically. Statsig guarantees deletion within 30 days of receiving a request.

## Important notes

* After you submit a data deletion request, you can't cancel it.
* After Statsig deletes data, it no longer stores the set of IDs it deleted data for, because those IDs may constitute personally identifiable information.
