Overview
The User Deletion API allows you to delete users and their data from your Heap workspace. The user deletion API checks all environments in your account for a matching user and deletes their records and data.
This guide covers how to use the User Deletion API with Postman so you don’t have to write a script to use this API. You can also request the deletion of user data in-app, though you would have to submit one request per user.
Be sure to completely review our User Deletion API doc and verify the users that you want to delete before continuing.
Generate an Auth Token
All endpoints require an auth_token
, which is obtained through HTTP Basic Authentication of an app_id
and api_key
, where app_id
is the username and api_key
is the password.
Admins can generate and retrieve an API key by navigating to Account > Manage > Privacy & Security. If one has been generated before, you will see a timestamp for when the last key was generated but you won’t be able to see the previous API key. You may have to revoke that key and generate a new one. Steps to generate a new API key or revoke an existing key are provided on the Privacy & Security page.
1. In Postman, click Import (1) and select Paste Raw Text (2) (see the screenshot below for reference). Paste the following cURL command and replace the app_id
and api_key
.
curl -X POST https://heapanalytics.com/api/public/v0/auth_token -u '<app_id>:<api_key>'
Once you’ve updated these fields, click Import (3).
2. Click Send to request an Auth Token. Save the token generated in the response; this will authenticate your user deletion request, and it expires in 5 minutes.
User Deletion
- In Postman, click Import (1) and select Paste Raw Text (2).
Paste the following cURL command. You can leave the user information unchanged; we’ll handle this in a later step.
curl -X POST https://heapanalytics.com/api/public/v0/user_deletion \
-H 'Authorization: Bearer <token>' \
-H 'Content-type: Application/json' \
-d '{ "users": [{ "identity": "alice@email.com" }, { "identity": "bob@email.com" }] }'
Click Import (3).
2. Click Authorization (1) and select Bearer Token in the authorization type dropdown (2). Paste the auth token you generated in the last part in the input field (3).
3. Click Body to modify the user list you want to delete. Refer to our User Deletion API doc to understand the format of the user array. You can delete users using either their identity or their user id.
Once you’ve verified that your list of users being deleted is correct, click Send to send your user deletion request.
Once you’ve sent a deletion request, the status will be set to pending. Once the user is completely deleted from our systems, the status will change to complete.
Need help? Please post in Community or contact us via the Get support page in Heap.