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 manage your existing collections including listing, describing, and deleting operations.

List collections

Retrieve a complete list of all collections in your project along with their metadata and status information. The endpoint supports optional pagination.
ParameterDescriptionTypeRequiredDefault
sizeMax number of collections to return in one page.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:
    # First page (optional: size, page_token)
    res = client.collections.list(size=20)
    for c in res.collections:
        print(c.collection_name, c.num_docs)
    # Next page (if res.next_page_token is set)
    if res.next_page_token:
        res_next = client.collections.list(size=20, page_token=res.next_page_token)
The response includes detailed information about each collection. When there are more results, the response may include nextPageToken for fetching the next page:
{
  "collections": [
    {
      "projectName": "your-project",
      "collectionName": "example-collection",
      "indexConfigs": {
        "title": {"type": "text"},
        "category": {"type": "keyword"}
      },
      "numDocs": 1250,
      "sourceProjectName": "source-project-name",
      "sourceCollectionName": "source-collection-name",
      "sourceCollectionVersionId": "wR0NyDJbqDiHMaaV597GjczO2oGQyG7T",
      "collectionStatus": "ACTIVE"
    }
  ],
  "nextPageToken": "eyJ..."
}

Describe a collection

Get detailed information about a specific collection, including its configuration, document count, and current status.
with LambdaDB(project_api_key="YOUR_API_KEY", base_url="YOUR_BASE_URL", project_name="YOUR_PROJECT_NAME") as client:
    meta = client.collection("example-collection").get()
    # or client.collections.get(collection_name="example-collection")
The response provides comprehensive collection details:
{
  "projectName": "your-project",
  "collectionName": "example-collection",
  "indexConfigs": {
    "title": {
      "type": "text",
      "analyzers": ["standard", "korean"]
    },
    "embedding": {
      "type": "vector",
      "dimensions": 768,
      "similarity": "cosine"
    }
  },
  "numDocs": 1250,
  "sourceProjectName": "source-project-name",
  "sourceCollectionName": "source-collection-name",
  "sourceCollectionVersionId": "wR0NyDJbqDiHMaaV597GjczO2oGQyG7T",
  "collectionStatus": "ACTIVE"
}

Delete a collection

Permanently delete a collection and all of its associated data and resources. This operation cannot be undone. Deletion is asynchronous: the API returns 202 Accepted and queues the work in the background. Until the job finishes, the collection name is still reserved—you may see collectionStatus DELETING from Describe a collection, and creating a collection with the same name can fail with a resource-already-exists error. For large collections (for example thousands of documents), this phase can take a minute or longer. Use the wait-for-deletion pattern before calling create again with the same name.
client.collections.delete(collection_name="collection-to-delete")
Deleting a collection is irreversible and will permanently remove all documents and metadata. Make sure you have proper backups if needed before proceeding with this operation.

Collection status

Collections can have the following status values:
StatusDescription
CREATINGCollection is being created and not yet available
ACTIVECollection is ready for read/write operations
DELETINGCollection is being deleted asynchronously; the name stays reserved until removal completes

Wait for deletion before recreating

If you delete a collection and immediately call create with the same collectionName, the create request may fail (for example Resource already exists / ResourceAlreadyExists) even though you already issued delete. That is expected while the collection is still being removed. What to do: After a successful delete call, poll Describe (get) until the collection no longer exists (typically HTTP 404 / ResourceNotFound from the API), then create. Checking collectionStatus === "DELETING" on each successful get confirms you are still in the teardown phase. Prefer get over list for this: list can still include the collection for some time after delete; describe-by-name reflects the lifecycle more directly for a single collection.
import time

collection_name = "knowledge-layer"
poll_interval_s = 2.0
max_wait_s = 900.0  # allow long-running deletes for large collections

with LambdaDB(project_api_key="YOUR_API_KEY", base_url="YOUR_BASE_URL", project_name="YOUR_PROJECT_NAME") as client:
    client.collections.delete(collection_name=collection_name)

    deadline = time.monotonic() + max_wait_s
    while time.monotonic() < deadline:
        try:
            meta = client.collections.get(collection_name=collection_name)
        except Exception as exc:
            # When the collection is fully gone, describe returns 404 — use the not-found type your SDK maps to that response.
            code = getattr(exc, "status_code", None) or getattr(exc, "status", None)
            if code == 404:
                break
            raise
        # Still present (often with status=DELETING); the name is not free yet.
        time.sleep(poll_interval_s)
    else:
        raise TimeoutError(f"Timed out after {max_wait_s}s waiting for {collection_name!r} to be removed")

    # Use the same index_configs you would pass to a normal create.
    client.collections.create(collection_name=collection_name, index_configs=your_index_configs)