# 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="
}
}
Namespaces
List namespaces
List all namespaces in a serverless index.
Up to 100 namespaces are returned at a time by default, in sorted order (bitwise āCā collation). If the limit parameter is set, up to that number of namespaces are returned instead. Whenever there are additional namespaces to return, the response also includes a pagination_token that you can use to get the next batch of namespaces. When the response does not include a pagination_token, there are no more namespaces to return.
For guidance and examples, see Manage namespaces.
Note: This operation is not supported for pod-based indexes.
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
Query Parameters
Max number namespaces to return per page.
Pagination token to continue a previous listing operation.
Was this page helpful?
āI