Skip to main content
GET
/
namespaces
# Not supported with pinecone["grpc"] extras installed
from pinecone import Pinecone

pc = Pinecone(api_key="YOUR_API_KEY")

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

# Implicit pagination using a generator function
for namespace in index.list_namespaces():
    print(namespace.name, ":", namespace.record_count)

# Manual pagination
namespaces = index.list_namespaces_paginated(
    limit=2,
    pagination_token="eyJza2lwX3Bhc3QiOiIxMDEwMy0="
)

print(namespaces)
# Implicit pagination
example-namespace : 20000
example-namespace2 : 10500
example-namespace3 : 10000
...

# Manual pagination
{
    "namespaces": [
        {
            "name": "example-namespace",
            "record_count": "20000"
        },
        {
            "name": "example-namespace2",
            "record_count": "10500"
        }
    ],
    "pagination": {
        "next": "Tm90aGluZyB0byBzZWUgaGVyZQo="
    }
}
# Not supported with pinecone["grpc"] extras installed
from pinecone import Pinecone

pc = Pinecone(api_key="YOUR_API_KEY")

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

# Implicit pagination using a generator function
for namespace in index.list_namespaces():
    print(namespace.name, ":", namespace.record_count)

# Manual pagination
namespaces = index.list_namespaces_paginated(
    limit=2,
    pagination_token="eyJza2lwX3Bhc3QiOiIxMDEwMy0="
)

print(namespaces)
# Implicit pagination
example-namespace : 20000
example-namespace2 : 10500
example-namespace3 : 10000
...

# Manual pagination
{
    "namespaces": [
        {
            "name": "example-namespace",
            "record_count": "20000"
        },
        {
            "name": "example-namespace2",
            "record_count": "10500"
        }
    ],
    "pagination": {
        "next": "Tm90aGluZyB0byBzZWUgaGVyZQo="
    }
}

Authorizations

Api-Key
string
header
required

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

Query Parameters

limit
integer<int32>

Max number namespaces to return per page.

paginationToken
string

Pagination token to continue a previous listing operation.

Response

A successful response

namespaces
object[]

The list of namespaces belonging to this index.

pagination
object