Skip to main content
Morphik provides powerful mechanisms to organize and isolate your data through user scoping and folder scoping. These features allow you to create logical boundaries for different projects or user groups while maintaining a unified database.

Folder Scoping

Folders in Morphik allow you to organize documents into logical groups, similar to directories in a file system, but for your unstructured data. Operations performed within a folder scope only affect documents within that folder.

When to Use Folder Scoping

  • Project Organization: Separate documents by project, department, or purpose
  • Data Categorization: Group similar documents together
  • Access Control: Create logical boundaries for different document sets

Creating and Using Folders

User Scoping

User scoping allows multi-tenant applications to isolate data per end user, ensuring each user only sees their own documents. This is particularly useful for applications where privacy between users is important.

When to Use User Scoping

  • Multi-tenant Applications: Keep each user’s data separate
  • Privacy Requirements: Ensure users can only access their own documents
  • Personal Data Spaces: Create user-specific knowledge bases

Creating and Using User Scopes

Combined User and Folder Scoping

For the maximum level of organization, you can combine both scopes to organize documents by both user and folder.

Asynchronous Usage

All scoping features are also available with the asynchronous client:

Important Considerations

  • All methods available on the main Morphik client are also available on folder and user scopes
  • Operations performed within a scope are isolated to that scope
  • Documents created within a scope are only accessible within that scope, unless explicitly queried with appropriate filters
  • Scopes can be used for both reading and writing operations
  • User and folder information is stored as metadata with the documents, so you can still filter across scopes with explicit filter parameters if needed

Filtering by Folder Name in Metadata

When you ingest documents in a folder with the folder_name parameter, that value is automatically available in the document’s metadata for filtering. This enables powerful cross-folder queries using Morphik’s metadata filter operators:
This approach is useful when you need to:
  • Query across multiple folders simultaneously
  • Use pattern matching on folder names
  • Combine folder filters with complex metadata conditions
  • Build dynamic queries where folder selection isn’t known at scope creation time
For more filtering examples, see the Complex Metadata Filtering cookbook and Metadata Filtering reference.

Use Cases

Multi-Project Research Team

A research team working on multiple projects can use folder scoping to keep document sets separate:

Multi-tenant Application

An application serving multiple end users can use user scoping to keep each user’s data private:

Enterprise Knowledge Management

For complex enterprise setups, combine both scopes to organize by both department and individual: