Skip to main content
Pinecone Docs

Search documentation

Type to search this documentation.

On this pageOverview

Delete a namespace

For guidance and examples, see Manage namespaces.

Note: This operation is not supported for pod-based indexes.

Python
# Not supported with pinecone["grpc"] extras installed
from pinecone import Pinecone

pc = Pinecone(api_key="YOUR_API_KEY")

index = pc.Index(host="INDEX_HOST")

index.delete_namespace(namespace="example-namespace")
JavaScript
import { Pinecone } from '@pinecone-database/pinecone';

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

const index = pc.index('docs-example');

const namespace = await index.deleteNamespace('example-namespace');

console.log(namespace);
Java
import io.pinecone.clients.Index;
import io.pinecone.configs.PineconeConfig;
import io.pinecone.configs.PineconeConnection;

import java.util.concurrent.ExecutionException;

public class DeleteNamespace {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        PineconeConfig config = new PineconeConfig("YOUR_API_KEY");
        // To get the unique host for an index, 
        // see https://docs.pinecone.io/guides/manage-data/target-an-index
        config.setHost("INDEX_HOST");
        PineconeConnection connection = new PineconeConnection(config);

        Index index = new Index(config, connection, "docs-example");

        index.deleteNamespace("example-namespace");
    }
}
Go
package main

import (
    "context"
    "encoding/json"
    "fmt"
    "log"

    "github.com/pinecone-io/go-pinecone/v4/pinecone"
)

func prettifyStruct(obj interface{}) string {
  	bytes, _ := json.MarshalIndent(obj, "", "  ")
    return string(bytes)
}

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)
    }

    // To get the unique host for an index, 
    // see https://docs.pinecone.io/guides/manage-data/target-an-index
    idxConnection, err := pc.Index(pinecone.NewIndexConnParams{Host: "INDEX_HOST"})
    if err != nil {
        log.Fatalf("Failed to create IndexConnection for Host: %v", err)
    } 

    err := idxConnection.DeleteNamespace(ctx, "example-namespace")
    if err != nil {
        log.Fatalf("Failed to delete namespace: %v", err)
    }
}
C#
using Pinecone;

var pinecone = new PineconeClient("PINECONE_API_KEY");

// To get the unique host for an index, 
// see https://docs.pinecone.io/guides/manage-data/target-an-index
var index = pinecone.Index(host: "INDEX_HOST");

await index.DeleteNamespaceAsync("example-namespace");
curl
PINECONE_API_KEY="YOUR_API_KEY"
INDEX_HOST="YOUR_INDEX_HOST"
NAMESPACE="YOUR_NAMESPACE" # To target the default namespace, use "__default__".

curl -X DELETE "https://$INDEX_HOST/namespaces/$NAMESPACE" \
    -H "Api-Key: $PINECONE_API_KEY" \
    -H "X-Pinecone-Api-Version: 2025-04"

DELETE /namespaces/{namespace}

  • namespace (path, string, required) — The namespace to delete
  • 200 — A successful response
  • 400 — Bad request. The request body included invalid request parameters.
  • 4XX — An unexpected error response.
  • 5XX — An unexpected error response.
Suggest an edit

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

Export
Documentation menu