Skip to main content
This page shows you how to list the IDs in an index namespace, either all of them or just those with a common ID prefix. Listing IDs without the data behind them is a cheap and fast way to check upserts. The kind of index determines which operation you use. An index with a document schema uses the Documents API, and a vector index uses the Vectors API. If you aren’t sure which kind of index you have, see Adopt the Documents API.
The list endpoint is supported only for serverless indexes.

List document IDs

In an index with a document schema, list returns document IDs in sorted order, 100 per page, which is also the maximum page size. Each entry carries only an _id. To get the fields of a document, fetch it.

List all document IDs

The response holds one entry per document, and a pagination.next token when more pages follow:

List document IDs by prefix

To limit results to documents whose IDs start with a given string, pass a prefix. Combined with structured IDs, this lets you list every chunk of a source document:
The Python SDK returns a paginator, so iterating it walks every page for you. In the REST API, a response with more results to follow carries a pagination.next token. Pass it back as pagination_token to get the next page, and stop when the response has no pagination token. For the full request and response schema, see List documents.

List record IDs

In a vector index, list every record ID in a namespace or just the IDs sharing a prefix, then page through the results.

List the IDs of all records in a namespace

To list the IDs of all records in the namespace of a serverless index, pass only the namespace parameter:

List the IDs of records with a common prefix

ID prefixes enable you to query segments of content. Use the list endpoint to list all of the records with the common prefix. For more details, see Use structured IDs.

Paginate through results

The list endpoint returns up to 100 IDs per page at a time by default. If the limit parameter is passed, list returns up to that number of IDs per page instead. For example, if limit=3, up to 3 IDs be returned per page. Whenever there are additional IDs to return, the response also includes a pagination_token for fetching the next page of IDs.

Implicit pagination

When using the Python SDK, list paginates automatically.
Python

Manual pagination

When using the Node.js SDK, Java SDK, Go SDK, or REST API, you must manually fetch each page of results. You can also manually paginate with the Python SDK using list_paginated().
Then, to get the next batch of IDs, use the returned pagination_token:
When there are no more IDs to return, the response does not includes a pagination_token: