Give each customer its own store with —tenants-dir and per-tenant API keys.
With --tenants-dir, each tenant has its own store in its own folder. No query sees the spans of another tenant. To delete a tenant, stop the server and delete its folder.The tenant of a request comes from its API key. Make keys for two tenants:
A tenant id is 1 to 64 characters of a-z, 0-9, _ and -. Lower case only.
A tenant’s store is made at its first write, opens at its first request, and closes after --tenant-idle-secs (300) with no request. At most --max-open-tenants (100) stores are open at once (Memory and threads).
--auth trusted-header is the other way: the server trusts the header x-magpie-tenant. Use it only behind a proxy or a Collector that checks the caller and sets the header.
One mask policy, one price table and one retention for all tenants in this version.
--auth trusted-header trusts the x-magpie-tenant header. Use it only behind a proxy that authenticates the caller.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Magpie","description":"Magpie is a trace store for AI agents: full-text search over prompts and replies, whole-trace queries and token and cost sums, in one Rust engine. A library for Rust, Node.js and Python, or one server that takes OpenTelemetry.","colors":{"primary":"#8A5A00","light":"#FFE83A","dark":"#8A5A00"},"logo":{"light":"https://mintcdn.com/magpie-f30b9567/lfS8S2tPtzbDfpXA/logo/light.svg?fit=max\u0026auto=format\u0026n=lfS8S2tPtzbDfpXA\u0026q=85\u0026s=6974f4dc1ead619990c46e61fa4c1569","dark":"https://mintcdn.com/magpie-f30b9567/lfS8S2tPtzbDfpXA/logo/dark.svg?fit=max\u0026auto=format\u0026n=lfS8S2tPtzbDfpXA\u0026q=85\u0026s=157f6921ea9b76c531444e3f6a94842c","href":"https://magpiedb.com"},"favicon":"https://mintcdn.com/magpie-f30b9567/lfS8S2tPtzbDfpXA/favicon.svg?fit=max\u0026auto=format\u0026n=lfS8S2tPtzbDfpXA\u0026q=85\u0026s=30258f3a311559908d00d02444a3e371","background":{"color":{"dark":"#0B0B0A"}},"navbar":{"links":[{"href":"https://github.com/intojhanurag/magpie","type":"github"}],"primary":{"type":"button","label":"Quick start","href":"/quickstart"}},"footer":{"socials":{"github":"https://github.com/intojhanurag/magpie","website":"https://magpiedb.com"}},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode"],"display":"header"},"markdown":{"instructions":["Magpie is a trace store for AI agents, used as a library (crate `magpiedb`, npm `magpiedb`, PyPI `magpiedb`) or as `magpie-server`, which takes OpenTelemetry (OTLP over HTTP on 127.0.0.1:4318 and gRPC on 127.0.0.1:4317 by default).","Use only the commands, flags, routes and JSON shapes that these pages show. Do not guess a flag or a query field: if a page does not show it, say that the docs do not show it.","Packages and server binaries are not published yet: build from source, as the quick start shows. Check the status note on the introduction page before you suggest `cargo add`, `npm install` or `pip install`.","Only one process may write to a store folder at a time. For many apps, send traces to one `magpie-server`."]},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"magpie-f30b9567","hasAudioNarration":false,"actualSubdomain":"magpie-f30b9567","customDomains":[],"gitSource":{"type":"github","owner":"intojhanurag","repo":"magpie","deployBranch":"main","contentDirectory":"docs-site","isPrivate":true,"mountPath":"","label":"","_id":"6b14f45b6b767715287f4264"},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6b14f76b3c71e4bc394dbb70","clientVersion":"0.0.4458","searchFilterCounts":[{"language":"default","tag":"Run in production","count":11},{"language":"default","tag":"Queries","count":8},{"language":"default","tag":"Server reference","count":7},{"language":"default","tag":"Get started","count":5},{"language":"default","tag":"Libraries","count":3},{"language":"default","tag":"Benchmarks","count":1},{"language":"default","tag":"Send traces","count":1}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"auth-vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":false},"customCss":[]}
{"page":{"pagePath":"operations/tenants","slug":"/operations/tenants","pageMetadata":{"title":"Tenants: one store per customer","sidebarTitle":"Tenants","description":"Give each customer its own store with --tenants-dir and per-tenant API keys.","href":"/operations/tenants"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Give each customer its own store with —tenants-dir and per-tenant API keys.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`With `,_jsx(_components.code,{children:`--tenants-dir`}),`, each tenant has its own store in its own folder. No query sees the spans of another tenant. To delete a tenant, stop the server and delete its folder.`]}),`\n`,_jsx(_components.p,{children:`The tenant of a request comes from its API key. Make keys for two tenants:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`magpie-server`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` keygen`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --tenant`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` acme`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --rights`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` write`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` >>`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` tenant-keys.jsonl`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` 2>`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` acme-app.txt`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`magpie-server`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` keygen`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --tenant`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` acme`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --rights`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` read`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` >>`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` tenant-keys.jsonl`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` 2>`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` acme-dashboard.txt`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`magpie-server`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` keygen`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --tenant`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` globex`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --rights`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` read,write`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` >>`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` tenant-keys.jsonl`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` 2>`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` globex.txt`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ACME_APP`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`$(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`tail`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -n`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` acme-app.txt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ACME_DASHBOARD`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`$(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`tail`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -n`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` acme-dashboard.txt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`GLOBEX`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`$(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`tail`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -n`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` globex.txt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`magpie-server`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --tenants-dir`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` ./tenants`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --auth`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` keys`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --keys-file`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` tenant-keys.jsonl`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`The app of `,_jsx(_components.code,{children:`acme`}),` sends one agent run. `,_jsx(_components.code,{children:`scripts/send-trace.sh`}),` makes a run with three spans:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`$REPO`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`/scripts/send-trace.sh\"`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --url`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` http://127.0.0.1:4318`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --key`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`$ACME_APP`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` >`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` /dev/null`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`sleep`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # the next commit makes it searchable`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`acme`}),`’s dashboard sees it. `,_jsx(_components.code,{children:`globex`}),` has no store yet (`,_jsx(_components.code,{children:`404`}),`). The app key cannot read (`,_jsx(_components.code,{children:`403`}),`):`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -s`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` localhost:4318/v1/count`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"authorization: Bearer `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`$ACME_DASHBOARD`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{}'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`; `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`echo`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -s`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -o`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` /dev/null`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -w`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '%{http_code}\\\\n'`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` localhost:4318/v1/count`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"authorization: Bearer `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`$GLOBEX`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{}'`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -s`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -o`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` /dev/null`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -w`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '%{http_code}\\\\n'`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` localhost:4318/v1/count`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"authorization: Bearer `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`$ACME_APP`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{}'`})]}),`\n`]})})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`4`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`{\"count\":3}`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`404`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`403`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`A tenant id is 1 to 64 characters of `,_jsx(_components.code,{children:`a-z`}),`, `,_jsx(_components.code,{children:`0-9`}),`, `,_jsx(_components.code,{children:`_`}),` and `,_jsx(_components.code,{children:`-`}),`. Lower case only.`]}),`\n`,_jsxs(_components.li,{children:[`A tenant’s store is made at its first write, opens at its first request, and closes after `,_jsx(_components.code,{children:`--tenant-idle-secs`}),` (300) with no request. At most `,_jsx(_components.code,{children:`--max-open-tenants`}),` (100) stores are open at once (`,_jsx(_components.a,{href:`/operations/errors-memory#memory-and-threads`,children:`Memory and threads`}),`).`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`--auth trusted-header`}),` is the other way: the server trusts the header `,_jsx(_components.code,{children:`x-magpie-tenant`}),`. Use it only behind a proxy or a Collector that checks the caller and sets the header.`]}),`\n`,_jsx(_components.li,{children:`One mask policy, one price table and one retention for all tenants in this version.`}),`\n`,_jsxs(_components.li,{children:[`Not with `,_jsx(_components.code,{children:`--s3`}),` (`,_jsx(_components.a,{href:`/limits#server`,children:`Limits`}),`).`]}),`\n`]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`--auth trusted-header`}),` trusts the `,_jsx(_components.code,{children:`x-magpie-tenant`}),` header. Use it only behind a proxy that authenticates the caller.`]})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Tenants: one store per customer","sidebarTitle":"Tenants","description":"Give each customer its own store with --tenants-dir and per-tenant API keys.","href":"/operations/tenants"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":[],"subdomain":"magpie-f30b9567","siteName":"Magpie","title":"Tenants: one store per customer - Magpie","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-12-06T05:43:40.395Z","originalFileLocation":"operations/tenants.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Give each customer its own store with --tenants-dir and per-tenant API keys.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Magpie\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/magpie-f30b9567/1JOp6MR2aIDJOeid/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/magpie-f30b9567/1JOp6MR2aIDJOeid/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/magpie-f30b9567/1JOp6MR2aIDJOeid/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/magpie-f30b9567/1JOp6MR2aIDJOeid/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/magpie-f30b9567/1JOp6MR2aIDJOeid/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/magpie-f30b9567/1JOp6MR2aIDJOeid/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/magpie-f30b9567/1JOp6MR2aIDJOeid/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/magpie-f30b9567/1JOp6MR2aIDJOeid/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/magpie-f30b9567/1JOp6MR2aIDJOeid/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Tenants: one store per customer - Magpie\">\u003cmeta data-mint-head property=\"og:description\" content=\"Give each customer its own store with --tenants-dir and per-tenant API keys.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Magpie\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://magpie-f30b9567.mintlify.app/operations/tenants\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://magpie-f30b9567.mintlify.site/_mintlify/api/og/v2?division=Run+in+production\u0026amp;title=Tenants%3A+one+store+per+customer\u0026amp;description=Give+each+customer+its+own+store+with+--tenants-dir+and+per-tenant+API+keys.\u0026amp;theme=c12fb36a245ba8a0a1e4be77\u0026amp;signature=9d302975c783dd66adcb506fa403b7653432a8e643446f26b4809bf266f62d22\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Tenants: one store per customer - Magpie\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Give each customer its own store with --tenants-dir and per-tenant API keys.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://magpie-f30b9567.mintlify.site/_mintlify/api/og/v2?division=Run+in+production\u0026amp;title=Tenants%3A+one+store+per+customer\u0026amp;description=Give+each+customer+its+own+store+with+--tenants-dir+and+per-tenant+API+keys.\u0026amp;theme=c12fb36a245ba8a0a1e4be77\u0026amp;signature=9d302975c783dd66adcb506fa403b7653432a8e643446f26b4809bf266f62d22\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/magpie-f30b9567/1JOp6MR2aIDJOeid/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Magpie\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#8A5A00\">\u003clink data-mint-head rel=\"canonical\" href=\"https://magpie-f30b9567.mintlify.app/operations/tenants\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/operations/tenants.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://magpie-f30b9567.mintlify.app/#organization\",\"name\":\"Magpie\",\"url\":\"https://magpie-f30b9567.mintlify.app\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/magpie-f30b9567/lfS8S2tPtzbDfpXA/logo/light.svg?fit=max\u0026auto=format\u0026n=lfS8S2tPtzbDfpXA\u0026q=85\u0026s=6974f4dc1ead619990c46e61fa4c1569\"}},{\"@type\":\"WebSite\",\"@id\":\"https://magpie-f30b9567.mintlify.app#website\",\"name\":\"Magpie\",\"url\":\"https://magpie-f30b9567.mintlify.app\",\"publisher\":{\"@id\":\"https://magpie-f30b9567.mintlify.app/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://magpie-f30b9567.mintlify.app/operations/tenants#webpage\",\"url\":\"https://magpie-f30b9567.mintlify.app/operations/tenants\",\"name\":\"Tenants: one store per customer\",\"description\":\"Give each customer its own store with --tenants-dir and per-tenant API keys.\",\"dateModified\":\"2026-12-06T05:43:40.395Z\",\"isPartOf\":{\"@id\":\"https://magpie-f30b9567.mintlify.app#website\"},\"breadcrumb\":{\"@id\":\"https://magpie-f30b9567.mintlify.app/operations/tenants#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://magpie-f30b9567.mintlify.app/operations/tenants#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Run in production\",\"item\":\"https://magpie-f30b9567.mintlify.app/operations/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tenants: one store per customer\",\"item\":\"https://magpie-f30b9567.mintlify.app/operations/tenants\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://magpie-f30b9567.mintlify.app/operations/tenants#article\",\"headline\":\"Tenants: one store per customer\",\"name\":\"Tenants: one store per customer\",\"description\":\"Give each customer its own store with --tenants-dir and per-tenant API keys.\",\"url\":\"https://magpie-f30b9567.mintlify.app/operations/tenants\",\"mainEntityOfPage\":{\"@id\":\"https://magpie-f30b9567.mintlify.app/operations/tenants#webpage\"},\"dateModified\":\"2026-12-06T05:43:40.395Z\",\"publisher\":{\"@id\":\"https://magpie-f30b9567.mintlify.app/#organization\"},\"isPartOf\":{\"@id\":\"https://magpie-f30b9567.mintlify.app#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Magpie\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Magpie\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/operations/tenants.md","siteName":"Magpie","nav":{"global":null,"groups":[{"group":"Get started","pages":[{"title":"Magpie","sidebarTitle":"Introduction","icon":"feather","href":"/index"},{"title":"Quickstart","sidebarTitle":"Quickstart","href":"/quickstart"},{"title":"Set up Magpie with a coding agent","sidebarTitle":"Agent setup","icon":"terminal","href":"/agent-setup"},{"title":"Library or server?","icon":"signs-post","href":"/library-or-server"},{"title":"Use these docs with AI tools","icon":"robot","href":"/ai-tools"}]},{"group":"Send traces","pages":[{"title":"Send traces with OpenTelemetry","sidebarTitle":"OpenTelemetry","href":"/guides/opentelemetry"}]},{"group":"Libraries","pages":[{"title":"Rust library","sidebarTitle":"Rust","href":"/libraries/rust"},{"title":"Node.js library","sidebarTitle":"Node.js","href":"/libraries/node"},{"title":"Python library","sidebarTitle":"Python","href":"/libraries/python"}]},{"group":"Queries","pages":[{"title":"Queries","href":"/queries/overview"},{"title":"Find text","href":"/queries/text-search"},{"title":"Filter spans","href":"/queries/filters"},{"title":"Questions about whole traces","href":"/queries/traces"},{"title":"Add up numbers","href":"/queries/sums"},{"title":"Sessions and scores","href":"/queries/sessions-scores"},{"title":"Read and export","href":"/queries/read-export"},{"title":"The same queries in the library","href":"/queries/library"}]},{"group":"Run in production","pages":[{"title":"Run Magpie for a company","sidebarTitle":"Overview","href":"/operations/overview"},{"title":"API keys and TLS","description":"Turn on API keys and TLS for magpie-server, and run it behind a proxy.","href":"/operations/keys-tls"},{"title":"Tenants: one store per customer","sidebarTitle":"Tenants","href":"/operations/tenants"},{"title":"Retention and deletes","description":"Drop old spans with --retention. Delete a person's data and purge it from the disk.","href":"/operations/data-lifecycle"},{"title":"Masking private data","sidebarTitle":"Masking","href":"/operations/masking"},{"title":"Import and backup","href":"/operations/backup-import"},{"title":"S3","href":"/operations/s3"},{"title":"Durability and upgrades","href":"/operations/durability-upgrades"},{"title":"Errors, memory and threads","href":"/operations/errors-memory"},{"title":"Security","href":"/security"},{"title":"Limits","href":"/limits"}]},{"group":"Server reference","pages":[{"title":"magpie-server","href":"/reference/server"},{"title":"HTTP API","href":"/reference/http-api"},{"title":"Tenants, API keys and TLS","href":"/reference/tenants-and-keys"},{"title":"S3 with the server","href":"/reference/server-s3"},{"title":"Viewer","href":"/reference/viewer"},{"title":"Import old traces","href":"/reference/import"},{"title":"Mapping, cost and masking","href":"/reference/mapping-cost-masking"}]},{"group":"Benchmarks","pages":[{"title":"Benchmarks","icon":"chart-simple","href":"/benchmarks"}]}]},"basePath":"","title":"Tenants: one store per customer - Magpie","deploymentId":"dpl_HZVV42MMRSo9WnNHfTGZvby5jph9","buildId":"dpl_HZVV42MMRSo9WnNHfTGZvby5jph9","dynamics":[],"chunks":[]}