Data regulation API

Suppress and delete user data in accordance with your data regulation policies.

RudderStack’s Data Regulation API lets you create regulations to suspend data collection and delete data for particular users.

warning
The Data regulation API is applicable only for destinations configured to send events using cloud mode.


What is data regulation?

In order to comply with data regulation statutes and users’ privacy choices, we provide tools that allow you to:

  • Suppress incoming source data for a user or list of users
  • Delete collected data for users that resides in a given destination

You can leverage RudderStack’s data regulation feature to suppress any incoming data for a given user. RudderStack will drop the events for that user at the source. After suppression, events:

  • Will not be shown in any debuggers
  • Will not be forwarded to any destinations
  • Will not be available for Event Replay

API Overview

With our regulation APIs, perform the following actions:

  • Add a suppression regulation. A suppression regulation drops the user events at the source, and they will not be available for debugging, replay, or forwarded to destinations.
  • Add a suppress and delete regulation. A suppress/delete regulation deletes any user data that was sent to a destination.
  • List all regulations
  • Delete a specific regulation

Authorization

Our data regulation APIs use Bearer authentication in the format Authorization: Bearer <PERSONAL_ACCESS_TOKEN>.

Retrieve your Personal Access Token from the RudderStack web app.

Retrieve source and destination IDs

When creating your data regulations with our API, you may wish to name specific sources for a suppress regulation, and specific destinations for a suppress/delete regulation. To do so you must first obtain the source and/or destination IDs.

Retrieve source and destination IDs for your data regulations from your RudderStack dashboard, or by using the /v2/sources and /v2/destinations endpoints:

GET
/v2/sources
GET /v2/sources HTTP/1.1
Host: api.rudderstack.com
Authorization: Bearer 2Le5TOgDjwR0djObWRW6Le5kq3E
GET
/v2/destinations
GET /v2/destinations HTTP/1.1
Host: api.rudderstack.com
Authorization: Bearer 2Le5TOgDjwR0djObWRW6Le5kq3E

Add a suppression regulation

Add a new data regulation to suppress a given user’s data.

POST
/v2/regulations

See Request body for details on the request parameters.

Example Request:

Example Response:

[
    {
        "id": "b287a287-6b83-4402-902e-d2793b3e4ba4",
        "workspaceId": "2H2WbKP1613awrY1YgA9Q58wBOc",
        "canceled": false,
        "regulationType": "suppress",
        "attributes": {
            "email": "email@email.com",
            "phone": "+12125551212",
            "userId": "54321"
        }
    },
    {
        "id": "f57475da-5f00-4f77-a22a-26be261ad3b6",
        "workspaceId": "2H2WbKP1613awrY1YgA9Q58wBOc",
        "canceled": false,
        "regulationType": "suppress",
        "attributes": {
            "randomKey-1": "randomVal-1",
            "randomKey-2": "randomVal-2",
            "userId": "54322"
        }
    }
]
success
A succesful response will return 201 Status Code.

Add a suppression with delete regulation

Add a new data regulation to suppress and delete a given user’s data.

POST
/v2/regulations

See Request body for details on the request parameters.

Example Request:

Example Response:

[
    {
        "id": "5d2417f6-655f-494b-aab7-b0dac55a9b52",
        "workspaceId": "2H2WbKP1613awrY1YgA9Q58wBOc",
        "canceled": false,
        "regulationType": "suppress_with_delete",
        "attributes": {
            "email": "email@email.com",
            "phone": "+12125551212",
            "userId": "54321"
        }
    },
    {
        "id": "f2414ddd-e664-4a22-bd7a-b165138ccd8f",
        "workspaceId": "2H2WbKP1613awrY1YgA9Q58wBOc",
        "canceled": false,
        "regulationType": "suppress_with_delete",
        "attributes": {
            "randomKey-1": "randomVal-1",
            "randomKey-2": "randomVal-2",
            "userId": "54322"
        }
    }
]
success
A successful response will return the 201 status code.

RudderStack supports the suppress_with_delete request for the following destinations:

info
For the above-mentioned destinations, you can delete a user by specifying the userId in the event. Except for Redis and S3 destinations, you can also specify a custom identifier (optional) in the event in addition to the userId.

Request body

regulationType
required
string
Defines the data regulation type. Can be one of suppress, which suppresses incoming user data or suppress_with_delete which suppresses and deletes events from your specified destinations.
Possible Values: suppress, suppress_with_delete
sourceIds
optional
array
Specify only sourceIds with the ‘suppress’ regulationType. If no sourceIds are specified, RudderStack will suppress data from all sources in the workspace associated with your access token.
destinationIds
optional
array
Specify only destinationIds with the ‘suppress_with_delete’ regulationType. Otherwise, RudderStack throws an error.
users
required
array
An array of user objects identifying users to be suppressed. The userId field is mandatory for all users. You can pass additional custom identifiers such as email in the users object.


warning
Do not specify both sourceIds and destinationIds in your request body.

List data regulations

List your existing data regulations.

GET
/v2/regulations

Example request:

Example response:

{
  "data": [
    {
      "id": "c8fae8a7-1555-4807-89d8-972837671071",
      "workspaceId": "216AlUz1kdkhkh7RFFvJVA9THlq",
      "canceled": false,
      "regulationType": "suppress",
      "attributes": {
        "userId": "12",
        "phone": "1234567890",
        "email": "abc@xyz.com"
      }
    },
    {
      "id": "1ac629bf-d795-45df-8bfb-be06d22a636b",
      "workspaceId": "216AlUz1kdkhkh7RFFvJVA9THlq",
      "canceled": false,
      "regulationType": "suppress_with_delete",
      "attributes": {
        "userId": "rudder-1"
      }
    },
    {
      "id": "7bdf698f-80bd-4278-bb85-414ad8d27888",
      "workspaceId": "216AlUz1kdkhkh7RFFvJVA9THlq",
      "canceled": true,
      "regulationType": "suppress",
      "attributes": {
        "userId": "123",
        "phone": "9876543210",
        "email": "name@surname.com"
      }
    }
  ],
  "paging": {
    "next": "/v2/regulations?after_cursor=a450395bb52f4acb99e492c358e104eb"
  },
}

Response object parameters:

paging
object
Provides a next URL for fetching paginated results. The next URL contains an after_cursor query parameter.

Cancel a data regulation

Cancel an existing data regulation.

DELETE
/v2/regulations{regulation_id}

Query parameters:

regulation_id
required
string
The ID of the regulation to be canceled. The regulation_id is the id that is returned for a regulation in GET /v2/regulations.

Example request:

success
A succesful response will return 204 No Content.

Questions? Contact us by email or on Slack