Delete users from Atlassian Cloud

Hi,

We have to delete a bunch of users from Atlassian Access. I’ve found the delete user API on the developer platform.
I know that it says that it’s experimental, but I get the following error, also with non-experimental API calls from this page:

So I am using exactly this script: ``// This code sample uses the ‘node-fetch’ library
const fetch = require(‘node-fetch’);

fetch(‘https://your-domain.atlassian.net/rest/api/3/user?accountId=5b10ac8d82e05b22cc7d4ef5’, {
method: ‘DELETE’,
headers: {
‘Authorization’: Basic ${Buffer.from( 'email@example.com:<api_token>' ).toString('base64')}
}
})
.then(response => {
console.log(
Response: ${response.status} ${response.statusText}
);
return response.text();
})
.then(text => console.log(text))
.catch(err => console.error(err));`Preformatted text``
By adding my domain, my e-mail address and my API key (retrieved via Atlassian Access).
But I get the following error:

Response: 401 Unauthorized
Basic authentication with passwords is deprecated.  For more information, see: https://confluence.atlassian.com/cloud/deprecation-of-basic-authentication-with-passwords-for-jira-and-confluence-apis-972355348.html

I also tried with my API key found via id .atlassian. net.

Anyone ideas?

Thank you in advance.

Hi,

I can think of only one thing as you are already using API token method and trying this via node script. In delete user API docs, it is mentioned " Permissions required: Site administration (that is, membership of the site-admin group).". Can you please make sure the account from which you are trying to delete users have site-admin permissions?

Thanks.

Hi,

I confirm that I have site-admin permissions for this account.