Accessing the OpenSearch API

After exposing the OpenSearch service, you can access the OpenSearch API using the route hostname.

Procedure

To access the OpenSearch API, complete the following steps:

  1. Generate a ZenApiKey for authentication. For detailed instructions on generating ZenApiKey authorization tokens, see Generating ZenApiKey authorization tokens.
    export ZENAPIKEY=$(echo -n "<username>:<apikey>" | base64 -w 0)

    Replace <username> and <apikey> with your credentials.

  2. Test connectivity, and verify credentials for calling OpenSearch APIs:
    curl -k "https://$OPENSEARCH_HOST/" \
         -H 'Accept: application/json' \
         -H "Authorization: ZenApiKey ${ZENAPIKEY}"
    Example output
    {
      "name" : "opensearch699-coordinating-2",
      "cluster_name" : "opensearch699",
      "cluster_uuid" : "k-gor3MHQpOhsg2sB9_txw",
      "version" : {
        "distribution" : "opensearch",
        "number" : "3.2.0",
        "build_type" : "tar",
        "build_hash" : "6adc0bf476e1624190564d7fbe4aba00ccf49ad8",
        "build_date" : "2025-08-12T03:55:01.226522683Z",
        "build_snapshot" : false,
        "lucene_version" : "10.2.2",
        "minimum_wire_compatibility_version" : "2.19.0",
        "minimum_index_compatibility_version" : "2.0.0"
      },
      "tagline" : "The OpenSearch Project: https://opensearch.org/"
    }
    For more information on available OpenSearch APIs, see OpenSearch API reference.