This page shows you how to use the fetch endpoint to fetch documents by IDs from a collection.
ParameterDescriptionTypeRequiredDefault
idsThe document IDs to fetch up to 1,00.string[]
includeVectorsIndicates whether vector values are included in the response.booleanfalse
consistentReadDetermines the read consistency model: If set to true, then the operation uses strongly consistent reads; otherwise, the operation uses eventually consistent reads.booleanfalse
To fetch documents, specify the document IDs (up to 100 IDs).
from lambdadb import LambdaDB

lambda_db = LambdaDB(
    server_url="PROJECT_URL",
    project_api_key="YOUR_API_KEY"
)

res_fetch = lambda_db.collections.docs.fetch(
    collection_name=collection_name, 
    ids=["33201222"], 
    include_vectors=True
)
The response will look like this:
{
  "took": 76,
  "total": 1,
  "docs": [
    {
      "collection": "example_collection",
      "doc": {
        "id": "33201222",
        "url": "https://en.wikipedia.org/wiki/LambdaDB",
        "title": "LambdaDB",
        "text": "LambdaDB is a freeware audio player for Windows, Android and Linux (through Wine) ... "
      }
    }
  ]
}