Skip to content

User Keys API doesn't return last used date for ssh key

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

In the GitLab GUI I can see the last used date for a user's ssh keys. The API (/api/v4/users/{user_id}/keys/{key_id}), however, doesn't return these properties:

{'id': 1, 'title': 'key_name', 'created_at': '2016-04-07T13:20:01.807Z', 'expires_at': None, 'key': 'ssh-rsa...', 'usage_type': 'auth_and_signing'}

For auditing purposes I must be able to tell when an ssh key has been last used, so that I can flag (and possibly remove) "unused" keys.

Context

The user keys endpoint does not currently return last_used_dt.

Edited by 🤖 GitLab Bot 🤖