For each Pinecone index, there is a unique DNS endpoint for performing data operations such as upsert, query, update, and delete. The Python and Node clients construct these index endpoints for you. However, when using the API directly, you need to explicitly specify these endpoints.

There are two ways to get an index endpoint for direct API calls: the Pinecone console or use the describe_index operation.

Use the Pinecone console

To get an index endpoint from the Pinecone console:

  1. Open the Pinecone console.
  2. Select the project containing the index.
  3. Select the index.
  4. Copy the URL under HOST.

Use describe_index

The describe_index operation uses a different API (api.pinecone.io) than data plane operations such as upsert and query. In production, you should therefore not rely on describe_index to programmatically get an index endpoint for data manipulation operations. Instead, you should get an index endpoint once and cache it for reuse or specify the endpoint directly.

The describe_index operation returns the index endpoint as the host value:

from pinecone import Pinecone

pc = Pinecone(api_key="YOUR_API_KEY")

pc.describe_index("serverless-index")

# Response:
# {'dimension': 1536,
#  'host': 'serverless-index-4zo0ijk.svc.us-east1-aws.pinecone.io',
#  'metric': 'cosine',
#  'name': 'serverless-index',
#  'spec': {'serverless': {'cloud': 'aws', 'region': 'us-east-1'}},
#  'status': {'ready': True, 'state': 'Ready'}}