Skip to main content

Documentation Index

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

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

documents.list_files

Lists file objects stored under your namespace prefix in document storage (S3): file_name, size (bytes), and last_modified. This is not the same as indexed text documents; use documents.get or documents.fetch_text_data for pipeline output.

Parameters

namespace_name
str
required
The name of the target namespace (must exist and belong to your account).
Returns: Dict[str, Any] - A dictionary with listing results. Common response fields include success, namespace, file_count, and files (each item: file_name, size, last_modified). Keys are snake_case after SDK normalization. Raises: NamespaceNotFound, InvalidInputError, AuthenticationError, APIError, MoorchehError.

Example

List Files Example
from moorcheh_sdk import MoorchehClient

with MoorchehClient() as client:
    status = client.documents.list_files(namespace_name="my-faq-documents")
    print(status)

Async Example

List Files Async Example
import asyncio
from moorcheh_sdk import AsyncMoorchehClient

async def main():
    async with AsyncMoorchehClient() as client:
        status = await client.documents.list_files(namespace_name="my-faq-documents")
        print(status.get("file_count"), status.get("files"))

asyncio.run(main())

Complete Example

Complete List Files Workflow
from moorcheh_sdk import MoorchehClient

with MoorchehClient() as client:
    listing = client.documents.list_files(namespace_name="my-data")
    print(f"Namespace: {listing.get('namespace')}")
    print(f"File count: {listing.get('file_count')}")
    for f in listing.get("files", []):
        print(f["file_name"], f["size"], f.get("last_modified"))

Important Notes

Raw storage listing: Each entry in files describes an object in storage (for example after documents.upload_file), not a text document row from the indexing pipeline alone.
Ordering: Do not assume a stable sort from the API; sort client-side if you need a specific order.
API usage: Each successful call counts toward your plan like other authenticated API requests.

Best Practices

  • Use listing for audits, cleanup, or UI file pickers; use search for semantic queries over processed content
  • Sort or filter client-side when you need deterministic ordering
  • Use Delete Files (documents.delete_files) when you need to remove storage objects by file name