# What is the string id under the ApiKeyAuthenticationCredential .Net API referring to

**URL:** <https://discuss.elastic.co/t/what-is-the-string-id-under-the-apikeyauthenticationcredential-net-api-referring-to/298207>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [February 24, 2022, 5:54pm UTC](https://discuss.elastic.co/t/what-is-the-string-id-under-the-apikeyauthenticationcredential-net-api-referring-to/298207 "2022-02-24T17:54:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raymond\_Lei](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/raymond_lei/32/101376_2.png) [@Raymond\_Lei](https://discuss.elastic.co/u/Raymond_Lei)\
**Post date:** [February 24, 2022, 5:54pm UTC](https://discuss.elastic.co/t/what-is-the-string-id-under-the-apikeyauthenticationcredential-net-api-referring-to/298207/1 "2022-02-24T17:54:47Z")

</div>

Hello, within the .Net API, one of the constructor for new ApiKeyAuthenticationCredentials wants me to supply string id and the string apikey for the authentication. I am wondering what is it looking for? I tried the different string: the endpoint string, "search-key", "Authorization", "X-API-KEY"

---

<div class="post-metadata">

**Author:** ![stevejgordon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stevejgordon/32/80912_2.png) [@stevejgordon](https://discuss.elastic.co/u/stevejgordon)\
**Post date:** [February 25, 2022, 7:25am UTC](https://discuss.elastic.co/t/what-is-the-string-id-under-the-apikeyauthenticationcredential-net-api-referring-to/298207/2 "2022-02-25T07:25:17Z")

</div>

Hi, @Raymond_Lei. When you create an API key in Elasticsearch, you receive the following response:

```auto
{
  "id": "VuaCfGcBCdbkQm-e5aOx",        
  "name": "my-api-key",
  "expiration": 1544068612110,         
  "api_key": "ui2lp2axTNmsyakw9tvNnw", 
  "encoded": "VnVhQ2ZHY0JDZGJrUW0tZTVhT3g6dWkybHAyYXhUTm1zeWFrdzl0dk5udw=="  
}

```

The `ApiKeyAuthenticationCredentials` type accepts either, the `id` + `api_key` values as parameters, in which case the client handles concatenating those and encoding them for use when authenticating. You may also choose the overload which accepts a single string for the `encoded` key. So you may choose whichever best fits your scenario.

---

<div class="post-metadata">

**Author:** ![Raymond\_Lei](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/raymond_lei/32/101376_2.png) [@Raymond\_Lei](https://discuss.elastic.co/u/Raymond_Lei)\
**Post date:** [February 25, 2022, 7:02pm UTC](https://discuss.elastic.co/t/what-is-the-string-id-under-the-apikeyauthenticationcredential-net-api-referring-to/298207/3 "2022-02-25T19:02:12Z")

</div>

Thank you!

I have more question, is there a different between Elasticsearch API Client vs Enterprise App Search Client? Is the ElasticsSearch .NET client interchangeable between the two? or it is only for the former?

If not, is .Net Client supported for the latter? I didn't find the .Net client from the following page:  
[Programming language clients | Elastic Enterprise Search Documentation [8.0] | Elastic](https://www.elastic.co/guide/en/enterprise-search/8.0/programming-language-clients.html#programming-language-clients-app-search-javascript)

Thank you again

---

<div class="post-metadata">

**Author:** ![stevejgordon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stevejgordon/32/80912_2.png) [@stevejgordon](https://discuss.elastic.co/u/stevejgordon)\
**Post date:** [March 18, 2022, 10:28am UTC](https://discuss.elastic.co/t/what-is-the-string-id-under-the-apikeyauthenticationcredential-net-api-referring-to/298207/4 "2022-03-18T10:28:28Z")

</div>

Hey @Raymond_Lei. Sorry for the delay.

The current client is specifically for Elasticsearch. We don't currently have an Enterprise Search client for .NET but it is on the roadmap.

---

<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 15, 2022, 10:28am UTC](https://discuss.elastic.co/t/what-is-the-string-id-under-the-apikeyauthenticationcredential-net-api-referring-to/298207/5 "2022-04-15T10:28:49Z")

</div>

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