> ## 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.

# 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](https://docs.pinecone.io/guides/manage-data/manage-namespaces).

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

```python Python theme={null}
# 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)
```

```javascript JavaScript theme={null}
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/indexes/target-an-index
const index = pc.index("INDEX_NAME", "INDEX_HOST")

const namespaceList = await index.listNamespaces();

console.log(namespaceList);
```

```java Java theme={null}
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/indexes/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);
    }
}
```

```go Go theme={null}
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/indexes/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))
}
```

```csharp C# theme={null}
using Pinecone;

var pinecone = new PineconeClient("PINECONE_API_KEY");

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

var namespaces = await index.ListNamespacesAsync(new ListNamespacesRequest());

Console.WriteLine(namespaces);
```

```bash curl theme={null}
# To get the unique host for an index,
# see https://docs.pinecone.io/guides/indexes/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"
```

```text Python theme={null}
# 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="
    }
}
```

```javascript JavaScript theme={null}
{
  "namespaces": [
    { "name": "example-namespace", "recordCount": "20000" },
    { "name": "example-namespace2", "recordCount": "10500" }
  ],
  "pagination": "Tm90aGluZyB0byBzZWUgaGVyZQo="
}
```

```java Java theme={null}
namespaces {
  name: "example-namespace"
  record_count: 20000
}
namespaces {
  name: "example-namespace2"
  record_count: 10500
}
```

```go Go theme={null}
{
  "Namespaces": [
    {
      "name": "example-namespace",
      "record_count": 20000
    },
    {
      "name": "example-namespace2",
      "record_count": 10500
    },
    ...
  ],
  "Pagination": {
    "next": "eyJza2lwX3Bhc3QiOiIyNzQ5YTU1YS0zZTQ2LTQ4MDItOGFlNi1hZTJjZGNkMTE5N2IiLCJwcmVmaXgiOm51bGx9"
  }
}
```

```csharp C# theme={null}
{
  "namespaces":[
    {"name":"example-namespace","recordCount":20000},
    {"name":"example-namespace2","recordCount":10500},
    ...
  ],
  "pagination":"Tm90aGluZyB0byBzZWUgaGVyZQo="
}
```

```json curl theme={null}
{
  "namespaces": [
    {
      "name": "example-namespace",
      "record_count": 20000
    },
    {
      "name": "example-namespace2",
      "record_count": 10500
    },
    ...
  ],
  "pagination": {
    "next": "Tm90aGluZyB0byBzZWUgaGVyZQo="
  }
}
```


## OpenAPI

````yaml https://raw.githubusercontent.com/pinecone-io/pinecone-api/refs/heads/main/2025-04/db_data_2025-04.oas.yaml get /namespaces
openapi: 3.0.3
info:
  title: Pinecone Data Plane API
  description: >-
    Pinecone is a vector database that makes it easy to search and retrieve
    billions of high-dimensional vectors.
  contact:
    name: Pinecone Support
    url: https://support.pinecone.io
    email: support@pinecone.io
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
  version: 2025-04
servers:
  - url: https://{index_host}
    variables:
      index_host:
        default: unknown
        description: host of the index
security:
  - ApiKeyAuth: []
tags:
  - name: Vector Operations
  - name: Bulk Operations
  - name: Namespace Operations
externalDocs:
  description: More Pinecone.io API docs
  url: https://docs.pinecone.io/introduction
paths:
  /namespaces:
    get:
      tags:
        - Namespace Operations
      summary: List namespaces
      description: >-
        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](https://docs.pinecone.io/guides/manage-data/manage-namespaces).


        **Note:** This operation is not supported for pod-based indexes.
      operationId: listNamespacesOperation
      parameters:
        - in: query
          name: limit
          description: Max number namespaces to return per page.
          schema:
            type: integer
            format: int32
          example: 10
          style: form
        - in: query
          name: paginationToken
          description: Pagination token to continue a previous listing operation.
          schema:
            type: string
          style: form
      responses:
        '200':
          description: A successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListNamespacesResponse'
        4XX:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/rpcStatus'
        5XX:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/rpcStatus'
components:
  schemas:
    ListNamespacesResponse:
      type: object
      properties:
        namespaces:
          description: The list of namespaces belonging to this index.
          type: array
          items:
            $ref: '#/components/schemas/NamespaceDescription'
        pagination:
          $ref: '#/components/schemas/Pagination'
    rpcStatus:
      type: object
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
        details:
          type: array
          items:
            $ref: '#/components/schemas/protobufAny'
    NamespaceDescription:
      description: A description of a namespace, including the name and record count.
      type: object
      properties:
        name:
          example: example-namespace
          description: The name of the namespace.
          type: string
        record_count:
          example: 20000
          description: The total amount of records within the namespace.
          type: integer
          format: int64
    Pagination:
      type: object
      properties:
        next:
          example: Tm90aGluZyB0byBzZWUgaGVyZQo=
          type: string
    protobufAny:
      type: object
      properties:
        typeUrl:
          type: string
        value:
          type: string
          format: byte
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Api-Key
      description: >-
        An API Key is required to call Pinecone APIs. Get yours from the
        [console](https://app.pinecone.io/).

````