# Delete an account by using Rancher Api

**URL:** <https://forums.suse.com/t/delete-an-account-by-using-rancher-api/2885>\
**Category:** Rancher 1.x\
**Created:** [May 24, 2016, 4:00am UTC](https://forums.suse.com/t/delete-an-account-by-using-rancher-api/2885 "2016-05-24T04:00:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![niusmallnan](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/niusmallnan/32/811_2.png) [@niusmallnan](https://forums.suse.com/u/niusmallnan)\
**Post date:** [May 24, 2016, 4:00am UTC](https://forums.suse.com/t/delete-an-account-by-using-rancher-api/2885/1 "2016-05-24T04:00:39Z")

</div>

I use gdapi python lib

Both ACCESS\_KEY and SECRET\_KEY are the “Account API Keys”.  
$ gdapi delete-account --id=1a3271

Error : {‘status’: 405, ‘code’: u’Method not allowed’, ‘links’: {}, ‘detail’: None, ‘actions’: {}, ‘message’: u’Method not allowed’, ‘type’: u’error’, ‘id’: u’57471924-de89-4683-b889-13ff4b052b3d’}

Method not allowed ???  
What shoud I do if I want to delete an account by using CLI

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vincent/32/7156_2.png) [@vincent](https://forums.suse.com/u/vincent)\
**Post date:** [May 24, 2016, 4:28pm UTC](https://forums.suse.com/t/delete-an-account-by-using-rancher-api/2885/2 "2016-05-24T16:28:45Z")

</div>

Accounts have to be deactivated before they can be deleted:

`gdapi account-deactivate --id=1a3271`

---

<div class="post-metadata">

**Author:** ![niusmallnan](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/niusmallnan/32/811_2.png) [@niusmallnan](https://forums.suse.com/u/niusmallnan)\
**Post date:** [May 25, 2016, 1:45am UTC](https://forums.suse.com/t/delete-an-account-by-using-rancher-api/2885/3 "2016-05-25T01:45:07Z")

</div>

> [@vincent](#):
>
> account-deactivate

thanks, @vincent  
I did use ‘deactivate’ before.  
gdapi account-deactivate --id=1a3274 && gdapi delete-account --id=1a3274

But between “deactivate” and “delete”, I have to use “sleep”.  
gdapi account-deactivate --id=1a3274 && sleep 2 && gdapi delete-account --id=1a3274  
It will take time to change the ‘state’ value.

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vincent/32/7156_2.png) [@vincent](https://forums.suse.com/u/vincent)\
**Post date:** [May 25, 2016, 5:47am UTC](https://forums.suse.com/t/delete-an-account-by-using-rancher-api/2885/4 "2016-05-25T05:47:07Z")

</div>

Yes, ideally we would have a `--wait-for-it` type flag to wait for transitions to finish, but that doesn’t exist today. Sleep will work-ish, or you can poll the state if you want it to really work consistently.
