---
title: Consumer Data Privacy API
slug: data-privacy/consumer-data-privacy-api
description: How to use Monetate's Consumer Data Privacy API for privacy regulatory compliance
image:  https://archbee-image-uploads.s3.amazonaws.com/ceIfEvQHzQk1IVxoRWUh7/K9eTL4jKm7UQINb6zNziJ-20250912-181225.png
docTags: 
createdAt: 2024-05-08T19:12:51.146Z
---

:::hint{type="info"}
This document assumes that the reader has already created an API user and is capable of obtaining a token via the Monetate Auth API's [/refresh](docId\:lsd_luDUZYEAuUq9UlCH3) endpoint. If you're unfamiliar with these steps, refer to [Manage API Keys](https://docs.monetate.com/docs/manage-api-keys).
:::

Various privacy policies and regulations require companies to delete customer data upon request. To help comply with these regulations, Monetate provides an API endpoint that accepts a list of customer IDs that should be deleted from its database. After deleting a customer ID, Monetate continues to purge that ID from its system if it is recognized in any future sessions.

## Creating the customer\_data\_privacy Dataset

To start, you must create a new dataset using a schema type called `customer_data_privacy`. This is a one-time configuration that defines a two-column dataset of `customer_id` and `delete_request_time`.

Use the endpoint defined in [Create a New Schema](docId\:MFQ6TiMoL3xXpgSSQ7v0p). Fields don't have to be defined because the schema type does this by default.

:::CodeblockTabs
Create a New Schema Endpoint

```html
https://api.monetate.net/api/data/v1/{retailerShortname}/production/schema/
```
:::

:::hint{type="info"}
Submit a support ticket using the Monetate Technical Support portal (support.monetate.com) to obtain your account's `shortname` if you don't know it.
:::

:::CodeblockTabs
Example Request Header

```html
Authorization: Token <token>
Content-Type: application/json
```

Example Request Body

```json
{
  "type": "customer_data_privacy",
  "name": "<unique_dataset_name>",
  "fields": {}
}
```
:::

The schema creation process allows you to supply extra columns beyond the two required attributes. However, these fields aren't used in any capacity.

## Posting Data to the customer\_data\_privacy Dataset

Once you create a `customer_data_privacy` dataset, you can begin sending customer IDs to Monetate through the dataset. Doing so triggers a process to delete those IDs from Monetate's database. You must provide two attributes in the request:

- `customer_id` — The unique identifier for the customer to be removed
- `delete_request_time` — The timestamp for when the customer's removal request was received in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) standard format (YYYY-MM-DD)

Use the Send Data endpoint.

:::CodeblockTabs
Send Data Endpoint

```html
https://api.monetate.net/api/data/v1/{retailerShortname}/production/data/<insert_unique_dataset_name>/
```
:::

:::CodeblockTabs
Example Request Header

```html
Authorization: Token <token>
Content-Type: application/json
```

Example Request Body

```json
{
  "customer_id": "ABC123",
  "delete_request_time": "2019-05-23T12:01:00.000000Z"
}
```
:::

If you created the dataset with extra columns, they can be passed with the rest of the data, but this data is ignored.

## Verifying customer\_id Deletion Status

Monetate processes deletion requests through a series of nightly batch jobs. Requests typically take 24 to 48 hours to complete. After completion, the customer IDs no longer are in Monetate's system.

To confirm that a customer ID has been deleted, you can query the Customer ID Status endpoint.

:::CodeblockTabs
Customer ID Status Endpoint

```none
https://api.monetate.net/api/data/v1/{retailerShortname}/production/customer-data-privacy/<insert_unique_dataset_name>/?id=<customer_id>
```
:::

The required `customer_id` is the customer ID for which you're submitting the status query.

### Required Headers

:::CodeblockTabs
Request Header

```json
Authorization: Token <api_token>
```
:::

The token can be the same one used in the endpoints above. Any valid API token works if you want to use different API users for different systems.

:::CodeblockTabs
Example Response Body

```json
{
  "meta": {
    "code": 200
  },
  "data": {
    "status": <string : oneOf(PENDING, FOUND, NOT_FOUND)>,
    "description": <string>
  }
}
```
:::

### Statuses

- `PENDING` — The `customer_id` has been found within Monetate's data stores and is pending removal.
- `FOUND` — The `customer_id` has been found within Monetate's data stores.
- `NOT_FOUND` — The `customer_id` has not been found within Monetate's data stores.

:::hint{type="info"}
The `NOT_FOUND` status is expected once the `customer_id` has been completely removed from Monetate's data stores.
:::

### Possible Error Response Codes

- 401 UNAUTHORIZED
- 403 FORBIDDEN
- 404 NOT FOUND
- 500 SERVER ERROR

:::hint{type="info"}
Submit a support ticket using the Monetate Technical Support portal (support.monetate.com) if you don't receive a `NOT_FOUND` status 48 hours after submitting your request.
:::

