Skip to main content
Pinecone Docs

Search documentation

Type to search this documentation.

On this pageOverview

Delete an index

Python
# pip install "pinecone[grpc]"
from pinecone.grpc import PineconeGRPC as Pinecone, PodSpec

pc = Pinecone(api_key="YOUR_API_KEY")

pc.delete_index(name="docs-example")
JavaScript
// npm install @pinecone-database/pinecone
import { Pinecone } from '@pinecone-database/pinecone'

const pc = new Pinecone({
  apiKey: 'YOUR_API_KEY'
});

await pc.deleteIndex('docs-example');
Java
import io.pinecone.clients.Pinecone;

public class DeleteIndexExample {
    public static void main(String[] args) {
        Pinecone pc = new Pinecone.Builder("YOUR_API_KEY").build();
        pc.deleteIndex("docs-example");
    }
}
Go
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)
    }

    indexName := "docs-example"

    err = pc.DeleteIndex(ctx, indexName)
    if err != nil {
        log.Fatalf("Failed to delete index: %v", err)
    } else {
        fmt.Println("Index \"%v\" deleted successfully", indexName)
    }
}
C#
using Pinecone;

var pinecone = new PineconeClient("YOUR_API_KEY");

await pinecone.DeleteIndexAsync("docs-example");
curl
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: 2024-10"

DELETE /indexes/{index_name}

  • index_name (path, string, required) — The name of the index to delete.
  • 202 — The request to delete the index has been accepted.
  • 401 — Unauthorized. Possible causes: Invalid API key.
  • 403 — Forbidden. Deletion protection enabled.
  • 404 — Index not found.
  • 412 — There is a pending collection created from this index.
  • 500 — Internal server error.
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu