# Unable to use RESTful API in Elastic Cloud with curl

**URL:** <https://discuss.elastic.co/t/unable-to-use-restful-api-in-elastic-cloud-with-curl/299358>\
**Category:** Elasticsearch\
**Created:** [March 10, 2022, 4:46pm UTC](https://discuss.elastic.co/t/unable-to-use-restful-api-in-elastic-cloud-with-curl/299358 "2022-03-10T16:46:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Conor\_Hennessy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/conor_hennessy/32/91354_2.png) [@Conor\_Hennessy](https://discuss.elastic.co/u/Conor_Hennessy)\
**Post date:** [March 10, 2022, 4:46pm UTC](https://discuss.elastic.co/t/unable-to-use-restful-api-in-elastic-cloud-with-curl/299358/1 "2022-03-10T16:46:22Z")

</div>

Hi,

I have a deployment on Elastic Cloud with an endpoint of the form:  
https://my\_host\_name.es.westusa.azure.elastic-cloud.com

I wish to use the api to edit the extensions, specifically to add a synonyms file, using curl from the command line.

Following the guidelines from the documentation [here](https://ttps://www.elastic.co/guide/en/cloud/current/ec-restful-api-command-line.html), I should be able to access deployments in the following way:

`curl -H "Authorization: ApiKey $EC_API_KEY" https://api.elastic-cloud.com/api/v1/deployments`

However any request to this api returns:

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

My Api Key is valid for any queries directly to the deployment endpoint, so I don't understand why we can't use the api of the form

`https://api.elastic-cloud.com/api/v1/...`

Thank you in advance

---

<div class="post-metadata">

**Author:** ![Conor\_Hennessy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/conor_hennessy/32/91354_2.png) [@Conor\_Hennessy](https://discuss.elastic.co/u/Conor_Hennessy)\
**Post date:** [March 11, 2022, 8:28am UTC](https://discuss.elastic.co/t/unable-to-use-restful-api-in-elastic-cloud-with-curl/299358/2 "2022-03-11T08:28:10Z")

</div>

SOLVED: keys created by via rest did not work for using deployments API - they don't appear in elastic cloud console. Creating a new key in the console itself allowed us to use the api

---

<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 8, 2022, 8:28am UTC](https://discuss.elastic.co/t/unable-to-use-restful-api-in-elastic-cloud-with-curl/299358/3 "2022-04-08T08:28:28Z")

</div>

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