# How to login with API

**URL:** <https://discuss.hashicorp.com/t/how-to-login-with-api/39776>\
**Category:** Vault\
**Tags:** vault\
**Created:** [May 20, 2022, 10:29am UTC](https://discuss.hashicorp.com/t/how-to-login-with-api/39776 "2022-05-20T10:29:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sheng.hao.tian](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/sheng.hao.tian/32/24119_2.png) [@sheng.hao.tian](https://discuss.hashicorp.com/u/sheng.hao.tian)\
**Post date:** [May 20, 2022, 10:29am UTC](https://discuss.hashicorp.com/t/how-to-login-with-api/39776/1 "2022-05-20T10:29:28Z")

</div>

HI Team, I have question for how to login vault with API;  
And I’m using a enterprise vault, my team has a sub BU let’s call it as BU\_Demo.  
And the vault login link is: [https://vault.orgname.net/ui/vault/auth?with=token&namespace=orgname/BU\_Demo;](https://vault.orgname.net/ui/vault/auth?with=token&namespace=orgname/BU_Demo;)  
So how could I login my BU with API, how I setup the parameter, Thanks.

---

<div class="post-metadata">

**Author:** ![aram](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@aram](https://discuss.hashicorp.com/u/aram)\
**Post date:** [May 21, 2022, 8:50am UTC](https://discuss.hashicorp.com/t/how-to-login-with-api/39776/2 "2022-05-21T08:50:07Z")

</div>

Depends on the auth type you want to use.

You can always get it from the CLI too:

```auto
$ vault login -method=ldap -output-curl-string username=test 
Password (will be hidden): 
curl -X PUT -H "X-Vault-Request: true" -d '{"password":"myPassword"}' https://vault.basement.lab/v1/auth/ldap/login/test

```

---

<div class="post-metadata">

**Author:** ![sheng.hao.tian](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/sheng.hao.tian/32/24119_2.png) [@sheng.hao.tian](https://discuss.hashicorp.com/u/sheng.hao.tian)\
**Post date:** [May 24, 2022, 6:23am UTC](https://discuss.hashicorp.com/t/how-to-login-with-api/39776/3 "2022-05-24T06:23:22Z")

</div>

Thanks for share, I’ll try it. Hope it works.

---

<div class="post-metadata">

**Author:** ![sheng.hao.tian](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/sheng.hao.tian/32/24119_2.png) [@sheng.hao.tian](https://discuss.hashicorp.com/u/sheng.hao.tian)\
**Post date:** [June 8, 2022, 12:05pm UTC](https://discuss.hashicorp.com/t/how-to-login-with-api/39776/4 "2022-06-08T12:05:50Z")

</div>

HI Aram,  
It works, if anyone who has the same question, you could follow.  
Thank.
