Skip to main content
POST
/
namespaces
/
{namespace}
/
documents
/
delete
# pip install --upgrade pinecone
import os
from pinecone import Pinecone

pc = Pinecone(api_key=os.environ["PINECONE_API_KEY"])
index = pc.preview.index(name="articles")

NAMESPACE = "example-namespace"

index.documents.delete(namespace=NAMESPACE, ids=["doc1", "doc2"])

index.documents.delete(namespace=NAMESPACE, delete_all=True)
// Status: 202 Accepted
{}

Documentation Index

Fetch the complete documentation index at: https://docs.pinecone.io/llms.txt

Use this file to discover all available pages before exploring further.

Full-text search is in public preview and uses API version 202601-alpha. APIs may continue to evolve before general availability.
Deletes schema-defined documents from a namespace. You must specify exactly one of ids or delete_all.
Delete does not accept a filter parameter — text match operators ($match_phrase, $match_all, $match_any) and metadata filter expressions are rejected with a 400 error. To delete documents matching a metadata expression, use POST /namespaces/{namespace}/documents/search with a filter to get IDs, then pass them to delete.
# pip install --upgrade pinecone
import os
from pinecone import Pinecone

pc = Pinecone(api_key=os.environ["PINECONE_API_KEY"])
index = pc.preview.index(name="articles")

NAMESPACE = "example-namespace"

index.documents.delete(namespace=NAMESPACE, ids=["doc1", "doc2"])

index.documents.delete(namespace=NAMESPACE, delete_all=True)
// Status: 202 Accepted
{}

Authorizations

Api-Key
string
header
required

An API Key is required to call Pinecone APIs. Get yours from the console.

Headers

X-Pinecone-Api-Version
string
default:202601-alpha
required

Required date-based version header

Path Parameters

namespace
string
required

The namespace to delete documents from.

Body

application/json

The request for the delete_documents operation. Exactly one of ids or delete_all must be specified.

ids
string[]

A list of document IDs to delete. Mutually exclusive with delete_all.

Required array length: 1 - 1000 elements
delete_all
boolean

If true, delete all documents in the namespace. Mutually exclusive with ids.

Response

The delete request was successfully accepted.

The response for the delete_documents operation.