API to disable user not working despite admin privileges

We are trying to build an API call to disable a user’s Atlassian account. Despite the fact that the API token belongs to a user with admin privileges, however, the response returns {“code”:401,“message”:“Unauthorized”}. The API documentation here:

https://developer.atlassian.com/cloud/admin/user-management/rest/#api-users-account-id-manage-lifecycle-disable-post

states that we need a lifecycle.enablement privilege, however, we are unable to locate where or how exactly we can enable this.

1 Like

Trying to do the same thing. Receiving the same error. I even tried to do something way simpler to simply fetch orgs which doesn’t require any privilidges

Example of what I’m executing:

curl --location --request GET ‘https://api.atlassian.com/admin/v1/orgs
–header ‘Authorization: Bearer (my bearer here) from MyTokens’
–header ‘Accept: application/json’ \

1 Like

Did you solve this problem?

Hello Timofei,

Yes I did, what I did is I used the network inspector in Google Chrome and just recorded the request when I click the button. I copied it with cURL and pasted into Postman.

That was the only way to make it work. I don’t remember exact details of the edits that I made afterwards. I hope this helps you!

Hi! This is probably happening because you are trying to use a personal API token (created and tied to a specific user), while you should try to use a “org token”, which is created by Org Admins, on the ORG settings page (as opposed to the user personal settings page)

Also, not completely clear at this point, but it looks like the lifecycle.enablement permission is actually to define whether or not the given user can have its account disabled/enabled through the API, not that it can do it with his/her key. I say that because an user with no admin privileges has this flag set to true when getting at /users/account/manage,

Cheers!