Skip to main content
Pinecone Docs

Search documentation

Type to search this documentation.

On this pageOverview

Delete a collection

Serverless indexes do not support collections.

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

pc = Pinecone(api_key='API_KEY')
pc.delete_collection("example-collection")
JavaScript
// npm install @pinecone-database/pinecone
import { Pinecone } from '@pinecone-database/pinecone'

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

await pc.deleteCollection("example-collection");
Java
import io.pinecone.clients.Pinecone;

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

    collectionName := "example-collection"

    err = pc.DeleteCollection(ctx, collectionName)
    if err != nil {
	    log.Fatalf("Failed to delete collection: %v\n", err)
    } else {
        if len(collections) == 0 {
            fmt.Printf("No collections found in project")
        } else {
            fmt.Printf("Successfully deleted collection \"%v\"\n", collectionName)
        }
    }
}
C#
using Pinecone;

var pinecone = new PineconeClient("YOUR_API_KEY");

await pinecone.DeleteCollectionAsync("example-collection");
curl
PINECONE_API_KEY="YOUR_API_KEY"

curl -i -X DELETE "https://api.pinecone.io/collections/example-collection" \
  -H "Api-Key: $PINECONE_API_KEY" \
  -H "X-Pinecone-Api-Version: 2024-10"

DELETE /collections/{collection_name}

  • collection_name (path, string, required) — The name of the collection.
  • 202 — The collection has been successfully deleted.
  • 401 — Unauthorized. Possible causes: Invalid API key.
  • 404 — Collection not found.
  • 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