Multi-tenant RAG

A searchable namespace and a scoped key for every customer.

For SaaS copilots and assistants: your backend writes each customer’s documents to their namespace, and the copilot searches with a key that reaches theirs alone. Exact, regex, filtered and vector retrieval; idle customers cost only their bytes.

0.8mswarm query p50, on real S3
10,000namespaces on one server, measured
806Ban idle namespace in object storage
$0compute for an idle customer

From recorded runs, with how each was measured, on the benchmarks page.

A namespace per customer

Made by its first write, with no limit on how many on pro. A customer’s data is one prefix in object storage: easy to reason about, count, export or delete.

The key is the boundary

Your copilot calls SkimmerDB with a key that reaches one workspace. Requests to other namespaces return 404. Your trusted backend still authenticates the user, chooses the right key and keeps broader credentials out of the agent’s reach.

Recall that matches how people ask

Vectors for meaning, literal and regex search for names and numbers, metadata filters for source, owner and dates, all in one query. Exact counts when a user asks “how many”.

Choose and test your tenant boundary

What one missing filter returns, and when a shared index is still the right call: namespaces vs metadata filters.

Shared collectionSkimmerDB
Data organizationShared collection with a tenant identifier on each documentA namespace for each customer workspace
Access controlEnforced tenant filters or database policies, depending on the systemA scoped key restricts which namespaces the caller can access
Application responsibilityDerive tenant identity from the authenticated session; enforce it on every access pathProvision the correct scoped key from a trusted backend; keep admin keys private
Customer deletionDelete the customer’s records and related application dataDelete the namespace and related application data
Quiet customersCost depends on the database and hosting modelIdle namespaces use object storage; paid accounts have a monthly minimum
What to verifyMissing or altered filters, direct reads and write permissionsOther namespace names, direct reads and write permissions with the restricted key

Sync from your backend, retrieve from the copilot

Documents are an id, text, metadata and an embedding if you have one. Writing an id again replaces it, so syncing a changed document is one write.

sync a workspace
# Run on your trusted backend with an admin or write key.
W=https://api.skimmerdb.com/v1/namespaces/ws-4812

curl -sS $W/docs -H "Authorization: Bearer $ADMIN_KEY" \
  -H "Content-Type: application/json" -d '{
  "wait": true,
  "docs": [{"id": "doc-91",
    "text": "Globex renewal terms: net 45",
    "meta": {"source": "crm", "stage": "open"}}]}'
retrieve for a user
# Use the read-only key returned by the key-creation request below.
W=https://api.skimmerdb.com/v1/namespaces/ws-4812

curl -sS $W/search -H "Authorization: Bearer $WS_KEY" \
  -H "Content-Type: application/json" -d '{
  "q": "globex", "filter": {"source": "crm"}, "limit": 8}'

# Count matching documents; check partial before treating it as exhaustive.
curl -sS $W/count -H "Authorization: Bearer $WS_KEY" \
  -H "Content-Type: application/json" -d '{
  "q": "net 45", "filter": {"stage": "open"}}'

One key per customer

Create a read-only key for the exact workspace name on your trusted backend. Pass that restricted key to the retrieval component; keep the admin key outside the agent’s context.

  • Scoped. Read, write or admin, limited to names or a prefix like ws-4812-*.
  • Capped. Requests a second, queries and writes a billing period.
  • Accounted. Every answer reports its latency, object-store reads and CPU.
a key for one workspace
# Trusted backend only. The returned key is shown once.
curl -sS https://api.skimmerdb.com/v1/keys \
  -H "Authorization: Bearer $ADMIN_KEY" \
  -H "Content-Type: application/json" -d '{
  "name": "ws-4812 copilot", "scope": "read",
  "namespaces": ["ws-4812"], "cap_queries": 200000}'

Prove the boundary with two customers

Give two fictional help centers a document mentioning the same error code. A Cedar-only key should retrieve Cedar’s answer, receive 404 for Harbor’s search and direct document read, and receive 403 when it tries to write.

The guide includes curl commands, result checks, key revocation and cleanup. It also explains where your application still owns authorization.

Run the tenant-isolation walkthrough →

Questions

What is multi-tenant RAG?

Retrieval-augmented generation for an app with many customers: each customer’s copilot or assistant must retrieve only from that customer’s documents. SkimmerDB supports a namespace per customer with keys restricted to it; your application maps authenticated users to the correct credentials.

Why not one index with a tenant_id filter?

A shared index can work when tenant access is enforced consistently by a trusted service or database policy. SkimmerDB offers a different organization: separate namespaces and restricted keys. Test the complete access model, including direct reads and writes, whichever design you choose.

How many namespaces can I have?

Unlimited on pro; the free plan allows 1,000. An idle namespace is under a kilobyte of bookkeeping plus its documents in object storage, and runs no compute, so a long tail of quiet customers costs what they store.

Who writes the data, my backend or the agent?

Usually your backend, through the REST API, the Python and TypeScript clients, or bulk imports of CSV, NDJSON and Parquet. The copilot only needs a read key. Agents that should save things (notes, memories) can get a write key limited to their namespace.

Can I see what each customer uses?

Listing namespaces gives each one’s stored bytes and the documents and bytes written to it, and every query answer reports its latency, cache temperature, object-store reads and CPU, so you can attribute cost per customer. Key caps limit what each customer’s key can do in a billing period.

What does a quiet customer cost?

An idle namespace accrues storage at $0.10 per GB-month on pro. The paid account has a $10 monthly minimum that usage counts against; queries, writes, cold reads and hosted embeddings are separate usage dimensions. The free plan includes 1 GB with limits. See pricing for the full calculation.

Give every customer their own index

Free up to 1 GB stored and 100k queries a month. No card to start.