Collections help you organize documents into logical groups for easier management, scoped search, and isolated knowledge graphs.
Why Use Collections?
- Organization - Group related documents together
- Scoped Search - Search within specific collections only
- Isolated Graphs - Each collection has its own entity graph
- Access Control - Apply different permissions per collection
- Multi-tenant - Separate knowledge bases for different teams/projects
Collection Structure
Code
API Usage
Create a Collection
Code
Response:
Code
List Collections
Code
Code
Get Collection Details
Code
Code
Update a Collection
Rename a collection or update its description. Both fields are optional — only the provided fields are changed.
In the UI: Click the pencil icon on a collection card to rename it inline. Press Enter to save or Escape to cancel.
Via API:
Code
Response:
Code
Note: The default collection cannot be renamed.
Delete a Collection
Code
Warning: Deleting a collection also deletes all documents and entities within it.
Document Management
Upload to a Collection
Code
Move Documents Between Collections
Code
List Documents in a Collection
Code
Collection-Scoped Operations
Ask AI and basic search resolve the requested collection against the key's allowed scope; omitting collection_id uses the key's scope. To narrow retrieval to a single permitted collection, pass its collection_id. Basic search scopes its vector, keyword, and metadata legs to that collection's documents. The default Ask AI/context RRF path applies collection clauses to the chunk queries in its vector, keyword, and graph retrieval. The legacy fallback when ENABLE_HYBRID_SEARCH=false also carries scope into its vector and traversal chunk queries. Entity and relationship metadata returned by graph traversal remains global in both paths; chunk scoping does not establish complete graph-context isolation.
Search Within a Collection
Code
Ask AI About a Collection
By default, Ask AI searches across all collections. To scope a question to a single collection:
In the UI: Open the Settings panel on the Ask AI page and use the Collection Scope dropdown. It defaults to "All Collections" — select a specific collection to filter. A persistent indicator below the input shows the active scope.
Via API:
Code
Get Collection Graph
Code
Default Collection
Documents uploaded without a collection_id go to the default collection.
Configure the default collection name:
Code
Configuration
Code
Collection-Scoped API Keys
The most powerful use of collections is pairing them with collection-scoped API keys. A key restricted to specific collections can only see and write to those collections — everything else returns a 403. This enables true multi-tenancy from a single Cortex instance.
Create a restricted key
Code
Update collection access on an existing key
Code
Enforcement
| Endpoint type | Behaviour for restricted key |
|---|---|
GET /api/collections | Returns only allowed collections |
GET /api/documents | Returns only documents in allowed collections |
GET /api/collections/{id} | 403 if not in allowed list |
GET /api/documents/{id} | 403 if document's collection not in allowed list |
POST /api/upload?collection_id=... | 403 if collection not in allowed list |
POST /api/ask with collection_id | 403 if collection not in allowed list |
New collections are never automatically accessible to existing restricted keys — access must be explicitly granted.
In the UI
Go to Settings → API Key Management → New Key and select Specific Collections to open a multi-select picker. Each restricted key card shows an amber N Collections badge.
Best Practices
- Meaningful Names - Use descriptive names for easy identification
- Logical Grouping - Group documents by topic, project, or source
- Don't Over-Segment - Too many small collections reduce graph connectivity
- Regular Cleanup - Remove unused collections periodically
- Use Descriptions - Add descriptions for documentation
- Pair with scoped keys - For multi-tenant deployments, give each tenant a key restricted to their collection