# Get user by e-mail

**URL:** https://meta.discourse.org/t/get-user-by-e-mail/141831
**Category:** Development
**Tags:** rest-api
**Created:** [February 17, 2020, 7:13pm UTC](https://meta.discourse.org/t/get-user-by-e-mail/141831 "2020-02-17T19:13:39Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![dm.linov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dm.linov/32/167719_2.png) [@dm.linov](https://meta.discourse.org/u/dm.linov)
#### Post date: [February 17, 2020, 7:13pm UTC](https://meta.discourse.org/t/get-user-by-e-mail/141831/1 "2020-02-17T19:13:39Z")

</div>

We are creating users and topics via API. We need to check if a user with such email had been created before. If yes, then we create a topic from the existing user.

So I need an API call “get username by email, if any”. How can I do that? I only found the reverse one.

There’s a link mentioned in several topics, that might have the answer, but it’s broken.  
[https://meta.discourse.org/t/api-best-way-to-get-user-details-by-email/20806/10](https://meta.discourse.org/t/api-best-way-to-get-user-details-by-email/20806/10)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [February 17, 2020, 7:52pm UTC](https://meta.discourse.org/t/get-user-by-e-mail/141831/2 "2020-02-17T19:52:55Z")

</div>

That is a bit of a privacy violation so don’t expect it to be easy.

---

<div class="post-metadata">

### Author: ![dm.linov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dm.linov/32/167719_2.png) [@dm.linov](https://meta.discourse.org/u/dm.linov)
#### Post date: [February 17, 2020, 7:58pm UTC](https://meta.discourse.org/t/get-user-by-e-mail/141831/3 "2020-02-17T19:58:29Z")

</div>

> [@codinghorror](#):
>
> That is a bit of a privacy violation

Why? The admin of the forum can see search user by email via the web interface, what’s the difference if he does the same via API?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [February 17, 2020, 7:59pm UTC](https://meta.discourse.org/t/get-user-by-e-mail/141831/4 "2020-02-17T19:59:32Z")

</div>

Sure if you use an admin api key that should work.

---

<div class="post-metadata">

### Author: ![dm.linov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dm.linov/32/167719_2.png) [@dm.linov](https://meta.discourse.org/u/dm.linov)
#### Post date: [February 17, 2020, 8:01pm UTC](https://meta.discourse.org/t/get-user-by-e-mail/141831/5 "2020-02-17T20:01:24Z")

</div>

That’s exactly my question. There’s a “Get a single user by username” call in the API docs, but how do I get a single user by email?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [February 17, 2020, 8:05pm UTC](https://meta.discourse.org/t/get-user-by-e-mail/141831/6 "2020-02-17T20:05:51Z")

</div>

Follow the method here since you are an admin and know how to look users up by email address, yes?

> [@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: ![dm.linov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dm.linov/32/167719_2.png) [@dm.linov](https://meta.discourse.org/u/dm.linov)
#### Post date: [February 17, 2020, 8:14pm UTC](https://meta.discourse.org/t/get-user-by-e-mail/141831/7 "2020-02-17T20:14:29Z")

</div>

Got it, thank you!  
Posting it here for anyone else who might need it.  
`[discourse_url]/admin/users/list/active.json?filter=[email_name]%40[email_domain]&show_emails=false&order=&ascending=&page=1`

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [March 18, 2020, 8:14pm UTC](https://meta.discourse.org/t/get-user-by-e-mail/141831/8 "2020-03-18T20:14:39Z")

</div>

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