﻿---
title: Get your Elasticsearch endpoint and API key
description: Find your {{es}} endpoint and create an API key so you can connect a search client.
url: https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/8603/solutions/search/set-up/api-key-and-endpoints
products:
  - Elastic Documentation
applies_to:
  - Elastic Cloud Serverless: Generally available
  - Elastic Stack: Generally available
---

# Get your Elasticsearch endpoint and API key
If you want to work with Elasticsearch programmatically, you need an endpoint URL and an API key. This page shows how to find the endpoint and create an API key for each deployment type.

## Before you begin

- You need access to your deployment or project, such as an Elasticsearch Vector Database project, an Elasticsearch project, or an Elastic Cloud Hosted deployment. If you don't have one yet, refer to [Get Elasticsearch running for search](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/8603/solutions/search/set-up/get-elasticsearch-running-for-search).
- To create an API key, you need the `manage_api_key` or the `manage_own_api_key` cluster privilege. If you created the deployment or project, you already have this privilege. If you sign in as a different user, an administrator needs to grant it. In this case, refer to [Users and roles](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/8603/deploy-manage/users-roles).


## Find your Elasticsearch endpoint

The Elasticsearch endpoint is the URL your client uses to send requests. Where you find it depends on your deployment type. The following steps show you where to copy it.
<applies-switch>
  <applies-item title="serverless: ga" applies-to="Elastic Cloud Serverless: Generally available">
    Copy the Elasticsearch endpoint for your project from the project UI or the Elastic Cloud Console.
    <tab-set>
      <tab-item title="Project UI">
        1. In the [Elastic Cloud Console](https://cloud.elastic.co?page=docs&placement=docs-body), find your project and select **Open**.
        2. From the **Help menu** `question` or the project selector in the header, select **Connection details**.
        3. On the **Endpoints** tab, copy the **Elasticsearch endpoint**.

        ![The Connection details panel showing the Elasticsearch endpoint on the Endpoints tab, with the Show Cloud ID toggle and the API key tab](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/8603/solutions/images/kibana-connection-details-endpoints.png)
      </tab-item>

      <tab-item title="Elastic Cloud Console">
        1. In the [Elastic Cloud Console](https://cloud.elastic.co?page=docs&placement=docs-body), find your project and select **Manage**.
        2. Under **Application endpoints**, select **Elasticsearch**.
        3. Copy the **Direct endpoint** value.

        ![The Application endpoints panel in the Elastic Cloud Console, with Elasticsearch expanded to show the Direct endpoint and Direct Azure Private Link endpoint](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/8603/solutions/images/cloud-console-serverless-endpoint.png)
        Azure and AWS also offer an endpoint you can use to connect to the deployment over a private connection. [Learn more about private connectivity](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/8603/deploy-manage/security/private-connectivity).
      </tab-item>
    </tab-set>
  </applies-item>

  <applies-item title="ech: ga" applies-to="Elastic Cloud Hosted: Generally available">
    Copy the Elasticsearch endpoint for Elastic Cloud Hosted from the deployment UI or the Elastic Cloud Console.
    <tab-set>
      <tab-item title="Kibana UI">
        1. In the [Elastic Cloud Console](https://cloud.elastic.co?page=docs&placement=docs-body), find your deployment and select **Open**.
        2. From the **Help menu** `question`, select **Connection details**.
        3. On the **Endpoints** tab, copy the **Elasticsearch endpoint** value.

        ![The Connection details panel showing the Elasticsearch endpoint on the Endpoints tab, with the Show Cloud ID toggle and the API key tab](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/8603/solutions/images/kibana-connection-details-endpoints.png)

        <tip>
          When the space uses the **Elasticsearch** solution view, the **Getting started** page shows the endpoint directly.
        </tip>
      </tab-item>

      <tab-item title="Elastic Cloud Console">
        1. In the [Elastic Cloud Console](https://cloud.elastic.co?page=docs&placement=docs-body), find your deployment and select **Manage**.
        2. Under **Application endpoints, cluster and component IDs**, select **Elasticsearch**.
        3. Copy the **Direct endpoint** value.

        ![The Application endpoints, cluster and component IDs panel in the Elastic Cloud Console, with Elasticsearch expanded to show the Endpoint, Direct endpoint, and Cluster ID](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/8603/solutions/images/cloud-console-hosted-endpoint.png)
      </tab-item>
    </tab-set>
  </applies-item>

  <applies-item title="ece: ga" applies-to="Elastic Cloud Enterprise: Generally available">
    <tab-set>
      <tab-item title="Kibana">
        For Elastic Cloud Enterprise, your endpoint details are in the **Connection details** panel in Kibana.
        1. Open Kibana for your deployment.
        2. From the **Help menu** `question`, select **Connection details**.
        3. Copy the **Elasticsearch endpoint** from the **Endpoints** tab.

        ![The Connection details panel showing the Elasticsearch endpoint on the Endpoints tab, with the Show Cloud ID toggle and the API key tab](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/8603/solutions/images/kibana-connection-details-endpoints.png)

        <tip>
          When the space uses the **Elasticsearch** solution view, the **Getting started** page shows the endpoint directly.
        </tip>
      </tab-item>

      <tab-item title="Cloud UI">
        To connect to your Elasticsearch cluster, copy the **Elasticsearch endpoint** from the deployment page in the [Cloud UI](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/8603/deploy-manage/deploy/cloud-enterprise/log-into-cloud-ui).
      </tab-item>
    </tab-set>
  </applies-item>

  <applies-item title="{"deployment": {"self": "ga"}}" applies-to="Self-managed Elastic deployments: Generally available">
    For a self-managed cluster, one you install and manage, your endpoint takes the form `<scheme>://<host>:<port>`. Each part comes from your cluster's HTTP settings:
    - **Scheme**: `https` when TLS is enabled on the HTTP layer, and `http` when it isn't. TLS is enabled by default on first startup through [automatic security setup](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/8603/deploy-manage/security/self-auto-setup), unless the setup is [explicitly skipped](/elastic/docs-content/pull/8603/deploy-manage/security/self-auto-setup#stack-skip-auto-configuration) or disabled, as in the local development quickstart.
    - **Host**: The address clients use to reach the node, set by [`http.host` or `network.host`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/tree/main/reference/elasticsearch/configuration-reference/networking-settings).
    - **Port**: The HTTP port, set by [`http.port`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/tree/main/reference/elasticsearch/configuration-reference/networking-settings). It defaults to the range `9200-9300`, and a node binds to the first free port in that range.
    For example, a single-node cluster from the [local development quickstart](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/8603/deploy-manage/deploy/self-managed/local-development-installation-quickstart) runs without TLS on the default port, so its endpoint is `http://localhost:9200`.If clients reach your cluster through a load balancer, reverse proxy, or ingress, use that address rather than the node address.
  </applies-item>

  <applies-item title="{"deployment": {"eck": "ga"}}" applies-to="Elastic Cloud on Kubernetes: Generally available">
    The ECK operator automatically creates a service for your Elasticsearch cluster with TLS enabled. Your endpoint URL depends on where your application runs:
    - **Inside the same Kubernetes namespace**: `https://<cluster-name>-es-http:9200`
    - **In a different namespace**: `https://<cluster-name>-es-http.<namespace>.svc:9200`
    - **Outside the Kubernetes cluster**: You need to expose the service first. Refer to [Access the endpoint](/elastic/docs-content/pull/8603/deploy-manage/deploy/cloud-on-k8s/accessing-services#k8s-request-elasticsearch-endpoint) for setup steps.
    To find your cluster name, run `kubectl get svc` and look for the service ending in `-es-http`.
  </applies-item>
</applies-switch>


## Create an API key

A personal API key authenticates your client with your own privileges when it sends requests to Elasticsearch. The following steps show you where to create one for your deployment type.
<applies-switch>
  <applies-item title="serverless: ga" applies-to="Elastic Cloud Serverless: Generally available">
    Follow these steps to create an API key for your project.
    1. In the [Elastic Cloud Console](https://cloud.elastic.co?page=docs&placement=docs-body), find your project and select **Open**.
    2. From the **Help menu** `question`, select **Connection details**.
    3. Select the **API key** tab.
    4. In the **API key name** field, enter a name, then select **Create API key**.
    5. Select an **API key format**: **Encoded** for Elasticsearch REST API requests, or **Beats** or **Logstash** to configure those products.
    6. Copy the key. It isn't available after you close the panel.
    Keys created here expire in 90 days and carry your own privileges. To set an expiration or restrict privileges, select **Manage API keys** and create the key there instead.
    <note>
      You can also use an [Elastic Cloud API key](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/8603/deploy-manage/api-keys/elastic-cloud-api-keys) to access Elasticsearch. Use it when the same key needs to access more than one project, or when you use [cross-project search](/elastic/docs-content/pull/8603/deploy-manage/cross-project-search-config/cps-config-access-and-scope#manage-user-and-api-key-access).
    </note>
  </applies-item>

  <applies-item title="ech: ga" applies-to="Elastic Cloud Hosted: Generally available">
    Follow these steps to create an API key for Elastic Cloud Hosted.
    1. In the [Elastic Cloud Console](https://cloud.elastic.co?page=docs&placement=docs-body), find your deployment and select **Open**.
    2. From the **Help menu** `question`, select **Connection details**.
    3. Select the **API key** tab.
    4. In the **API key name** field, enter a name, then select **Create API key**.
    5. Select an **API key format**: **Encoded** for Elasticsearch REST API requests, or **Beats** or **Logstash** to configure those products.
    6. Copy the key. It isn't available after you close the panel.
    Keys created here expire in 90 days and carry your own privileges. To set an expiration or restrict privileges, select **Manage API keys** and create the key there instead.
  </applies-item>

  <applies-item title="ece: ga" applies-to="Elastic Cloud Enterprise: Generally available">
    Follow these steps to create an API key for Elastic Cloud Enterprise.
    1. Open Kibana for your deployment or project.
    2. From the **Help menu** `question`, select **Connection details**.
    3. Select the **API key** tab.
    4. In the **API key name** field, enter a name, then select **Create API key**.
    5. Select an **API key format**: **Encoded** for Elasticsearch REST API requests, or **Beats** or **Logstash** to configure those products.
    6. Copy the key. It isn't available after you close the panel.
    Keys created here expire in 90 days and carry your own privileges. To set an expiration or restrict privileges, select **Manage API keys** and create the key there instead.
  </applies-item>

  <applies-item title="{"deployment": {"self": "ga"}}" applies-to="Self-managed Elastic deployments: Generally available">
    Follow these steps to create an API key for a self-managed cluster, one you install and manage.
    1. Go to the **API keys** management page, using the [global search field](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/8603/explore-analyze/find-and-organize/find-apps-and-objects) to find it.
    2. Select **Create API key**.
    3. Enter a name, then select **Create API key**.
    4. Copy the key. It isn't available after you leave the page.
    Keys created here don't expire unless you add an expiration date.
  </applies-item>

  <applies-item title="{"deployment": {"eck": "ga"}}" applies-to="Elastic Cloud on Kubernetes: Generally available">
    Follow these steps to create an API key for Elastic Cloud on Kubernetes.
    1. Go to the **API keys** management page, using the [global search field](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/8603/explore-analyze/find-and-organize/find-apps-and-objects) to find it.
    2. Select **Create API key**.
    3. Enter a name, then select **Create API key**.
    4. Copy the key. It isn't available after you leave the page.
    Keys created here don't expire unless you add an expiration date.
  </applies-item>
</applies-switch>

For privileges and expiration options, refer to [Elastic API keys](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/8603/deploy-manage/api-keys).
<tip>
  If you just created a Serverless project, the **Getting started** `rocket` page shows a generated API key that you can copy immediately. If you have navigated away from that page, create a new API key as described above.
</tip>


## Next step

After you have an endpoint and an API key, connect a language client in [Connect to Elasticsearch with an SDK](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/8603/solutions/search/set-up/connect-with-an-sdk).