Cannot get accountId after updating Confluence account using PUT

I am calling PUT API to update a user account. The updated account has different username and primary email than the account on creation. In the response of the API, I am getting urn:scim:schemas:extension:atlassian-external:1.0 : [] , that is no external accountId is getting fetched in the response.

To call APIs listed in ConfluenceCloud REST APIs, I need accountId to be passed as the request parameter (like in Add space permissions for user API).

I have come across find users api where I can pass primary email of user in request parameter and get the accountId of that account in response. However, I can get accountId only if the email of the account has not been not updated since account creation.

Is there any API to get accountId even if account’s primary email has been updated? Without the accountId I cannot add space permissions for a user in Confluence cloud.