# Is there an API for changing a password?

**URL:** https://meta.discourse.org/t/is-there-an-api-for-changing-a-password/52537
**Category:** Development
**Created:** [05.Ноябрь.2016 08:50:21 UTC](https://meta.discourse.org/t/is-there-an-api-for-changing-a-password/52537 "2016-11-05T08:50:21Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![adam\_beers](https://avatars.discourse-cdn.com/v4/letter/a/97f17d/32.png) [@adam\_beers](https://meta.discourse.org/u/adam_beers)
#### Post date: [05.Ноябрь.2016 08:50:22 UTC](https://meta.discourse.org/t/is-there-an-api-for-changing-a-password/52537/1 "2016-11-05T08:50:22Z")

</div>

I’m wondering if there is an API for updating or changing a password. I can’t find it in the API documentation, but it seems like something that would exist. I’m looking more specifically for a CURL type or HTTPS type request, similar to account creation APIs.

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [05.Ноябрь.2016 14:11:11 UTC](https://meta.discourse.org/t/is-there-an-api-for-changing-a-password/52537/2 "2016-11-05T14:11:11Z")

</div>

Would sending a password reset email via the API be enough for your needs?

```plaintext
Request Url: http://localhost:3000/session/forgot_password
Request Method: POST
Form Data:
  api_key: {{api_key}}
  api_username: {{api_username}}
  login: discourse2

```

The user would then receive an email like this:

 ![](https://global.discourse-cdn.com/meta/original/3X/a/6/a6af826d2fcc8f300d73c0291cf5c80ac8536d5e.png)

that they could use to reset their password.

Other than that I don’t know how you can change the password via the API without knowing the password reset token (which is only available in that email).

But if you did happen to know the password reset token, you could make this API Call:

```plaintext
Request Url: http://localhost:3000/users/password-reset/{token}
Request Method: PUT
Form Data:
  api_key: {{api_key}}
  api_username: {{api_username}}
  username: discourse2
  password: password

```

---

<div class="post-metadata">

### Author: ![adam\_beers](https://avatars.discourse-cdn.com/v4/letter/a/97f17d/32.png) [@adam\_beers](https://meta.discourse.org/u/adam_beers)
#### Post date: [05.Ноябрь.2016 19:05:56 UTC](https://meta.discourse.org/t/is-there-an-api-for-changing-a-password/52537/3 "2016-11-05T19:05:56Z")

</div>

Not sure if that will work. I’ve made an Android app for a Discourse forum, but one thing it lacks is support for forgotten passwords. There is no mechanism for it that I have seen. The forum only exists in the app. There is no webpage for it.

With the email, how do you initiate the sending of it?

---

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [05.Ноябрь.2016 19:07:14 UTC](https://meta.discourse.org/t/is-there-an-api-for-changing-a-password/52537/4 "2016-11-05T19:07:14Z")

</div>

Oh, wait, are you looking for an API for a user to change _his own_ password?

If so, there’s an API for that – just change your password here and use your browsers Dev tools to find out how it works 🙂

> [@Reverse engineer the Discourse API](https://meta.discourse.org/t/how-to-reverse-engineer-the-discourse-api/20576):
>
> Discourse is backed by a complete JSON api. Anything you can do on the site you can also do using the JSON api. The API is documented at [docs.discourse.org](https://docs.discourse.org). You can also use the [discourse\_api](https://github.com/discourse/discourse_api) Ruby gem as a client library. However, not every endpoint is documented. To determine how to do something with the JSON API here are some steps you can follow. Example: recategorize a topic. Go to a topic and start editing a category: Open Chrome dev tools, switch to the Network tab, select …

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [05.Ноябрь.2016 19:55:55 UTC](https://meta.discourse.org/t/is-there-an-api-for-changing-a-password/52537/5 "2016-11-05T19:55:55Z")

</div>

Yea try resetting your password here on meta and discourse sends you an email. There is no change password input field.

---

<div class="post-metadata">

### Author: ![adam\_beers](https://avatars.discourse-cdn.com/v4/letter/a/97f17d/32.png) [@adam\_beers](https://meta.discourse.org/u/adam_beers)
#### Post date: [06.Ноябрь.2016 01:30:08 UTC](https://meta.discourse.org/t/is-there-an-api-for-changing-a-password/52537/6 "2016-11-06T01:30:08Z")

</div>

I went to my account preferences and all that exists there is a “Send Password Reset Email” button. Bummer. I’ll have to figure out another way to do it I guess.

---

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [06.Ноябрь.2016 10:50:56 UTC](https://meta.discourse.org/t/is-there-an-api-for-changing-a-password/52537/7 "2016-11-06T10:50:56Z")

</div>

О, ты прав. Похоже, изменить пароль без сброса невозможно.  
Возможно, это стоит оформить как #Contribute > Feature?
