# ECE & Watcher: Trouble sending API key to ECE

**URL:** https://discuss.elastic.co/t/ece-watcher-trouble-sending-api-key-to-ece/300980
**Category:** Elasticsearch
**Created:** [March 29, 2022, 2:20pm UTC](https://discuss.elastic.co/t/ece-watcher-trouble-sending-api-key-to-ece/300980 "2022-03-29T14:20:15Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Apprentice](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@Apprentice](https://discuss.elastic.co/u/Apprentice)
#### Post date: [March 29, 2022, 2:20pm UTC](https://discuss.elastic.co/t/ece-watcher-trouble-sending-api-key-to-ece/300980/1 "2022-03-29T14:20:15Z")

</div>

I am trying to create a Watcher using information from the ECE API as input. However I am having trouble getting authenticated. This is the Input for the watcher:

```auto
"input": {
    "http" : {
      "request" : {
        "scheme" : "https",
        "host" : "[URL Here]",
        "port" : 12443,
        "path" : "/api/v1/platform/infrastructure/allocators",
        "method" : "get",
        "headers":{
          "Authorization" : "ApiKey [Key Here]"
        }
      }
    }
  },

```

The error:

```auto
        "_status_code": 401,
        "errors": [
          {
            "code": "root.unauthenticated",
            "message": "The supplied authentication is invalid"
          }
        ]

```

Which is very odd as I am able to get the expected response using Curl and Postman, both use the same header info as above:

Postman:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/d/8d4903a079ae3416a4e51bb388d07bb944e78ee4.png)

Curl Command:

```auto
curl -k -X GET -H "Authorization: ApiKey [Key value here]" https://[URL here]:12443/api/v1/platform/infrastructure/allocators

```

So I was hoping someone here could help me figure out how to properly send my API key to get authenticaed.

---

<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: [April 26, 2022, 2:20pm UTC](https://discuss.elastic.co/t/ece-watcher-trouble-sending-api-key-to-ece/300980/2 "2022-04-26T14:20:24Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Guillaume\_Dufrenne](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/guillaume_dufrenne/32/103641_2.png) [@Guillaume\_Dufrenne](https://discuss.elastic.co/u/Guillaume_Dufrenne)
#### Post date: [July 13, 2023, 1:05pm UTC](https://discuss.elastic.co/t/ece-watcher-trouble-sending-api-key-to-ece/300980/3 "2023-07-13T13:05:45Z")

</div>

Hello,  
This problem happen when you use invalid credentials at a moment .This means that all subsequent executions of the watch will result in errors, even if the credentials are correct.  
This issue has been fixed [here](https://github.com/elastic/elasticsearch/pull/97591)  
The workaround is to restart the elasticsearch cluster to clear the watcher cookies
