This page shows you how to get information about all of your indexes or about a specific index.

To learn about the concepts related to indexes, see Indexes.

List all indexes in a project

Use the list_indexes operation to get a complete description of all indexes in a project:

from pinecone import Pinecone

pc = Pinecone(api_key="YOUR_API_KEY")
pc.list_indexes()

# Response:
# {'indexes': [{'dimension': 1536,
#               'host': 'serverless-index-4zo0ijk.svc.us-west2-aws.pinecone.io',
#               'metric': 'cosine',
#               'name': 'serverless-index',
#               'spec': {'serverless': {'cloud': 'aws', 'region': 'us-east-1'}},
#               'status': {'ready': True, 'state': 'Ready'}},
#              {'dimension': 1536,
#               'host': 'pod-index-4zo0ijk.svc.us-east1-aws.pinecone.io',
#               'metric': 'cosine',
#               'name': 'pod-index',
#               'spec': {'pod': {'environment': 'us-west2-aws',
#                                'pod_type': 'p1.x1',
#                                'pods': 1,
#                                'replicas': 1,
#                                'shards': 1}},
#               'status': {'ready': True, 'state': 'Ready'}}]}

With the Python client, you can use the .names() helper function to iterate over the index names in the list_indexes() response, for example:

Python
from pinecone import Pinecone, ServerlessSpec

pc = Pinecone(api_key="YOUR_API_KEY")

index_name = "new-index"
if index_name not in pc.list_indexes().names():
  # Do something, such as create the index
  pc.create_index(
    name=index_name,
    dimension=1536,
    metric='cosine',
    spec=ServerlessSpec(
      cloud="aws",
      region="us-east-1"
    )
  )

Get information about an index

Use the describe_index operation to get a complete description of a specific index:

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-weset2-aws.pinecone.io',
#  'metric': 'cosine',
#  'name': 'serverless-index',
#  'spec': {'serverless': {'cloud': 'aws', 'region': 'us-east-1'}},
#  'status': {'ready': True, 'state': 'Ready'}}