# pip install "pinecone[grpc]"
from pinecone.grpc import PineconeGRPC as Pinecone
pc = Pinecone(api_key="API_KEY")
pc.create_collection("example-collection", "docs-example")
// npm install @pinecone-database/pinecone
import { Pinecone } from '@pinecone-database/pinecone'
const pc = new Pinecone({
apiKey: 'YOUR_API_KEY'
});
await pc.createCollection({
name: "example-collection",
source: "docs-example",
});
import io.pinecone.clients.Pinecone;
public class CreateCollectionExample {
public static void main(String[] args) {
Pinecone pc = new Pinecone.Builder("YOUR_API_KEY").build();
pc.createCollection("example-collection", "docs-example");
}
}
package main
import (
"context"
"fmt"
"log"
"github.com/pinecone-io/go-pinecone/v2/pinecone"
)
func main() {
ctx := context.Background()
pc, err := pinecone.NewClient(pinecone.NewClientParams{
ApiKey: "YOUR_API_KEY",
})
if err != nil {
log.Fatalf("Failed to create Client: %v", err)
}
collection, err := pc.CreateCollection(ctx, &pinecone.CreateCollectionRequest{
Name: "example-collection",
Source: "docs-example",
})
if err != nil {
log.Fatalf("Failed to create collection: %v", err)
} else {
fmt.Printf("Successfully created collection: %v", collection.Name)
}
}
using Pinecone;
var pinecone = new PineconeClient("YOUR_API_KEY");
var collectionModel = await pinecone.CreateCollectionAsync(new CreateCollectionRequest {
Name = "example-collection",
Source = "docs-example",
});
PINECONE_API_KEY="YOUR_API_KEY"
curl -s "https://api.pinecone.io/collections" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Api-Key: $PINECONE_API_KEY" \
-H "X-Pinecone-Api-Version: 2024-10" \
-d '{
"name": "example-collection",
"source": "docs-example"
}'
{
"name": "example-collection",
"status": "Initializing",
"environment": "us-east-1-aws",
"dimension": 1536
}
Create a collection
This operation creates a Pinecone collection.
Serverless indexes do not support collections.
# pip install "pinecone[grpc]"
from pinecone.grpc import PineconeGRPC as Pinecone
pc = Pinecone(api_key="API_KEY")
pc.create_collection("example-collection", "docs-example")
// npm install @pinecone-database/pinecone
import { Pinecone } from '@pinecone-database/pinecone'
const pc = new Pinecone({
apiKey: 'YOUR_API_KEY'
});
await pc.createCollection({
name: "example-collection",
source: "docs-example",
});
import io.pinecone.clients.Pinecone;
public class CreateCollectionExample {
public static void main(String[] args) {
Pinecone pc = new Pinecone.Builder("YOUR_API_KEY").build();
pc.createCollection("example-collection", "docs-example");
}
}
package main
import (
"context"
"fmt"
"log"
"github.com/pinecone-io/go-pinecone/v2/pinecone"
)
func main() {
ctx := context.Background()
pc, err := pinecone.NewClient(pinecone.NewClientParams{
ApiKey: "YOUR_API_KEY",
})
if err != nil {
log.Fatalf("Failed to create Client: %v", err)
}
collection, err := pc.CreateCollection(ctx, &pinecone.CreateCollectionRequest{
Name: "example-collection",
Source: "docs-example",
})
if err != nil {
log.Fatalf("Failed to create collection: %v", err)
} else {
fmt.Printf("Successfully created collection: %v", collection.Name)
}
}
using Pinecone;
var pinecone = new PineconeClient("YOUR_API_KEY");
var collectionModel = await pinecone.CreateCollectionAsync(new CreateCollectionRequest {
Name = "example-collection",
Source = "docs-example",
});
PINECONE_API_KEY="YOUR_API_KEY"
curl -s "https://api.pinecone.io/collections" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Api-Key: $PINECONE_API_KEY" \
-H "X-Pinecone-Api-Version: 2024-10" \
-d '{
"name": "example-collection",
"source": "docs-example"
}'
{
"name": "example-collection",
"status": "Initializing",
"environment": "us-east-1-aws",
"dimension": 1536
}
# pip install "pinecone[grpc]"
from pinecone.grpc import PineconeGRPC as Pinecone
pc = Pinecone(api_key="API_KEY")
pc.create_collection("example-collection", "docs-example")
// npm install @pinecone-database/pinecone
import { Pinecone } from '@pinecone-database/pinecone'
const pc = new Pinecone({
apiKey: 'YOUR_API_KEY'
});
await pc.createCollection({
name: "example-collection",
source: "docs-example",
});
import io.pinecone.clients.Pinecone;
public class CreateCollectionExample {
public static void main(String[] args) {
Pinecone pc = new Pinecone.Builder("YOUR_API_KEY").build();
pc.createCollection("example-collection", "docs-example");
}
}
package main
import (
"context"
"fmt"
"log"
"github.com/pinecone-io/go-pinecone/v2/pinecone"
)
func main() {
ctx := context.Background()
pc, err := pinecone.NewClient(pinecone.NewClientParams{
ApiKey: "YOUR_API_KEY",
})
if err != nil {
log.Fatalf("Failed to create Client: %v", err)
}
collection, err := pc.CreateCollection(ctx, &pinecone.CreateCollectionRequest{
Name: "example-collection",
Source: "docs-example",
})
if err != nil {
log.Fatalf("Failed to create collection: %v", err)
} else {
fmt.Printf("Successfully created collection: %v", collection.Name)
}
}
using Pinecone;
var pinecone = new PineconeClient("YOUR_API_KEY");
var collectionModel = await pinecone.CreateCollectionAsync(new CreateCollectionRequest {
Name = "example-collection",
Source = "docs-example",
});
PINECONE_API_KEY="YOUR_API_KEY"
curl -s "https://api.pinecone.io/collections" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Api-Key: $PINECONE_API_KEY" \
-H "X-Pinecone-Api-Version: 2024-10" \
-d '{
"name": "example-collection",
"source": "docs-example"
}'
{
"name": "example-collection",
"status": "Initializing",
"environment": "us-east-1-aws",
"dimension": 1536
}
Authorizations
Body
The desired configuration for the collection.
The configuration needed to create a Pinecone collection.
The name of the collection to be created. Resource name must be 1-45 characters long, start and end with an alphanumeric character, and consist only of lower case alphanumeric characters or '-'.
1 - 45The name of the index to be used as the source for the collection.
"example-source-index"
Response
The collection has been successfully created.
The CollectionModel describes the configuration and status of a Pinecone collection.
The name of the collection.
"example-collection"
The status of the collection.
Initializing, Ready, Terminating "Initializing"
The environment where the collection is hosted.
"us-east1-gcp"
The size of the collection in bytes.
10000000
The dimension of the vectors stored in each record held in the collection.
1 <= x <= 200001536
The number of records stored in the collection.
120000
Was this page helpful?