A key has the right read (queries and exports), write (OTLP, scores, deletes, purge), or both. An app that sends traces needs write; a dashboard needs read.
A key with no right for a route gets 403.
The server reads the key file every 2 s. A new line works, and a removed line stops working, within about 2 s, with no restart. To revoke a key, delete its line.
With one store (--dir), keys belong to the tenant default.
OpenTelemetry SDKs send the key with OTEL_EXPORTER_OTLP_HEADERS="authorization=Bearer%20mgp_..." (OpenTelemetry guide).
TLS
--tls-cert and --tls-key turn on TLS on both ports. Give the certificate chain (PEM, the server’s certificate first) and its private key (PEM). For a test, make a CA and a certificate for localhost with openssl. The server certificate must not be a CA (basicConstraints=CA:FALSE), or TLS clients refuse it:
TLS 1.2 and 1.3 (rustls). The HTTP port then speaks HTTPS only.
A new certificate needs a restart. At start the server prints the end date of the certificate. When the server’s own certificate (the first of the file) is not valid now, the server does not start (exit code 1); another certificate of the file that is not valid now only gets a warning with its place in the file. One that ends within 30 days gets a warning at start and once a day (for a certificate of under 90 days: within a third of its time). After the end, an error line every hour.
A failed TLS handshake is logged: the first at once, then at most one line a minute with a count and the reason (for example received fatal alert: CertificateExpired). If your clients cannot connect, look there.
No client certificates (mTLS).
A proxy that ends TLS (nginx, Caddy, a cloud load balancer) works too: run the server without --tls-* on a private address behind it, and pass the authorization header on. For gRPC, the proxy must speak HTTP/2 to the server.
To accept connections from other machines: --http-addr 0.0.0.0:4318 --grpc-addr 0.0.0.0:4317.
{"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":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"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/keys-tls","slug":"/operations/keys-tls","pageMetadata":{"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"},"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: \"Turn on API keys and TLS for magpie-server, and run it behind a proxy.\"\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,Heading,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`2`,id:`api-keys`,children:`API keys`}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Without keys, the server has no authentication. It then listens on `,_jsx(_components.code,{children:`127.0.0.1`}),` only. Before you open it to other machines, turn on keys and TLS.`]})}),`\n`,_jsx(_components.p,{children:`Make a key. The line for the key file goes to stdout; the key goes to stderr, and only this once. The file holds a SHA-256 of the key, not the key.`}),`\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:`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:` default`}),_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:` keys.jsonl`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` 2>`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` key.txt`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`KEY`}),_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:` key.txt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`echo`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:' \"${'}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`KEY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`0`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`4`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"}... is ${\"}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`#`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`KEY`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`} characters\"`})]}),`\n`]})})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,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:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`mgp_... is 68 characters`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`Start the server with the key file:`}),`\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:` --dir`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` ./traces`}),_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:` keys.jsonl`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`A request with no key gets `,_jsx(_components.code,{children:`401`}),`. With the key it works:`]}),`\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:`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:` -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:`#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:`$KEY`}),_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:`3`,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:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`401`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`{\"count\":0}`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`A key has the right `,_jsx(_components.code,{children:`read`}),` (queries and exports), `,_jsx(_components.code,{children:`write`}),` (OTLP, scores, deletes, purge), or both. An app that sends traces needs `,_jsx(_components.code,{children:`write`}),`; a dashboard needs `,_jsx(_components.code,{children:`read`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`A key with no right for a route gets `,_jsx(_components.code,{children:`403`}),`.`]}),`\n`,_jsx(_components.li,{children:`The server reads the key file every 2 s. A new line works, and a removed line stops working, within about 2 s, with no restart. To revoke a key, delete its line.`}),`\n`,_jsxs(_components.li,{children:[`With one store (`,_jsx(_components.code,{children:`--dir`}),`), keys belong to the tenant `,_jsx(_components.code,{children:`default`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`OpenTelemetry SDKs send the key with `,_jsx(_components.code,{children:`OTEL_EXPORTER_OTLP_HEADERS=\"authorization=Bearer%20mgp_...\"`}),` (`,_jsx(_components.a,{href:`/guides/opentelemetry`,children:`OpenTelemetry guide`}),`).`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`tls`,children:`TLS`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`--tls-cert`}),` and `,_jsx(_components.code,{children:`--tls-key`}),` turn on TLS on both ports. Give the certificate chain (PEM, the server’s certificate first) and its private key (PEM). For a test, make a CA and a certificate for `,_jsx(_components.code,{children:`localhost`}),` with `,_jsx(_components.code,{children:`openssl`}),`. The server certificate must not be a CA (`,_jsx(_components.code,{children:`basicConstraints=CA:FALSE`}),`), or TLS clients refuse it:`]}),`\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:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`printf`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'subjectAltName=DNS:localhost,IP:127.0.0.1\\\\nbasicConstraints=CA:FALSE\\\\n'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` >`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` ext.cnf`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`openssl`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` req`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -x509`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -newkey`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` rsa:2048`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -nodes`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -keyout`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` ca.key`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -out`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` ca.pem`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -days`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 30`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -subj`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` /CN=my-test-ca`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` 2>`}),_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:`openssl`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` req`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -newkey`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` rsa:2048`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -nodes`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -keyout`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` key.pem`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -out`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` server.csr`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -subj`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` /CN=localhost`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` 2>`}),_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:`openssl`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` x509`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -req`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -in`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` server.csr`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -CA`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` ca.pem`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -CAkey`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` ca.key`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -set_serial`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -days`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 30`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -extfile`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` ext.cnf`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -out`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` cert.pem`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` 2>`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` /dev/null`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Start the server with keys and TLS:`}),`\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:` --dir`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` ./traces`}),_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:` keys.jsonl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --tls-cert`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` cert.pem`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --tls-key`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` key.pem`})]}),`\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:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -s`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --cacert`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` ca.pem`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` https://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:`$KEY`}),_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:`1`,language:`json`,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:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"count\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`]})})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`TLS 1.2 and 1.3 (rustls). The HTTP port then speaks HTTPS only.`}),`\n`,_jsx(_components.li,{children:`A new certificate needs a restart. At start the server prints the end date of the certificate. When the server’s own certificate (the first of the file) is not valid now, the server does not start (exit code 1); another certificate of the file that is not valid now only gets a warning with its place in the file. One that ends within 30 days gets a warning at start and once a day (for a certificate of under 90 days: within a third of its time). After the end, an error line every hour.`}),`\n`,_jsxs(_components.li,{children:[`A failed TLS handshake is logged: the first at once, then at most one line a minute with a count and the reason (for example `,_jsx(_components.code,{children:`received fatal alert: CertificateExpired`}),`). If your clients cannot connect, look there.`]}),`\n`,_jsx(_components.li,{children:`No client certificates (mTLS).`}),`\n`,_jsxs(_components.li,{children:[`A proxy that ends TLS (nginx, Caddy, a cloud load balancer) works too: run the server without `,_jsx(_components.code,{children:`--tls-*`}),` on a private address behind it, and pass the `,_jsx(_components.code,{children:`authorization`}),` header on. For gRPC, the proxy must speak HTTP/2 to the server.`]}),`\n`,_jsxs(_components.li,{children:[`To accept connections from other machines: `,_jsx(_components.code,{children:`--http-addr 0.0.0.0:4318 --grpc-addr 0.0.0.0:4317`}),`.`]}),`\n`]})]})}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":"API keys and TLS","description":"Turn on API keys and TLS for magpie-server, and run it behind a proxy.","href":"/operations/keys-tls"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"API keys","slug":"api-keys","depth":2,"children":[]},{"title":"TLS","slug":"tls","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"magpie-f30b9567","siteName":"Magpie","title":"API keys and TLS - Magpie","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-12-06T05:43:40.395Z","originalFileLocation":"operations/keys-tls.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=\"Turn on API keys and TLS for magpie-server, and run it behind a proxy.\">\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=\"API keys and TLS - Magpie\">\u003cmeta data-mint-head property=\"og:description\" content=\"Turn on API keys and TLS for magpie-server, and run it behind a proxy.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Magpie\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://magpie-f30b9567.mintlify.app/operations/keys-tls\">\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=API+keys+and+TLS\u0026amp;description=Turn+on+API+keys+and+TLS+for+magpie-server%2C+and+run+it+behind+a+proxy.\u0026amp;theme=c12fb36a245ba8a0a1e4be77\u0026amp;signature=deb1ad50d26dc35bf0bb93a30a097f0d994745c5ace9f58e6e5f133d827f6fee\">\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=\"API keys and TLS - Magpie\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Turn on API keys and TLS for magpie-server, and run it behind a proxy.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://magpie-f30b9567.mintlify.site/_mintlify/api/og/v2?division=Run+in+production\u0026amp;title=API+keys+and+TLS\u0026amp;description=Turn+on+API+keys+and+TLS+for+magpie-server%2C+and+run+it+behind+a+proxy.\u0026amp;theme=c12fb36a245ba8a0a1e4be77\u0026amp;signature=deb1ad50d26dc35bf0bb93a30a097f0d994745c5ace9f58e6e5f133d827f6fee\">\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/keys-tls\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/operations/keys-tls.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/keys-tls#webpage\",\"url\":\"https://magpie-f30b9567.mintlify.app/operations/keys-tls\",\"name\":\"API keys and TLS\",\"description\":\"Turn on API keys and TLS for magpie-server, and run it behind a proxy.\",\"dateModified\":\"2026-12-06T05:43:40.395Z\",\"isPartOf\":{\"@id\":\"https://magpie-f30b9567.mintlify.app#website\"},\"breadcrumb\":{\"@id\":\"https://magpie-f30b9567.mintlify.app/operations/keys-tls#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://magpie-f30b9567.mintlify.app/operations/keys-tls#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Run in production\",\"item\":\"https://magpie-f30b9567.mintlify.app/operations/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"API keys and TLS\",\"item\":\"https://magpie-f30b9567.mintlify.app/operations/keys-tls\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://magpie-f30b9567.mintlify.app/operations/keys-tls#article\",\"headline\":\"API keys and TLS\",\"name\":\"API keys and TLS\",\"description\":\"Turn on API keys and TLS for magpie-server, and run it behind a proxy.\",\"url\":\"https://magpie-f30b9567.mintlify.app/operations/keys-tls\",\"mainEntityOfPage\":{\"@id\":\"https://magpie-f30b9567.mintlify.app/operations/keys-tls#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/keys-tls.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","description":"How to turn on keys, TLS, tenants, retention, deletes, masking, backup, S3 and more in magpie-server.","href":"/operations/overview"},{"title":"API keys and TLS","href":"/operations/keys-tls"},{"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"},{"title":"Retention and deletes","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":"API keys and TLS - Magpie","deploymentId":"dpl_HZVV42MMRSo9WnNHfTGZvby5jph9","buildId":"dpl_HZVV42MMRSo9WnNHfTGZvby5jph9","dynamics":[],"chunks":[]}