# How to get and create users in elasticsearch with API by using python

**URL:** <https://discuss.elastic.co/t/how-to-get-and-create-users-in-elasticsearch-with-api-by-using-python/239565>\
**Category:** Elasticsearch\
**Created:** [July 2, 2020, 3:12am UTC](https://discuss.elastic.co/t/how-to-get-and-create-users-in-elasticsearch-with-api-by-using-python/239565 "2020-07-02T03:12:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mahathir\_Mohammad](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mahathir_mohammad/32/70316_2.png) [@Mahathir\_Mohammad](https://discuss.elastic.co/u/Mahathir_Mohammad)\
**Post date:** [July 2, 2020, 3:12am UTC](https://discuss.elastic.co/t/how-to-get-and-create-users-in-elasticsearch-with-api-by-using-python/239565/1 "2020-07-02T03:12:44Z")

</div>

I want to get and create users in elasticsearch with python. I'm trying to use API. I'm following [this](https://opendistro.github.io/for-elasticsearch-docs/docs/security-access-control/api/#get-user) documentation. I send a get request with Postman in this URL:

```auto
http://localhost:9200/_opendistro/_security/api/internalusers/

```

I send this request for getting users but I got this error message:

```auto
{
    "error": "no handler found for uri [/opendistro/security/api/internalusers] and method [GET]"
}

```

I also want to create a user with username and email but here I found this for creating user:

```auto
{
  "password": "kirkpass",
  "backend_roles": ["captains", "starfleet"],
  "attributes": {
    "attribute1": "value1",
    "attribute2": "value2"
  }
}

```

There are no options for username and password

my two questions are:

1. Why I'm getting an error when I try to get users?
2. How can I create users with username and email by using an API

---

<div class="post-metadata">

**Author:** ![Wolfram\_Haussig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wolfram_haussig/32/70528_2.png) [@Wolfram\_Haussig](https://discuss.elastic.co/u/Wolfram_Haussig)\
**Post date:** [July 2, 2020, 5:12am UTC](https://discuss.elastic.co/t/how-to-get-and-create-users-in-elasticsearch-with-api-by-using-python/239565/2 "2020-07-02T05:12:26Z")

</div>

Hi,

Do you have an openDistro installation? In this case you should ask here: [https://discuss.opendistrocommunity.dev/](https://discuss.opendistrocommunity.dev/)

Be aware that openDistro of ElasticSearch is not the same as the one available by elastic. If you have an Elastic Installation you can check the API here:  
[https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-user.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-user.html)  
[https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-user.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-user.html)

This requires that you have at least the ElasticSearch [Basic](https://www.elastic.co/de/subscriptions) License[(when using 6.8.0 or later or 7.1.0 or later)](https://www.elastic.co/de/blog/security-for-elasticsearch-is-now-free) or a Gold License.

Best regards  
Wolfram

---

<div class="post-metadata">

**Author:** ![Mahathir\_Mohammad](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mahathir_mohammad/32/70316_2.png) [@Mahathir\_Mohammad](https://discuss.elastic.co/u/Mahathir_Mohammad)\
**Post date:** [July 2, 2020, 5:51am UTC](https://discuss.elastic.co/t/how-to-get-and-create-users-in-elasticsearch-with-api-by-using-python/239565/3 "2020-07-02T05:51:33Z")

</div>

Thanks. I got my mistake. I thought openDistro is an inbuilt plugin of elasticsearch. Now, I'll install it.

---

<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:** [July 30, 2020, 5:51am UTC](https://discuss.elastic.co/t/how-to-get-and-create-users-in-elasticsearch-with-api-by-using-python/239565/4 "2020-07-30T05:51:35Z")

</div>

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