API for managing personal access tokens


I regularly copy our on-premise gitlab-ce environment into a test environment for the purposes of testing upgrades. This is done by restoring a back-up into an instance of gitlab on the test server.

Once the copy is complete, I use the gitlab API to block all the users. I then unblock users as the need arises or as requests come in. I block the users to reduce the risk of pushes being performed on the wrong environment. When I unblock users, I manually remove their personal access tokens as well, and advise them that they have to create new tokens if they need to test their uses of the gitlab API.

I would like to be able to programatically remove or disable the personal access tokens at the same time I am programmatically blocking the user.

Is there a personal access token API that will facilitate this?

We’re at gitlab 10.7.