The Amp Devcenter Test Developer Hub

Welcome to the Amp Devcenter Test developer hub. You'll find comprehensive guides and documentation to help you start working with Amp Devcenter Test as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

User Privacy API

In order to ensure that our customers can adhere to end-user data deletion request mandated by global privacy laws such as GDPR and CCPA, we have built a simple and easy-to-use API endpoint that allows you to programmatically submit requests to delete all data for a set of known Amplitude IDs and/or User IDs.

This system also communicates a confirmation update to the administrators of your Amplitude organization so you can be confident you have fully complied with your customers’ privacy requests, e.g. when a request is made for deletion all admins of the account will receive an email with details about the deletion.

Authenticate via basic authentication with the project's credentials API_Key:Secret_Key. You should literally replace the "API_Key" text with your API Key, and the "Secret_Key" text with your Secret Key. For instructions on how to find these keys, refer here.

IMPORTANT NOTE: Using this API does not prevent future user tracking for the deleted users. To learn about how to stop tracking users in your application, see the setOptOut() method in our SDKs.

API Endpoint

https://amplitude.com/api/2/deletions/users
This endpoint uses basic authentication.

# Response Objects
All API operations will respond with a JSON object composed of the following objects described in this section.

## Deletion Job
Request a user be scheduled for deletion, up to 100 users can be specified at a time. A mix of amplitude ids and user ids is permitted.

This object contains the following fields:

|key | description|
|----|-------|
|day | The day the deletion job is scheduled to begin|
|status | The status of the deletion job|
|amplitude_ids | List of the amplitude ids to delete|
|app | project/app id, only appears when the deletion is done for multiple projects|

## Deletion Request
When a request is made, we confirm the validity of the requestor via the secret key and the end-user via the Amplitude ID. We batch multiple requests for deletions to reduce operational impact on the platform and ensure high availability and refresh of the dashboard. We schedule a batch job 10-13 days after the first request in a batch is made. Requests in the batch can be revoked in case it was made in error up to three (3) days before the job is scheduled. During the three (3) day period, the batch will not be able to be edited, and all new requests made during this time will be added to another batch job, which will be created. 

Following the three (3) day grace period, the request will transition to status = 'submitted' after which it cannot be stopped. The purge process will completely remove all data associated with the user from all Amplitude's systems, including associated recovery and back-up systems. Once the job is completed, it will be marked as "done". This object contains the following fields:

|key | description|
|----|-------|
|amplitude_id| The Amplitude ID being deleted|
|requester| The person who requested the Amplitude ID to be deleted|
|requested_on_day| The day this deletion was requested|

## Code samples


[block:code]
{
  "codes": [
    {
      "code": "# You can also use wget\ncurl -X POST https://amplitude.com/api/2/deletions/users \\\n  -H 'Content-Type: application/json' \\\n  -H 'Accept: application/json'",
      "language": "shell"
    },
    {
      "code": "POST https://amplitude.com/api/2/deletions/users HTTP/1.1\nHost: amplitude.com\nContent-Type: application/json\nAccept: application/json",
      "language": "http"
    },
    {
      "code": "var headers = {\n  'Content-Type':'application/json',\n  'Accept':'application/json'\n\n};\n\n$.ajax({\n  url: 'https://amplitude.com/api/2/deletions/users',\n  method: 'post',\n\n  headers: headers,\n  success: function(data) {\n    console.log(JSON.stringify(data));\n  }\n})",
      "language": "javascript"
    },
    {
      "code": "const request = require('node-fetch');\nconst inputBody = '{\n  \"amplitude_ids\": [\n    \"amp_id_1\",\n    \"amp_id_2\",\n    \"...\"\n  ],\n  \"user_ids\": [\n    \"user_id_1\",\n    \"user_id_2\",\n    \"...\"\n  ],\n  \"requester\": \"[email protected]\"\n}';\nconst headers = {\n  'Content-Type':'application/json',\n  'Accept':'application/json'\n\n};\n\nfetch('https://amplitude.com/api/2/deletions/users',\n{\n  method: 'POST',\n  body: inputBody,\n  headers: headers\n})\n.then(function(res) {\n    return res.json();\n}).then(function(body) {\n    console.log(body);\n});",
      "language": "javascript",
      "name": "NodeJS"
    },
    {
      "code": "require 'rest-client'\nrequire 'json'\n\nheaders = {\n  'Content-Type' => 'application/json',\n  'Accept' => 'application/json'\n}\n\nresult = RestClient.post 'https://amplitude.com/api/2/deletions/users',\n  params: {\n  }, headers: headers\n\np JSON.parse(result)",
      "language": "ruby"
    },
    {
      "code": "import requests\nheaders = {\n  'Content-Type': 'application/json',\n  'Accept': 'application/json'\n}\n\nr = requests.post('https://amplitude.com/api/2/deletions/users', params={\n\n}, headers = headers)\n\nprint r.json()",
      "language": "python"
    },
    {
      "code": "URL obj = new URL(\"https://amplitude.com/api/2/deletions/users\");\nHttpURLConnection con = (HttpURLConnection) obj.openConnection();\ncon.setRequestMethod(\"POST\");\nint responseCode = con.getResponseCode();\nBufferedReader in = new BufferedReader(\n    new InputStreamReader(con.getInputStream()));\nString inputLine;\nStringBuffer response = new StringBuffer();\nwhile ((inputLine = in.readLine()) != null) {\n    response.append(inputLine);\n}\nin.close();\nSystem.out.println(response.toString());",
      "language": "java"
    },
    {
      "code": "package main\n\nimport (\n       \"bytes\"\n       \"net/http\"\n)\n\nfunc main() {\n\n    headers := map[string][]string{\n        \"Content-Type\": []string{\"application/json\"},\n        \"Accept\": []string{\"application/json\"},\n\n    }\n\n    data := bytes.NewBuffer([]byte{jsonReq})\n    req, err := http.NewRequest(\"POST\", \"https://amplitude.com/api/2/deletions/users\", data)\n    req.Header = headers\n\n    client := &http.Client{}\n    resp, err := client.Do(req)\n    // ...\n}",
      "language": "go"
    }
  ]
}
[/block]

# POST
Request a user be scheduled for deletion. Up to 100 users can be specified at a time, and a mix of Amplitude IDs and User IDs is permitted.
POST /deletions/users

Arguments

keydescription
amplitude_ids Amplitude IDs to be deleted.
user_ids User IDs to be deleted.
requesterThe person who requested the Amplitude ID to be deleted. This is useful for auditing.
ignore_invalid_id Ignore any invalid user IDs(users that do no exist in the project) that were passed in
delete_from_org delete from the entire org rather than just this project. Can only be used with portfolio orgs (have the Portfolio feature enabled) and with user ids only. Values can be either 'True' or 'False' and by default it is set to False

Body parameter

{
  "amplitude_ids": [
    "amp_id_1",
    "amp_id_2",
    "..."
  ],
  "user_ids": [
    "user_id_1",
    "user_id_2",
    "..."
  ],
  "requester": "[email protected]"
}
ParameterInTypeRequiredDescription
bodybodyDeletionRequesttrueDeletion request object listing user_ids and amplitude_ids that need to be deleted

Example responses

200 Response

{
  "day": "string",
  "amplitude_ids": [
    {
      "amplitude_id": 0,
      "requested_on_day": "string",
      "requester": "string"
    }
  ],
  "status": "string"
}

Responses

StatusMeaningDescriptionSchema
200OKSuccessDeletionJob
400Bad RequestInvalid inputNone

To perform this operation, you must be authenticated by means of one of the following methods:
basicAuth

GET

List deletion jobs scheduled in a time range; this time range should include the date you made the request on plus 30 days. For example, you made a deletion request on August 1st, 2018. Your deletion request should have start_day = 2018-08-01 and end_day = 2018-08-31.

If this returns no values, then this means no jobs were scheduled for that time range. Note: The largest permitted time range is six months.

/api/2/deletions/users?start_day=YYYY-MM-DD&end_day=YYYY-MM-DD

Arguments

keydescription
start_dayYYYY-MM-DD
end_dayYYYY-MM-DD

Response

A list of deletion jobs in the specified time range.

Code samples

# You can also use wget
curl -X GET https://amplitude.com/api/2/deletions/users?start=string&end=string \
  -H 'Accept: application/json'
GET https://amplitude.com/api/2/deletions/users?start=string&end=string HTTP/1.1
Host: amplitude.com

Accept: application/json
var headers = {
  'Accept':'application/json'

};

$.ajax({
  url: 'https://amplitude.com/api/2/deletions/users',
  method: 'get',
  data: '?start=string&end=string',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
const request = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('https://amplitude.com/api/2/deletions/users?start=string&end=string',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get 'https://amplitude.com/api/2/deletions/users',
  params: {
  'start' => 'string',
'end' => 'string'
}, headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('https://amplitude.com/api/2/deletions/users', params={
  'start': 'string',  'end': 'string'
}, headers = headers)

print r.json()
URL obj = new URL("https://amplitude.com/api/2/deletions/users?start=string&end=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://amplitude.com/api/2/deletions/users", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

Parameters

ParameterInTypeRequiredDescription
startquerystringtrueStart day to query for deletion jobs (YYYY-MM-DD)
endquerystringtrueEnd day to query for deletion jobs (YYYY-MM-DD)

Example responses

200 Response

[
  {
    "day": "string",
    "amplitude_ids": [
      {
        "amplitude_id": 0,
        "requested_on_day": "string",
        "requester": "string"
      }
    ],
    "status": "string"
  }
]

Responses

StatusMeaningDescriptionSchema
200OKSuccessInline
400Bad RequestInvalid inputNone

Response Schema

Status Code 200

NameTypeRequiredRestrictionsDescription
anonymous[DeletionJob]falsenonenone
» daystringtruenonenone
» amplitude_ids[AmplitudeId]truenonenone
»» amplitude_idintegertruenonenone
»» requested_on_daystringtruenonenone
»» requesterstringtruenonenone
» statusstringtruenonenone

To perform this operation, you must be authenticated by means of one of the following methods:
basicAuth

DELETE

A DELETE request to the following endpoint will remove the specified Amplitude ID from a deletion job.

/api/2/deletions/users/AMPLITUDE_ID/YYYY-MM-DD

Response

The deletion request that was removed.

{
  "amplitude_ids": [
    "amp_id_1",
    "amp_id_2",
    "..."
  ],
  "user_ids": [
    "user_id_1",
    "user_id_2",
    "..."
  ],
  "requester": "[email protected]"
}

Properties

NameTypeRequiredRestrictionsDescription
amplitude_ids[integer]falsenoneList of amplitude ids that should be deleted
user_ids[string]falsenoneList of user ids that should be deleted
requesterstringtruenoneWho made this request, for your own tracking/auditing

DeletionJob

{
  "day": "string",
  "amplitude_ids": [
    {
      "amplitude_id": 0,
      "requested_on_day": "string",
      "requester": "string"
    }
  ],
  "status": "string"
}

Properties

NameTypeRequiredRestrictionsDescription
daystringtruenonenone
amplitude_ids[AmplitudeId]truenonenone
statusstringtruenonenone

AmplitudeId

{
  "amplitude_id": 0,
  "requested_on_day": "string",
  "requester": "string"
}

Properties

NameTypeRequiredRestrictionsDescription
amplitude_idintegertruenonenone
requested_on_daystringtruenonenone
requesterstringtruenonenone

Job Statuses

  1. staging: The job has not begun and can still be modified. More deletion requests may get scheduled into this job and you can remove requests from this job.
  2. submitted: The job was submitted to run. It can no longer be modified.
  3. done: The job has been completed. It can no longer be modified.

FAQ

1. What data is deleted about a user?
For all Amplitude IDs in a deletion job we delete all events and user properties seen up to the time that job runs for that user. 

2. Are events from a deleted user blocked from being sent to Amplitude automatically?
No, if a deletion job runs for user X, then later events are received for user X, we will accept those events.

3. If a user is deleted and more events are sent are they re-counted as a new user?
Yes, Amplitude will no longer recognize the user once their data has been deleted from our servers.

4. When can I expect the data to be deleted?
When a request is made, we add it to a batch to increase the number of deletions that run simultaneously to reduce impact on the platform. This also provides a grace period of three (3) days where the request can be revoked in case it was made in error.
In line with GDPR article 12.3 and 17, Amplitude processes deletion requests without undue delay, and in any event within 30 days after receiving your request for deletion. The actual timeline for deletion depends on the complexity and number of requests we receive.

NOTE: If your data volume is large (>1BB/month), then we may need to reduce your frequency of deletion scheduling. We will reach out to you about this in case it is necessary.

5. What is the API rate limit?
The endpoint /api/2/deletions/users has a rate limit of 1 HTTP request per second. Each HTTP request can contain up to 100 amplitude_ids or user_ids. Hence, you can request 100 users deleted per second assuming you batch up to 100 users into each of your requests.

Updated 4 months ago


User Privacy API


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.