Skip to main content
This page shows you how to use the list endpoint to list documents in a collection. Use this when you need to iterate over all documents (for example, to export or scan) without filtering by query.
ParameterDescriptionTypeRequiredDefault
sizeMax number of documents to return per page (1–100).integer
pageTokenToken for the next page of results.string
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",
        "example-field1": "example-value1",
        "example-field2": [0.1, 0.2, 0.3]
      }
    },
    {
      "collection": "example-collection-name",
      "doc": {
        "id": "doc-2",
        "example-field1": "example-value2",
        "example-field2": [0.4, 0.5, 0.6]
      }
    }
  ],
  "nextPageToken": "eyJpZCI6ICJhYmMiLCAiY3JlYXRlZF9hdCI6ICIyMDI0LTExLTA1VDE0OjI3OjU2KzAwOjAwIn0=",
  "isDocsInline": true
}
To fetch specific documents by ID, use the fetch endpoint. To search or filter documents, use the query API.