Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.lambdadb.ai/llms.txt

Use this file to discover all available pages before exploring further.

This page shows you how to use the list endpoint to list documents in a collection. Use this when you need to iterate over documents (for example, to export or scan) without running a ranked search.
ParameterDescriptionTypeRequiredDefault
sizeMax number of documents to return per page (1–100).integer100
pageTokenToken for the next page of results.string
includeVectorsIndicates whether vector values are included in the response.booleanfalse
from lambdadb import LambdaDB

with LambdaDB(
    project_api_key="YOUR_API_KEY",
    base_url="YOUR_BASE_URL",
    project_name="YOUR_PROJECT_NAME",
) as client:
    coll = client.collection("my_collection")
    # List first page of documents
    res = coll.docs.list(size=10)
    # `res.docs` contains items (each item includes `doc` and metadata).
    # `res.documents` contains document bodies only.
    for item in res.docs:
        print(item)

    # List next page using the token from the previous response
    if res.next_page_token:
        res_next = coll.docs.list(size=10, page_token=res.next_page_token)
The response includes the total count, the current page of documents, and an optional token for the next page:
{
  "total": 2,
  "docs": [
    {
      "collection": "example-collection-name",
      "doc": {
        "id": "doc-1",
        "title": "Example document 1",
        "category": "docs"
      }
    },
    {
      "collection": "example-collection-name",
      "doc": {
        "id": "doc-2",
        "title": "Example document 2",
        "category": "docs"
      }
    }
  ],
  "nextPageToken": "eyJpZCI6ICJhYmMiLCAiY3JlYXRlZF9hdCI6ICIyMDI0LTExLTA1VDE0OjI3OjU2KzAwOjAwIn0=",
  "isDocsInline": true
}

Extended list request

For filtering, partition filtering, field selection, or a JSON request body, use the extended list endpoint:
from lambdadb import LambdaDB

with LambdaDB(
    project_api_key="YOUR_API_KEY",
    base_url="YOUR_BASE_URL",
    project_name="YOUR_PROJECT_NAME",
) as client:
    coll = client.collection("my_collection")

    res = coll.docs.list(
        size=10,
        filter_={"queryString": {"query": "category:docs"}},
        partition_filter={"field": "tenant", "in": ["acme"]},
        fields={"include": ["id", "title", "category"]},
        include_vectors=False,
    )
The SDK scoped list helpers (docs.list in Python and TypeScript, Docs().List in Go) use the extended list request automatically when you pass filter, partition filter, or field-selection options. In Go, pass these as Filter, PartitionFilter, Fields, and IncludeVectors on lambdadb.ListDocsOpts. The extended list request body supports:
ParameterDescriptionTypeRequiredDefault
sizeMax number of documents to return per page (1–100).integer100
pageTokenToken for the next page of results.string
filterFilter applied before pagination. Supports queryString and nested bool filters.object
partitionFilterRestricts the request to matching partition values.object
fieldsField selector with include and/or exclude. Use dot notation for nested fields.object
includeVectorsIndicates whether vector values are included in the response.booleanfalse
filter uses the same queryString and bool shapes as the query API. List filters do not run vector or ranking queries. Use partitionFilter only for collections configured with a partition field. Inside a bool filter, occur can be filter, must, must_not, or should; when omitted, it defaults to should.
{
  "filter": {
    "bool": [
      {
        "queryString": {
          "query": "category:docs"
        },
        "occur": "filter"
      },
      {
        "queryString": {
          "query": "title:LambdaDB"
        },
        "occur": "must"
      }
    ]
  }
}
When you use nextPageToken with the extended endpoint, keep the same filter, partitionFilter, fields, and includeVectors options across pages.
To fetch specific documents by ID, use the fetch endpoint. To run ranked text, vector, sparse-vector, or hybrid search, use the query API.