# 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)
import { Pinecone } from '@pinecone-database/pinecone';
const pc = new Pinecone({ apiKey: 'YOUR_API_KEY' })
// To get the unique host for an index,
// see https://docs.pinecone.io/guides/manage-data/target-an-index
const index = pc.index("INDEX_NAME", "INDEX_HOST")
const namespaceList = await index.listNamespaces();
console.log(namespaceList);
import io.pinecone.clients.AsyncIndex;
import io.pinecone.clients.Index;
import io.pinecone.configs.PineconeConfig;
import io.pinecone.configs.PineconeConnection;
import io.pinecone.proto.ListNamespacesResponse;
import org.openapitools.db_data.client.ApiException;
public class Namespaces {
public static void main(String[] args) throws ApiException {
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");
// List all namespaces with default pagination limit (100)
ListNamespacesResponse listNamespacesResponse = index.listNamespaces(null, null);
// List all namespaces with pagination limit of 2
ListNamespacesResponse listNamespacesResponseWithLimit = index.listNamespaces(null,2);
// List all namespaces with pagination limit and token
ListNamespacesResponse listNamespacesResponsePaginated = index.listNamespaces("eyJza2lwX3Bhc3QiOiIxMDEwMy0=", 5);
System.out.println(restoreJobListWithLimit);
}
}
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)
}
limit := uint32(10)
namespaces, err := idxConnection.ListNamespaces(ctx, &pinecone.ListNamespacesParams{
Limit: &limit,
})
if err != nil {
log.Fatalf("Failed to list namespaces: %v", err)
}
fmt.Printf(prettifyStruct(namespaces))
}
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");
var namespaces = await index.ListNamespacesAsync(new ListNamespacesRequest());
Console.WriteLine(namespaces);
# To get the unique host for an index,
# see https://docs.pinecone.io/guides/manage-data/target-an-index
PINECONE_API_KEY="YOUR_API_KEY"
INDEX_HOST="INDEX_HOST"
curl "https://$INDEX_HOST/namespaces" \
-H "Api-Key: $PINECONE_API_KEY" \
-H "X-Pinecone-Api-Version: 2025-04"
# 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": [
{ "name": "example-namespace", "recordCount": "20000" },
{ "name": "example-namespace2", "recordCount": "10500" }
],
"pagination": "Tm90aGluZyB0byBzZWUgaGVyZQo="
}
namespaces {
name: "example-namespace"
record_count: 20000
}
namespaces {
name: "example-namespace2"
record_count: 10500
}
{
"Namespaces": [
{
"name": "example-namespace",
"record_count": 20000
},
{
"name": "example-namespace2",
"record_count": 10500
},
...
],
"Pagination": {
"next": "eyJza2lwX3Bhc3QiOiIyNzQ5YTU1YS0zZTQ2LTQ4MDItOGFlNi1hZTJjZGNkMTE5N2IiLCJwcmVmaXgiOm51bGx9"
}
}
{
"namespaces":[
{"name":"example-namespace","recordCount":20000},
{"name":"example-namespace2","recordCount":10500},
...
],
"pagination":"Tm90aGluZyB0byBzZWUgaGVyZQo="
}
{
"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)
import { Pinecone } from '@pinecone-database/pinecone';
const pc = new Pinecone({ apiKey: 'YOUR_API_KEY' })
// To get the unique host for an index,
// see https://docs.pinecone.io/guides/manage-data/target-an-index
const index = pc.index("INDEX_NAME", "INDEX_HOST")
const namespaceList = await index.listNamespaces();
console.log(namespaceList);
import io.pinecone.clients.AsyncIndex;
import io.pinecone.clients.Index;
import io.pinecone.configs.PineconeConfig;
import io.pinecone.configs.PineconeConnection;
import io.pinecone.proto.ListNamespacesResponse;
import org.openapitools.db_data.client.ApiException;
public class Namespaces {
public static void main(String[] args) throws ApiException {
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");
// List all namespaces with default pagination limit (100)
ListNamespacesResponse listNamespacesResponse = index.listNamespaces(null, null);
// List all namespaces with pagination limit of 2
ListNamespacesResponse listNamespacesResponseWithLimit = index.listNamespaces(null,2);
// List all namespaces with pagination limit and token
ListNamespacesResponse listNamespacesResponsePaginated = index.listNamespaces("eyJza2lwX3Bhc3QiOiIxMDEwMy0=", 5);
System.out.println(restoreJobListWithLimit);
}
}
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)
}
limit := uint32(10)
namespaces, err := idxConnection.ListNamespaces(ctx, &pinecone.ListNamespacesParams{
Limit: &limit,
})
if err != nil {
log.Fatalf("Failed to list namespaces: %v", err)
}
fmt.Printf(prettifyStruct(namespaces))
}
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");
var namespaces = await index.ListNamespacesAsync(new ListNamespacesRequest());
Console.WriteLine(namespaces);
# To get the unique host for an index,
# see https://docs.pinecone.io/guides/manage-data/target-an-index
PINECONE_API_KEY="YOUR_API_KEY"
INDEX_HOST="INDEX_HOST"
curl "https://$INDEX_HOST/namespaces" \
-H "Api-Key: $PINECONE_API_KEY" \
-H "X-Pinecone-Api-Version: 2025-04"
# 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": [
{ "name": "example-namespace", "recordCount": "20000" },
{ "name": "example-namespace2", "recordCount": "10500" }
],
"pagination": "Tm90aGluZyB0byBzZWUgaGVyZQo="
}
namespaces {
name: "example-namespace"
record_count: 20000
}
namespaces {
name: "example-namespace2"
record_count: 10500
}
{
"Namespaces": [
{
"name": "example-namespace",
"record_count": 20000
},
{
"name": "example-namespace2",
"record_count": 10500
},
...
],
"Pagination": {
"next": "eyJza2lwX3Bhc3QiOiIyNzQ5YTU1YS0zZTQ2LTQ4MDItOGFlNi1hZTJjZGNkMTE5N2IiLCJwcmVmaXgiOm51bGx9"
}
}
{
"namespaces":[
{"name":"example-namespace","recordCount":20000},
{"name":"example-namespace2","recordCount":10500},
...
],
"pagination":"Tm90aGluZyB0byBzZWUgaGVyZQo="
}
{
"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)
import { Pinecone } from '@pinecone-database/pinecone';
const pc = new Pinecone({ apiKey: 'YOUR_API_KEY' })
// To get the unique host for an index,
// see https://docs.pinecone.io/guides/manage-data/target-an-index
const index = pc.index("INDEX_NAME", "INDEX_HOST")
const namespaceList = await index.listNamespaces();
console.log(namespaceList);
import io.pinecone.clients.AsyncIndex;
import io.pinecone.clients.Index;
import io.pinecone.configs.PineconeConfig;
import io.pinecone.configs.PineconeConnection;
import io.pinecone.proto.ListNamespacesResponse;
import org.openapitools.db_data.client.ApiException;
public class Namespaces {
public static void main(String[] args) throws ApiException {
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");
// List all namespaces with default pagination limit (100)
ListNamespacesResponse listNamespacesResponse = index.listNamespaces(null, null);
// List all namespaces with pagination limit of 2
ListNamespacesResponse listNamespacesResponseWithLimit = index.listNamespaces(null,2);
// List all namespaces with pagination limit and token
ListNamespacesResponse listNamespacesResponsePaginated = index.listNamespaces("eyJza2lwX3Bhc3QiOiIxMDEwMy0=", 5);
System.out.println(restoreJobListWithLimit);
}
}
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)
}
limit := uint32(10)
namespaces, err := idxConnection.ListNamespaces(ctx, &pinecone.ListNamespacesParams{
Limit: &limit,
})
if err != nil {
log.Fatalf("Failed to list namespaces: %v", err)
}
fmt.Printf(prettifyStruct(namespaces))
}
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");
var namespaces = await index.ListNamespacesAsync(new ListNamespacesRequest());
Console.WriteLine(namespaces);
# To get the unique host for an index,
# see https://docs.pinecone.io/guides/manage-data/target-an-index
PINECONE_API_KEY="YOUR_API_KEY"
INDEX_HOST="INDEX_HOST"
curl "https://$INDEX_HOST/namespaces" \
-H "Api-Key: $PINECONE_API_KEY" \
-H "X-Pinecone-Api-Version: 2025-04"
# 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": [
{ "name": "example-namespace", "recordCount": "20000" },
{ "name": "example-namespace2", "recordCount": "10500" }
],
"pagination": "Tm90aGluZyB0byBzZWUgaGVyZQo="
}
namespaces {
name: "example-namespace"
record_count: 20000
}
namespaces {
name: "example-namespace2"
record_count: 10500
}
{
"Namespaces": [
{
"name": "example-namespace",
"record_count": 20000
},
{
"name": "example-namespace2",
"record_count": 10500
},
...
],
"Pagination": {
"next": "eyJza2lwX3Bhc3QiOiIyNzQ5YTU1YS0zZTQ2LTQ4MDItOGFlNi1hZTJjZGNkMTE5N2IiLCJwcmVmaXgiOm51bGx9"
}
}
{
"namespaces":[
{"name":"example-namespace","recordCount":20000},
{"name":"example-namespace2","recordCount":10500},
...
],
"pagination":"Tm90aGluZyB0byBzZWUgaGVyZQo="
}
{
"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