Skip to main content
GET
/
vectors
/
list
# pip install "pinecone[grpc]"
from pinecone.grpc import PineconeGRPC as Pinecone

pc = Pinecone(api_key='YOUR_API_KEY')

# To get the unique host for an index, 
# see https://docs.pinecone.io/guides/manage-data/target-an-index
index = pc.Index(host="INDEX_HOST")

# To iterate over all result pages using a generator function
for ids in index.list(prefix="doc1#", namespace="example-namespace"):
    print(ids)

# For manual control over pagination
results = index.list_paginated(
    prefix="doc1#",
    limit=3,
    namespace="example-namespace",
    pagination_token="eyJza2lwX3Bhc3QiOiIxMDEwMy0="
)
// npm install @pinecone-database/pinecone
import { Pinecone } from '@pinecone-database/pinecone';
const pc = new Pinecone();

// 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").namespace("example-namespace");

const results = await index.listPaginated({ prefix: 'doc1#', limit: 3 });
console.log(results);

// Fetch the next page of results
await index.listPaginated({ prefix: 'doc1#', paginationToken: results.pagination.next});
import io.pinecone.clients.Index;
import io.pinecone.configs.PineconeConfig;
import io.pinecone.configs.PineconeConnection;
import io.pinecone.proto.ListResponse;

public class ListExample {
    public static void main(String[] args) {
        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(connection, "INDEX_NAME");
        ListResponse listResponse = index.list("example-namespace", "doc1#", 3);
        System.out.println(listResponse);
    }
}
package main

import (
	"context"
	"encoding/json"
	"fmt"
	"log"

	"github.com/pinecone-io/go-pinecone/v2/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", Namespace: "example-namespace"})
    if err != nil {
        log.Fatalf("Failed to create IndexConnection for Host: %v", err)
  	}

    limit := uint32(3)
    prefix := "doc1#"

    res, err := idxConnection.ListVectors(ctx, &pinecone.ListVectorsRequest{
        Limit:  &limit,
        Prefix: &prefix,
    })
    if len(res.VectorIds) == 0 {
        fmt.Println("No vectors found")
    } else {
        fmt.Printf(prettifyStruct(res))
    }
}
using Pinecone;

var pinecone = new PineconeClient("YOUR_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 listResponse = await index.ListAsync(new ListRequest {
    Namespace = "example-namespace",
    Prefix = "doc1#",
    Limit = 3,
});

Console.WriteLine(listResponse);
# 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 -X GET "https://$INDEX_HOST/vectors/list?namespace=example-namespace&prefix=doc1#&limit=3" \
  -H "Api-Key: $PINECONE_API_KEY" \
  -H "X-Pinecone-Api-Version: 2024-04"
['doc1#chunk1', 'doc1#chunk2', 'doc1#chunk3']
{'read_units': 1}
{
  "vectors": [
    { "id": "doc1#chunk1" }, { "id": "doc1#chunk2" }, { "id": "doc1#chunk3" }
  ],
  "pagination": {
    "next": "eyJza2lwX3Bhc3QiOiJwcmVUZXN0LS04MCIsInByZWZpeCI6InByZVRlc3QifQ=="
  },
  "namespace": "example-namespace",
  "usage": { "readUnits": 1 }
}
[id: "doc1#chunk1"
, id: "doc1#chunk2"
, id: "doc1#chunk3"]
next: "eyJza2lwX3Bhc3QiOiJkb2MxI2NodW5rMiIsInByZWZpeCI6bnVsbH0="
{
  "vector_ids": [
    "doc1#chunk1",
    "doc1#chunk2",
    "doc1#chunk3"
  ],
  "usage": {
    "read_units": 1
  },
  "next_pagination_token": "eyJza2lwX3Bhc3QiOiIwMDBkMTc4OC0zMDAxLTQwZmMtYjZjNC0wOWI2N2I5N2JjNDUiLCJwcmVmaXgiOm51bGx9"
}
{
  "vectors": [
    {
      "id": "doc1#chunk1"
    },
    {
      "id": "doc1#chunk2"
    },
    {
      "id": "doc1#chunk3"
    }
  ],
  "pagination": "eyJza2lwX3Bhc3QiOiIwMDBkMTc4OC0zMDAxLTQwZmMtYjZjNC0wOWI2N2I5N2JjNDUiLCJwcmVmaXgiOm51bGx9",
  "namespace": "example-namespace",
  "usage": {
    "readUnits": 1
  }
}
{
  "vectors": [
    { "id": "doc1#chunk1" },
    { "id": "doc1#chunk2" },
    { "id": "doc1#chunk3" }
  ],
  "pagination": {
    "next": "c2Vjb25kY2FsbA=="
  },
  "namespace": "example-namespace",
  "usage": {
    "readUnits": 1
  }
}
# pip install "pinecone[grpc]"
from pinecone.grpc import PineconeGRPC as Pinecone

pc = Pinecone(api_key='YOUR_API_KEY')

# To get the unique host for an index, 
# see https://docs.pinecone.io/guides/manage-data/target-an-index
index = pc.Index(host="INDEX_HOST")

# To iterate over all result pages using a generator function
for ids in index.list(prefix="doc1#", namespace="example-namespace"):
    print(ids)

# For manual control over pagination
results = index.list_paginated(
    prefix="doc1#",
    limit=3,
    namespace="example-namespace",
    pagination_token="eyJza2lwX3Bhc3QiOiIxMDEwMy0="
)
// npm install @pinecone-database/pinecone
import { Pinecone } from '@pinecone-database/pinecone';
const pc = new Pinecone();

// 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").namespace("example-namespace");

const results = await index.listPaginated({ prefix: 'doc1#', limit: 3 });
console.log(results);

// Fetch the next page of results
await index.listPaginated({ prefix: 'doc1#', paginationToken: results.pagination.next});
import io.pinecone.clients.Index;
import io.pinecone.configs.PineconeConfig;
import io.pinecone.configs.PineconeConnection;
import io.pinecone.proto.ListResponse;

public class ListExample {
    public static void main(String[] args) {
        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(connection, "INDEX_NAME");
        ListResponse listResponse = index.list("example-namespace", "doc1#", 3);
        System.out.println(listResponse);
    }
}
package main

import (
	"context"
	"encoding/json"
	"fmt"
	"log"

	"github.com/pinecone-io/go-pinecone/v2/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", Namespace: "example-namespace"})
    if err != nil {
        log.Fatalf("Failed to create IndexConnection for Host: %v", err)
  	}

    limit := uint32(3)
    prefix := "doc1#"

    res, err := idxConnection.ListVectors(ctx, &pinecone.ListVectorsRequest{
        Limit:  &limit,
        Prefix: &prefix,
    })
    if len(res.VectorIds) == 0 {
        fmt.Println("No vectors found")
    } else {
        fmt.Printf(prettifyStruct(res))
    }
}
using Pinecone;

var pinecone = new PineconeClient("YOUR_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 listResponse = await index.ListAsync(new ListRequest {
    Namespace = "example-namespace",
    Prefix = "doc1#",
    Limit = 3,
});

Console.WriteLine(listResponse);
# 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 -X GET "https://$INDEX_HOST/vectors/list?namespace=example-namespace&prefix=doc1#&limit=3" \
  -H "Api-Key: $PINECONE_API_KEY" \
  -H "X-Pinecone-Api-Version: 2024-04"
['doc1#chunk1', 'doc1#chunk2', 'doc1#chunk3']
{'read_units': 1}
{
  "vectors": [
    { "id": "doc1#chunk1" }, { "id": "doc1#chunk2" }, { "id": "doc1#chunk3" }
  ],
  "pagination": {
    "next": "eyJza2lwX3Bhc3QiOiJwcmVUZXN0LS04MCIsInByZWZpeCI6InByZVRlc3QifQ=="
  },
  "namespace": "example-namespace",
  "usage": { "readUnits": 1 }
}
[id: "doc1#chunk1"
, id: "doc1#chunk2"
, id: "doc1#chunk3"]
next: "eyJza2lwX3Bhc3QiOiJkb2MxI2NodW5rMiIsInByZWZpeCI6bnVsbH0="
{
  "vector_ids": [
    "doc1#chunk1",
    "doc1#chunk2",
    "doc1#chunk3"
  ],
  "usage": {
    "read_units": 1
  },
  "next_pagination_token": "eyJza2lwX3Bhc3QiOiIwMDBkMTc4OC0zMDAxLTQwZmMtYjZjNC0wOWI2N2I5N2JjNDUiLCJwcmVmaXgiOm51bGx9"
}
{
  "vectors": [
    {
      "id": "doc1#chunk1"
    },
    {
      "id": "doc1#chunk2"
    },
    {
      "id": "doc1#chunk3"
    }
  ],
  "pagination": "eyJza2lwX3Bhc3QiOiIwMDBkMTc4OC0zMDAxLTQwZmMtYjZjNC0wOWI2N2I5N2JjNDUiLCJwcmVmaXgiOm51bGx9",
  "namespace": "example-namespace",
  "usage": {
    "readUnits": 1
  }
}
{
  "vectors": [
    { "id": "doc1#chunk1" },
    { "id": "doc1#chunk2" },
    { "id": "doc1#chunk3" }
  ],
  "pagination": {
    "next": "c2Vjb25kY2FsbA=="
  },
  "namespace": "example-namespace",
  "usage": {
    "readUnits": 1
  }
}

Authorizations

Api-Key
string
header
required

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

Query Parameters

prefix
string

The vector IDs to fetch. Does not accept values containing spaces.

limit
integer<int64>
default:100

Max number of IDs to return per page.

paginationToken
string

Pagination token to continue a previous listing operation.

namespace
string

Response

A successful response.

The response for the list operation.

vectors
A list of ids · object[]
Example:
[
{ "id": "document1#abb" },
{ "id": "document1#abc" }
]
pagination
object
namespace
string

The namespace of the vectors.

Example:

"example-namespace"

usage
object