Skip to main content

Overview

Folders in Morphik provide a way to organize documents into logical groups. This is particularly useful for multi-project environments where you want to maintain separation between different contexts. Documents within a folder are isolated from those in other folders, allowing for clean organization and data separation.
ℹ️ All folder APIs accept folder UUIDs, names, or canonical paths (e.g., "/projects/alpha/specs"). Folder objects expose full_path, parent_id, depth, and child_count; documents expose folder_path to mirror server responses.

Creating and Accessing Folders

Operations Within a Folder

Once you have a folder object, all operations performed on it are scoped to that folder. Documents created, retrieved, or manipulated will be contained within this folder’s scope.

Nested Folders and Scope Depth

Folders can be nested arbitrarily. Use canonical paths (leading slash optional) to address them, and include descendant folders in retrieval/listing by setting folder_depth:
Folder-scoped helpers inherit the path automatically, so folder.retrieve_chunks(..., folder_depth=-1) will include its children.

Expanding Scope with Additional Folders

Folder-scoped retrieval/list/query helpers accept additional_folders to include extra folders in the same request:

Folder Methods

All the core document operations available on the main Morphik client are also available on folder objects, but they are automatically scoped to the specific folder:
  • ingest_text - Ingest text content into this folder
  • ingest_file - Ingest a file into this folder
  • ingest_files - Ingest multiple files into this folder
  • ingest_directory - Ingest all files from a directory into this folder
  • retrieve_chunks - Retrieve chunks matching a query from this folder (supports reverse image search)
  • retrieve_docs - Retrieve documents matching a query from this folder
  • query - Generate a completion using context from this folder (supports llm_config parameter for custom LLM configuration)
  • list_documents - List all documents in this folder
  • batch_get_documents - Get multiple documents by their IDs from this folder
  • batch_get_chunks - Get specific chunks by source from this folder
  • get_info - Fetch the latest folder metadata from the API
  • get_summary - Fetch the latest folder summary
  • upsert_summary - Create or update the folder summary
  • delete_document_by_filename - Delete a document by filename from this folder

Managing Existing Documents and Folders

You can move previously ingested documents into a folder, remove them, or delete the entire folder. The SDK methods accept a folder UUID, name, or canonical path.

Using Custom LLM Configuration with Folders

You can pass a custom LLM configuration when querying within a folder:

Example: Project Document Management

A common use case for folders is separating different projects. Here’s an example of how to organize project documentation:

Accessing a Folder’s User Scope

You can further scope operations within a folder to a specific user by using the signin method on the folder object:
See User Management for more details on working with user scopes.