Overview
Document-level ACL (Access Control Lists) lets you build multi-user applications on top of Mixpeek where each end-user only sees the documents they are authorized to access. Instead of managing separate namespaces per user, you store all documents in a single namespace and let Mixpeek enforce read/write permissions automatically. Key capabilities:- Automatic filter injection — user-scoped API keys transparently filter all reads so users only see their own (or shared) documents
- Per-document ownership — every document has an
_aclobject tracking who can read, write, or own it - Public documents — mark a document as
public: trueto make it visible to all users - Zero application-side filtering — your app does not need to add user filters to queries; Mixpeek handles it server-side
Concepts
API Key Types
Mixpeek supports two types of API keys:| Key Type | Prefix | ACL Behavior |
|---|---|---|
| Org-scoped | mxp_sk_ | Full access — bypasses ACL filters entirely |
| User-scoped | usr_sk_ | Restricted — ACL filters injected on every read and write |
The _acl Object
Every document stores an _acl sub-object inside its _internal payload:
The
principal_id of the user who created the document. Only the owner (or an org-scoped key) can modify ACL settings.List of
principal_id values that can read this document.List of
principal_id values that can update this document.When
true, the document is visible to all user-scoped keys regardless of the read list.Creating User-Scoped API Keys
Generate a user-scoped key by providing aprincipal_id that represents the end-user in your application (e.g., your internal user ID, email, or UUID).
Store the returned
usr_sk_ key securely. Pass it to your frontend or mobile app so the end-user’s requests are automatically scoped.How ACL Works
Automatic ACL on Document Creation
When a user-scoped key creates a document, Mixpeek automatically sets the_acl:
owner= the key’sprincipal_idread=[principal_id]write=[principal_id]public=false
_acl manually — it is populated from the API key’s identity.
Automatic Filter Injection on Reads
Every read operation made with a user-scoped key — including retriever executions, document listings, and searches — has an ACL filter injected server-side. The filter ensures the user only sees documents where:- Their
principal_idis in the_acl.readlist, OR - The document has
_acl.public: true
Write Protection
Update and delete operations made with a user-scoped key check the_acl.write list. If the user’s principal_id is not in the write list, the operation returns a 403 Forbidden error.
Org-Scoped Key Bypass
Org-scoped keys (mxp_sk_ prefix) bypass all ACL checks. They can read, write, and modify any document regardless of its _acl settings. Use org-scoped keys for backend services, admin dashboards, and data pipelines.
Managing ACL
Update a document’s ACL using the dedicated endpoint. Only the document owner or an org-scoped key can modify ACL settings.Making a Document Public
Setpublic: true to make a document visible to all user-scoped keys in the namespace:
Revoking Access
Remove a user from theread or write list by sending the updated list without their principal_id:
Examples
Multi-User Document Search
A SaaS app where each user uploads and searches their own documents, with optional sharing.Create user-scoped keys for each user
When a user signs up, generate a
usr_sk_ key with their user ID as the principal_id.Users ingest documents with their key
Each document is automatically tagged with the user’s ACL. User A cannot see User B’s documents.
Users search normally
Retriever executions with a user-scoped key only return documents the user can access — no extra filters needed.
Public Knowledge Base with Private Uploads
Combine public reference documents with private user uploads in the same namespace:Backwards Compatibility
Documents created before ACL was enabled do not have an_acl field. These documents follow these rules:
| Key Type | Behavior for Documents Without _acl |
|---|---|
| Org-scoped | Full access — documents are visible and writable as before |
| User-scoped | Not visible — documents without _acl are excluded from reads |
Best Practices
Related
- Security & Tenancy — org-level authentication and namespace isolation
- Filters — manual query filters (ACL filters are injected automatically on top of these)
- Namespaces — data isolation boundaries

