# Reset password api

**URL:** <https://discuss.elastic.co/t/reset-password-api/324193>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security\
**Created:** [January 30, 2023, 5:54am UTC](https://discuss.elastic.co/t/reset-password-api/324193 "2023-01-30T05:54:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Neelam\_Zanvar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/neelam_zanvar/32/103116_2.png) [@Neelam\_Zanvar](https://discuss.elastic.co/u/Neelam_Zanvar)\
**Post date:** [January 30, 2023, 5:54am UTC](https://discuss.elastic.co/t/reset-password-api/324193/1 "2023-01-30T05:54:35Z")

</div>

Hi  
i am installing elk stack using ansible playbook. I am able to set password using elasticsearch-reset-password for all users manually, from command line. How can i do the same using the playbook? if i run this command from playbook it will expect a password, i want to specify the password in the command itself. can i do it using curl command?

```auto
curl -X POST "localhost:9200/_security/user/elastic/_password?pretty" -H 'Content-Type: application/json' -d'
{
  "password" : "test"
}'

```

tried this but getting a 401 error

---

<div class="post-metadata">

**Author:** ![Yang\_Wang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yang_wang/32/48857_2.png) [@Yang\_Wang](https://discuss.elastic.co/u/Yang_Wang)\
**Post date:** [January 31, 2023, 12:20am UTC](https://discuss.elastic.co/t/reset-password-api/324193/2 "2023-01-31T00:20:05Z")

</div>

There is no API equivalent for the `elasticsearch-reset-password` tool. For API calls, you always need first authenticate. In your case, this means you need the initial password of the `elastic` user. You can find it in the elasticsearch.keystore file and it can be shown with the following command

```auto
./bin/elasticsearch-keystore show keystore.seed

```

But this requires running a command line tool. At this point, you might be better off just using the `elasticsearch-reset-password` CLI.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 28, 2023, 12:20am UTC](https://discuss.elastic.co/t/reset-password-api/324193/3 "2023-02-28T00:20:34Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
