Skip to main content
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": "docs-example1-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": "docs-example2-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": "docs-example1-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": "docs-example2-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

Body

application/json
name
string
required
Required string length: 1 - 45
Example:
dimension
integer
required
Required range: 1 <= x <= 20000
Example:
spec
object
required
  • Option 1
  • Option 2
metric
enum<string>
default:cosine
Available options:
cosine,
euclidean,
dotproduct
deletion_protection
enum<string>
default:disabled
Available options:
disabled,
enabled

Response

name
string
required
Required string length: 1 - 45
Example:
dimension
integer
required
Required range: 1 <= x <= 20000
Example:
metric
enum<string>
default:cosine
required
Available options:
cosine,
euclidean,
dotproduct
host
string
required
Example:
spec
object
required
Example:
status
object
required
Example:
deletion_protection
enum<string>
default:disabled
Available options:
disabled,
enabled