POST
/
indexes
# pip install "pinecone[grpc]"
# Serverless index
from pinecone.grpc import PineconeGRPC as Pinecone
from pinecone import ServerlessSpec

pc = Pinecone(api_key="YOUR_API_KEY")

pc.create_index(
  name="docs-example1",
  dimension=1536,
  metric="cosine",
  spec=ServerlessSpec(
    cloud="aws",
    region="us-east-1",
  ),
  deletion_protection="disabled"
)

# Pod-based index
from pinecone.grpc import PineconeGRPC as Pinecone, PodSpec

pc = Pinecone(api_key="YOUR_API_KEY")

pc.create_index(
  name="docs-example2",
  dimension=1536,
  metric="cosine",
  spec=PodSpec(
    environment="us-west1-gcp",
    pod_type="p1.x1",
    pods=1,
  ),
  deletion_protection="disabled"
)
# Serverless index
{
    "name": "docs-example1",
    "metric": "cosine",
    "dimension": 1536,
    "status": {
        "ready": true,
        "state": "Ready"
    },
    "host": "example-index1-4zo0ijk.svc.dev-us-west2-aws.pinecone.io",
    "spec": {
        "serverless": {
            "region": "us-east-1",
            "cloud": "aws"
        }
    }
}

# Pod-based index
{
    "name": "docs-example2",
    "metric": "cosine",
    "dimension": 1536,
    "status": {
        "ready": true,
        "state": "Ready"
    },
    "host": "example-index2-4zo0ijk.svc.us-west1-gcp.pinecone.io",
    "spec": {
        "pod": {
            "replicas": 1,
            "shards": 1,
            "pods": 1,
            "pod_type": "p1.x1",
            "environment": "us-west1-gcp"
        }
    }
}
# pip install "pinecone[grpc]"
# Serverless index
from pinecone.grpc import PineconeGRPC as Pinecone
from pinecone import ServerlessSpec

pc = Pinecone(api_key="YOUR_API_KEY")

pc.create_index(
  name="docs-example1",
  dimension=1536,
  metric="cosine",
  spec=ServerlessSpec(
    cloud="aws",
    region="us-east-1",
  ),
  deletion_protection="disabled"
)

# Pod-based index
from pinecone.grpc import PineconeGRPC as Pinecone, PodSpec

pc = Pinecone(api_key="YOUR_API_KEY")

pc.create_index(
  name="docs-example2",
  dimension=1536,
  metric="cosine",
  spec=PodSpec(
    environment="us-west1-gcp",
    pod_type="p1.x1",
    pods=1,
  ),
  deletion_protection="disabled"
)
# Serverless index
{
    "name": "docs-example1",
    "metric": "cosine",
    "dimension": 1536,
    "status": {
        "ready": true,
        "state": "Ready"
    },
    "host": "example-index1-4zo0ijk.svc.dev-us-west2-aws.pinecone.io",
    "spec": {
        "serverless": {
            "region": "us-east-1",
            "cloud": "aws"
        }
    }
}

# Pod-based index
{
    "name": "docs-example2",
    "metric": "cosine",
    "dimension": 1536,
    "status": {
        "ready": true,
        "state": "Ready"
    },
    "host": "example-index2-4zo0ijk.svc.us-west1-gcp.pinecone.io",
    "spec": {
        "pod": {
            "replicas": 1,
            "shards": 1,
            "pods": 1,
            "pod_type": "p1.x1",
            "environment": "us-west1-gcp"
        }
    }
}

Authorizations

Api-Key
string
header
required

An API Key is required to call Pinecone APIs. Get yours from the console.

Body

application/json
The desired configuration for the index.

The configuration needed to create a Pinecone index.

Response

201
application/json
The index has been successfully created.

The IndexModel describes the configuration and status of a Pinecone index.