# Unable to create api key

**URL:** https://discuss.elastic.co/t/unable-to-create-api-key/271603
**Category:** APM
**Tags:** server
**Created:** [April 29, 2021, 8:38am UTC](https://discuss.elastic.co/t/unable-to-create-api-key/271603 "2021-04-29T08:38:26Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![samueliako](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@samueliako](https://discuss.elastic.co/u/samueliako)
#### Post date: [April 29, 2021, 8:38am UTC](https://discuss.elastic.co/t/unable-to-create-api-key/271603/1 "2021-04-29T08:38:26Z")

</div>

Hi all,  
I have problem with generating api key using this command "#sudo -u apm-server apm-server apikey create --name user1-key". I'm receiving this error:

```auto
{"error":{"root_cause":[{"type":"feature_not_enabled_exception","reason":"api keys are not enabled","disabled.feature":"api_keys"}],"type":"feature_not_enabled_exception","reason":"api keys are not enabled","disabled.feature":"api_keys"},"status":400}

```

But api key is enabled in apm-server.yml config file. Here is output of "#sudo -u apm-server apm-server export config" command:

```auto
apm-server:
  api_key:
    enabled: true
    limit: 100
  host: elasticapm.node:8200
logging:
  ecs: true
  json: true
  metrics:
    enabled: false
output:
  elasticsearch:
    hosts:
    - elastic.node:9200
    password: ***
    username: apmtech
path:
  config: /etc/apm-server
  data: /var/lib/apm-server
  home: /usr/share/apm-server
  logs: /var/log/apm-server

```

APM server version is 7.12.1  
Does anyone have any suggestion what is wrong?

---

<div class="post-metadata">

### Author: ![simitt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simitt/32/106406_2.png) [@simitt](https://discuss.elastic.co/u/simitt)
#### Post date: [April 29, 2021, 6:55pm UTC](https://discuss.elastic.co/t/unable-to-create-api-key/271603/2 "2021-04-29T18:55:11Z")

</div>

Hi @samueliako ,  
please ensure that [API Key support is enabled in Elasticsearch](https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-create-api-key.html#security-api-create-api-key-desc), otherwise the APM Server CLI tool cannot create any API Keys.

---

<div class="post-metadata">

### Author: ![samueliako](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@samueliako](https://discuss.elastic.co/u/samueliako)
#### Post date: [May 5, 2021, 5:47am UTC](https://discuss.elastic.co/t/unable-to-create-api-key/271603/3 "2021-05-05T05:47:24Z")

</div>

Hi @simitt,  
You are right, API Keys is not enabled in Elasticsearch. Thank you very much for your answer and showing right direction!

---

<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: [May 26, 2021, 1:48am UTC](https://discuss.elastic.co/t/unable-to-create-api-key/271603/4 "2021-05-26T01:48:08Z")

</div>

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