How to automate user delete

Hi @ev-petteri.makela

There is no automatic “retention policy” feature, but you might accomplish this by getting a list of users with a last_login date of longer than a year, iterating over that list and deleting the users.

  1. to get the list of users that have not logged in in a year, you’ll need to use the GET /api/v2/users endpoint with the query last_login: [* TO 2020-04-29]

  2. to delete the users, you can use the DELETE /api/v2/users/{id} endpoint with each of the user ids

You can then create a script to run this periodically. Be sure to check the rate limits, specially for the delete users step.

2 Likes