# pip install --upgrade pinecone
import os
from pinecone import Pinecone
pc = Pinecone(api_key=os.environ["PINECONE_API_KEY"])
pc.indexes.delete(name="docs-example")
// npm install @pinecone-database/pinecone
import { Pinecone } from '@pinecone-database/pinecone';
// Reads PINECONE_API_KEY from the environment
const pc = new Pinecone();
await pc.indexes.delete('docs-example');
package main
import (
"context"
"fmt"
"log"
"os"
"github.com/pinecone-io/go-pinecone/v7/pinecone"
)
func main() {
ctx := context.Background()
pc, err := pinecone.NewClient(pinecone.NewClientParams{
ApiKey: os.Getenv("PINECONE_API_KEY"),
})
if err != nil {
log.Fatalf("Failed to create Client: %v", err)
}
err = pc.DeleteIndex(ctx, "docs-example")
if err != nil {
log.Fatalf("Failed to delete index: %v", err)
}
fmt.Println("Deleted index docs-example")
}
# Requires Terraform provider v5.0.0 or later
# This block defines the index. To delete it, either remove the block and run
# `terraform apply`, or run:
# terraform destroy -target=pinecone_index.docs_example
# If deletion protection is enabled, first set deletion_protection = "disabled"
# and run `terraform apply`, then delete the index.
resource "pinecone_index" "docs_example" {
name = "docs-example"
deployment = {
managed = {
cloud = "aws"
region = "us-east-1"
}
}
schema = {
fields = {
_values = { dense_vector = { dimension = 1536, metric = "cosine" } }
}
}
deletion_protection = "disabled"
}
PINECONE_API_KEY="YOUR_API_KEY"
curl -i -X DELETE "https://api.pinecone.io/indexes/docs-example" \
-H "Api-Key: $PINECONE_API_KEY" \
-H "X-Pinecone-Api-Version: 2026-07"
Invalid API key{
"error": {
"code": "FORBIDDEN",
"message": "Deletion protection is enabled for this index. Disable deletion protection before retrying."
},
"status": 403
}{
"error": {
"code": "NOT_FOUND",
"message": "Index example-index not found."
},
"status": 404
}{
"error": {
"code": "FAILED_PRECONDITION",
"message": "Unable to delete an index. There are pending collections for this index: ['test-collection']"
},
"status": 412
}{
"error": {
"code": "UNKNOWN",
"message": "Internal server error"
},
"status": 500
}Indexes
Delete an index
Delete an existing index.
DELETE
/
indexes
/
{index_name}
# pip install --upgrade pinecone
import os
from pinecone import Pinecone
pc = Pinecone(api_key=os.environ["PINECONE_API_KEY"])
pc.indexes.delete(name="docs-example")
// npm install @pinecone-database/pinecone
import { Pinecone } from '@pinecone-database/pinecone';
// Reads PINECONE_API_KEY from the environment
const pc = new Pinecone();
await pc.indexes.delete('docs-example');
package main
import (
"context"
"fmt"
"log"
"os"
"github.com/pinecone-io/go-pinecone/v7/pinecone"
)
func main() {
ctx := context.Background()
pc, err := pinecone.NewClient(pinecone.NewClientParams{
ApiKey: os.Getenv("PINECONE_API_KEY"),
})
if err != nil {
log.Fatalf("Failed to create Client: %v", err)
}
err = pc.DeleteIndex(ctx, "docs-example")
if err != nil {
log.Fatalf("Failed to delete index: %v", err)
}
fmt.Println("Deleted index docs-example")
}
# Requires Terraform provider v5.0.0 or later
# This block defines the index. To delete it, either remove the block and run
# `terraform apply`, or run:
# terraform destroy -target=pinecone_index.docs_example
# If deletion protection is enabled, first set deletion_protection = "disabled"
# and run `terraform apply`, then delete the index.
resource "pinecone_index" "docs_example" {
name = "docs-example"
deployment = {
managed = {
cloud = "aws"
region = "us-east-1"
}
}
schema = {
fields = {
_values = { dense_vector = { dimension = 1536, metric = "cosine" } }
}
}
deletion_protection = "disabled"
}
PINECONE_API_KEY="YOUR_API_KEY"
curl -i -X DELETE "https://api.pinecone.io/indexes/docs-example" \
-H "Api-Key: $PINECONE_API_KEY" \
-H "X-Pinecone-Api-Version: 2026-07"
Invalid API key{
"error": {
"code": "FORBIDDEN",
"message": "Deletion protection is enabled for this index. Disable deletion protection before retrying."
},
"status": 403
}{
"error": {
"code": "NOT_FOUND",
"message": "Index example-index not found."
},
"status": 404
}{
"error": {
"code": "FAILED_PRECONDITION",
"message": "Unable to delete an index. There are pending collections for this index: ['test-collection']"
},
"status": 412
}{
"error": {
"code": "UNKNOWN",
"message": "Internal server error"
},
"status": 500
}# pip install --upgrade pinecone
import os
from pinecone import Pinecone
pc = Pinecone(api_key=os.environ["PINECONE_API_KEY"])
pc.indexes.delete(name="docs-example")
// npm install @pinecone-database/pinecone
import { Pinecone } from '@pinecone-database/pinecone';
// Reads PINECONE_API_KEY from the environment
const pc = new Pinecone();
await pc.indexes.delete('docs-example');
package main
import (
"context"
"fmt"
"log"
"os"
"github.com/pinecone-io/go-pinecone/v7/pinecone"
)
func main() {
ctx := context.Background()
pc, err := pinecone.NewClient(pinecone.NewClientParams{
ApiKey: os.Getenv("PINECONE_API_KEY"),
})
if err != nil {
log.Fatalf("Failed to create Client: %v", err)
}
err = pc.DeleteIndex(ctx, "docs-example")
if err != nil {
log.Fatalf("Failed to delete index: %v", err)
}
fmt.Println("Deleted index docs-example")
}
# Requires Terraform provider v5.0.0 or later
# This block defines the index. To delete it, either remove the block and run
# `terraform apply`, or run:
# terraform destroy -target=pinecone_index.docs_example
# If deletion protection is enabled, first set deletion_protection = "disabled"
# and run `terraform apply`, then delete the index.
resource "pinecone_index" "docs_example" {
name = "docs-example"
deployment = {
managed = {
cloud = "aws"
region = "us-east-1"
}
}
schema = {
fields = {
_values = { dense_vector = { dimension = 1536, metric = "cosine" } }
}
}
deletion_protection = "disabled"
}
PINECONE_API_KEY="YOUR_API_KEY"
curl -i -X DELETE "https://api.pinecone.io/indexes/docs-example" \
-H "Api-Key: $PINECONE_API_KEY" \
-H "X-Pinecone-Api-Version: 2026-07"
Authorizations
Headers
Required date-based version header
Path Parameters
The name of the index to delete.
Response
The request to delete the index has been accepted.
Was this page helpful?