ApiError AuthenticationException even correct API Key is provided

Hello,

2nd day trial Elasticsearch Cloud. I have my Cloud API keys from "Organization > API Keys > Create API key". I am doing the chatbot tutorial.

This is my credentials and they will be removed once the problem is solved. I am pasting it here to identify what is going wrong. Please feel free to try my credentials on your own to solve this problem.

ELASTIC_CLOUD_ID="CLOUD_ID"

ELASTIC_API_KEY="API_KEY"
    raise HTTP_EXCEPTIONS.get(meta.status, ApiError)(
elasticsearch.AuthenticationException: AuthenticationException(401, 'security_exception', 'unable to authenticate with provided credentials and anonymous access is not allowed for this request')

The credentials should be correct. Can anyone tell why is there an authentication error?

Thank you in advance.

Hi @tfulanchan Welcome to the community.

Kinda a common mistake when getting started.

That creates An API Key for using The ESS / Elastic Cloud API to create and modify whole clusters. Etc.

To work within an Elasticsearch cluster...I.e the REST API to load data and work inside an Elasticsearch cluster

Go to
Kibana - Stack Management - API Keys

Make sure you get the correct format for the REST API

1 Like

Hi @tfulanchan

I've removed your keys in your post and highly encourage you to delete the api key. Please dont post api-keys publicly so others are able to perform requests on your behalf.

See this page for creating an API key Elastic Cloud — Elastic Search Labs

1 Like

This is exactly where the confusion was and the answer I was looking for. Let's hope that these two will be named differently in the future to avoid confusion for Usability concerns.

Thank you Elastic!

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