How to get client id from service account user id

If I have access to the service account user id, how would i go about to use the admin rest api to get the clientId?

Is it safe to just check if the username starts with service-account- and then get the client with the text after service-account-?