Skip to content

Instantly share code, notes, and snippets.

@knorwood
Last active January 29, 2018 17:36
Show Gist options
  • Save knorwood/1883bbc6a46cb34ec7e294b7d0e73a1f to your computer and use it in GitHub Desktop.
Save knorwood/1883bbc6a46cb34ec7e294b7d0e73a1f to your computer and use it in GitHub Desktop.

User Data Deletion API

API endpoint

https://api.amplitude.com/api/2/deletions/users

Uses basic auth

POST

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.

Arguments

amplitude_ids - amplitude ids to be deleted

user_ids - user ids to be deleted

requester - who is making the request. Useful for auditing

Content Types

application/x-www-form-urlencoded - amplitude_ids & user_ids arguments can be given multiple times

application/json - Request body should be a json object like:

{
	"amplitude_ids": [...],
	"user_ids": [...],
	"requester": ""
}

Usage Example

> curl -s -u API_KEY:SECRET_KEY --data amplitude_ids=1234567890  --data requester='somebody' 'http://localhost:3001/api/2/deletions/users' | json_pp
{
   "day" : "2018-02-04",
   "amplitude_ids" : [
      {
         "requested_on_day" : "2018-01-26",
         "amplitude_id" : 1234567890,
         "requester" : "somebody"
      }
   ],
   "status" : "staging"
}

GET

List deletion jobs scheduled in a time range

Arguments

start_day - YYYY-MM-DD

end_day - YYYY-MM-DD

Largest permitted timerange is six months.

Usage Example

> curl -s -u API_KEY:SECRET_KEY 'http://localhost:3001/api/2/deletions/users?start_day=2018-01-15&end_day=2018-02-15' | json_pp
[
   {
      "day" : "2018-02-04",
      "status" : "staging",
      "amplitude_ids" : [
         {
            "requested_on_day" : "2018-01-26",
            "amplitude_id" : 1234567890,
            "requester" : "somebody"
         }
      ]
   }
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment