{"title":"Authentifizierung & Mind Keys","slug":"authentication","category":"getting-started","summary":"Wie die Synapse-Authentifizierung funktioniert: Mind Keys für Agenten, JWTs für Menschen, ?key= für reine URL-Tools.","audience":["human","llm"],"tags":["auth","mind-key","jwt","security"],"difficulty":"beginner","updated":"2026-06-27","word_count":433,"read_minutes":2,"llm_context":"Two auth methods: Mind Key (token-scoped, never expires) and JWT (user-scoped, 7-day expiry).\nMind Key: Authorization: Bearer mk_xxx OR ?key=mk_xxx (60 req/min limit on query)\nJWT: Authorization: Bearer eyJ... (no rate limit, used for /register, /login, /minds, /sharing)\nMind Key is shown only once at creation. Store it permanently.\nEach mind has exactly one Mind Key. Multiple minds = multiple keys.\n","lang":"de","translated":true,"requested_lang":"de","content_markdown":"\n# Authentifizierung & Mind Keys\n\nSynapse verwendet zwei Authentifizierungsmethoden, jede für einen anderen\nAnwendungsfall optimiert. Den Unterschied zu verstehen ist essenziell für\nzuverlässige Integrationen.\n\n## Zwei Auth-Methoden\n\n| Methode | Anwendungsfall | Rate Limit | Ablauf |\n|---------|----------------|------------|--------|\n| **Mind Key** | LLM-Agenten, automatisierte Tools | Keins (Header) / 60 min (Query) | Nie |\n| **JWT** | Human-UI, Konto-Operationen | Keins | 7 Tage |\n\n## Mind Key (für Agenten)\n\nEin Mind Key ist ein Tenant-scoped API-Token. Er authentifiziert die Daten\neines einzelnen Minds (Memories, Tasks, Chat, Scripts etc.). Verwende ihn für:\n\n- LLM-Agenten, die die API aufrufen\n- Hintergrund-Automatisierungs-Scripts\n- MCP-Server-Konfiguration\n- Jede langlebige Integration\n\n### Header-Authentifizierung (empfohlen)\n\n```bash\ncurl -H \"Authorization: Bearer mk_yourMindKeyHere\" \\\n     https://synapse.schaefer.zone/memory/recall\n```\n\n### Query-Parameter (für reine URL-Tools)\n\n```bash\ncurl https://synapse.schaefer.zone/memory/recall?key=mk_yourMindKeyHere\n```\n\n> [!WARNING]\n> Der `?key=`-Query-Parameter ist auf **60 Requests pro Minute** begrenzt.\n> Der Bearer-Header hat kein Rate Limit. Verwende den Header, wenn dein Client\n> eigene Header unterstützt.\n\n### Einen Mind Key anlegen\n\n```bash\ncurl -X POST https://synapse.schaefer.zone/minds \\\n  -H \"Authorization: Bearer YOUR_JWT\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"name\": \"Work Mind\", \"description\": \"Project memories\"}'\n```\n\nDie Antwort enthält `mind_key` — **sofort speichern**, er wird nur einmal\nangezeigt.\n\n### Deine Minds auflisten\n\n```bash\ncurl -H \"Authorization: Bearer YOUR_JWT\" \\\n     https://synapse.schaefer.zone/minds\n```\n\n### Einen Mind löschen (unumkehrbar!)\n\n```bash\ncurl -X DELETE -H \"Authorization: Bearer YOUR_JWT\" \\\n     https://synapse.schaefer.zone/minds/m_xyz789\n```\n\n## JWT (für Menschen)\n\nJWTs authentifizieren das **Nutzerkonto**, nicht einen spezifischen Mind.\nVerwende sie für:\n\n- Konto-Registrierung und Login\n- Minds anlegen / auflisten / löschen\n- Minds mit anderen Nutzern teilen\n- Web-Push-Abonnement-Verwaltung\n\n### Registrieren\n\n```bash\ncurl -X POST https://synapse.schaefer.zone/register \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"email\": \"you@example.com\", \"password\": \"secret\"}'\n```\n\nLiefert: `{ \"jwt\": \"eyJ...\", \"user\": {...} }`\n\n### Einloggen\n\n```bash\ncurl -X POST https://synapse.schaefer.zone/login \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"email\": \"you@example.com\", \"password\": \"secret\"}'\n```\n\nLiefert: `{ \"jwt\": \"eyJ...\", \"user\": {...} }`\n\n### JWT-Ablauf\n\nJWTs laufen nach **7 Tagen** ab. Wenn ein JWT abläuft, rufe einfach wieder\n`/login` auf, um ein frisches zu erhalten. Der Mind Key läuft nie ab, daher\nfunktionieren bestehende Agent-Integrationen weiter.\n\n## Security-Best-Practices\n\n> [!CRITICAL]\n> - **Mind Keys niemals in Git committen.** Verwende Environment-Variablen.\n> - **Mind Keys niemals loggen.** In Logs maskieren (`mk_***...***xyz`).\n> - **Keys rotieren** bei Verdacht auf Leak (Mind löschen, neuen anlegen).\n> - **Ein Mind pro Projekt**, um den Schadensradius bei geleaktem Key zu begrenzen.\n\n### Environment-Variablen-Pattern\n\n```bash\n# .env (NEVER commit this file)\nSYNAPSE_MIND_KEY=mk_yourMindKeyHere\nSYNAPSE_URL=https://synapse.schaefer.zone\n```\n\n```typescript\n// Node.js\nconst mindKey = process.env.SYNAPSE_MIND_KEY;\nconst url = process.env.SYNAPSE_URL;\nawait fetch(`${url}/memory/recall`, {\n  headers: { Authorization: `Bearer ${mindKey}` },\n});\n```\n\n### MCP-Server-Config\n\n```json\n{\n  \"mcpServers\": {\n    \"synapse\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"synapse-mcp-api@latest\"],\n      \"env\": {\n        \"SYNAPSE_MIND_KEY\": \"mk_yourMindKeyHere\",\n        \"SYNAPSE_URL\": \"https://synapse.schaefer.zone\"\n      }\n    }\n  }\n}\n```\n\n## Multi-Mind-Pattern\n\nJeder Nutzer kann mehrere Minds haben. Häufige Patterns:\n\n| Mind-Name | Zweck |\n|-----------|-------|\n| `work` | Job-bezogene Memories |\n| `personal` | Persönliche Präferenzen, Familie |\n| `project-synapse` | Spezifischer Projekt-Kontext |\n| `learning-german` | Lernfortschritt |\n| `assistant-default` | Allzweck-Fallback |\n\nVerwende in verschiedenen LLM-Sessions unterschiedliche Mind Keys, um Kontexte\ngetrennt zu halten.\n\n## Rate Limits\n\n| Auth-Methode | Limit | Scope |\n|---------------|-------|-------|\n| Mind Key (Header) | Keins | Pro-Mind |\n| Mind Key (?key=) | 60/min | Pro-IP |\n| JWT (Header) | Keins | Pro-Nutzer |\n| Öffentliche Endpunkte | Keins | Global |\n\nRate-Limit-Header (`X-RateLimit-Limit`, `X-RateLimit-Remaining`, `Retry-After`)\nwerden bei Bedarf in Antworten mitgeliefert.\n\n## Nächste Schritte\n\n- [Mind Key vs JWT](/docs/getting-started/mind-key-vs-jwt) — wann was verwenden\n- [Memory-API](/docs/api/memory) — was du mit einem Mind Key tun kannst\n- [User-API](/docs/api/user) — Kontoverwaltung mit JWTs\n","content_html":"<h1>Authentifizierung &amp; Mind Keys</h1>\n<p>Synapse verwendet zwei Authentifizierungsmethoden, jede für einen anderen\nAnwendungsfall optimiert. Den Unterschied zu verstehen ist essenziell für\nzuverlässige Integrationen.</p>\n<h2>Zwei Auth-Methoden</h2>\n<table>\n<thead>\n<tr>\n<th>Methode</th>\n<th>Anwendungsfall</th>\n<th>Rate Limit</th>\n<th>Ablauf</th>\n</tr>\n</thead>\n<tbody><tr>\n<td><strong>Mind Key</strong></td>\n<td>LLM-Agenten, automatisierte Tools</td>\n<td>Keins (Header) / 60 min (Query)</td>\n<td>Nie</td>\n</tr>\n<tr>\n<td><strong>JWT</strong></td>\n<td>Human-UI, Konto-Operationen</td>\n<td>Keins</td>\n<td>7 Tage</td>\n</tr>\n</tbody></table>\n<h2>Mind Key (für Agenten)</h2>\n<p>Ein Mind Key ist ein Tenant-scoped API-Token. Er authentifiziert die Daten\neines einzelnen Minds (Memories, Tasks, Chat, Scripts etc.). Verwende ihn für:</p>\n<ul>\n<li>LLM-Agenten, die die API aufrufen</li>\n<li>Hintergrund-Automatisierungs-Scripts</li>\n<li>MCP-Server-Konfiguration</li>\n<li>Jede langlebige Integration</li>\n</ul>\n<h3>Header-Authentifizierung (empfohlen)</h3>\n<pre><code class=\"hljs language-bash\">curl -H <span class=\"hljs-string\">&quot;Authorization: Bearer mk_yourMindKeyHere&quot;</span> \\\n     https://synapse.schaefer.zone/memory/recall</code></pre><h3>Query-Parameter (für reine URL-Tools)</h3>\n<pre><code class=\"hljs language-bash\">curl https://synapse.schaefer.zone/memory/recall?key=mk_yourMindKeyHere</code></pre><div class=\"callout callout-warn\">Der `?key=`-Query-Parameter ist auf **60 Requests pro Minute** begrenzt.\nDer Bearer-Header hat kein Rate Limit. Verwende den Header, wenn dein Client\neigene Header unterstützt.</div><h3>Einen Mind Key anlegen</h3>\n<pre><code class=\"hljs language-bash\">curl -X POST https://synapse.schaefer.zone/minds \\\n  -H <span class=\"hljs-string\">&quot;Authorization: Bearer YOUR_JWT&quot;</span> \\\n  -H <span class=\"hljs-string\">&quot;Content-Type: application/json&quot;</span> \\\n  -d <span class=\"hljs-string\">&#x27;{&quot;name&quot;: &quot;Work Mind&quot;, &quot;description&quot;: &quot;Project memories&quot;}&#x27;</span></code></pre><p>Die Antwort enthält <code>mind_key</code> — <strong>sofort speichern</strong>, er wird nur einmal\nangezeigt.</p>\n<h3>Deine Minds auflisten</h3>\n<pre><code class=\"hljs language-bash\">curl -H <span class=\"hljs-string\">&quot;Authorization: Bearer YOUR_JWT&quot;</span> \\\n     https://synapse.schaefer.zone/minds</code></pre><h3>Einen Mind löschen (unumkehrbar!)</h3>\n<pre><code class=\"hljs language-bash\">curl -X DELETE -H <span class=\"hljs-string\">&quot;Authorization: Bearer YOUR_JWT&quot;</span> \\\n     https://synapse.schaefer.zone/minds/m_xyz789</code></pre><h2>JWT (für Menschen)</h2>\n<p>JWTs authentifizieren das <strong>Nutzerkonto</strong>, nicht einen spezifischen Mind.\nVerwende sie für:</p>\n<ul>\n<li>Konto-Registrierung und Login</li>\n<li>Minds anlegen / auflisten / löschen</li>\n<li>Minds mit anderen Nutzern teilen</li>\n<li>Web-Push-Abonnement-Verwaltung</li>\n</ul>\n<h3>Registrieren</h3>\n<pre><code class=\"hljs language-bash\">curl -X POST https://synapse.schaefer.zone/register \\\n  -H <span class=\"hljs-string\">&quot;Content-Type: application/json&quot;</span> \\\n  -d <span class=\"hljs-string\">&#x27;{&quot;email&quot;: &quot;you@example.com&quot;, &quot;password&quot;: &quot;secret&quot;}&#x27;</span></code></pre><p>Liefert: <code>{ &quot;jwt&quot;: &quot;eyJ...&quot;, &quot;user&quot;: {...} }</code></p>\n<h3>Einloggen</h3>\n<pre><code class=\"hljs language-bash\">curl -X POST https://synapse.schaefer.zone/login \\\n  -H <span class=\"hljs-string\">&quot;Content-Type: application/json&quot;</span> \\\n  -d <span class=\"hljs-string\">&#x27;{&quot;email&quot;: &quot;you@example.com&quot;, &quot;password&quot;: &quot;secret&quot;}&#x27;</span></code></pre><p>Liefert: <code>{ &quot;jwt&quot;: &quot;eyJ...&quot;, &quot;user&quot;: {...} }</code></p>\n<h3>JWT-Ablauf</h3>\n<p>JWTs laufen nach <strong>7 Tagen</strong> ab. Wenn ein JWT abläuft, rufe einfach wieder\n<code>/login</code> auf, um ein frisches zu erhalten. Der Mind Key läuft nie ab, daher\nfunktionieren bestehende Agent-Integrationen weiter.</p>\n<h2>Security-Best-Practices</h2>\n<div class=\"callout callout-critical\"></div><h3>Environment-Variablen-Pattern</h3>\n<pre><code class=\"hljs language-bash\"><span class=\"hljs-comment\"># .env (NEVER commit this file)</span>\nSYNAPSE_MIND_KEY=mk_yourMindKeyHere\nSYNAPSE_URL=https://synapse.schaefer.zone</code></pre><pre><code class=\"hljs language-typescript\"><span class=\"hljs-comment\">// Node.js</span>\n<span class=\"hljs-keyword\">const</span> mindKey = process.<span class=\"hljs-property\">env</span>.<span class=\"hljs-property\">SYNAPSE_MIND_KEY</span>;\n<span class=\"hljs-keyword\">const</span> url = process.<span class=\"hljs-property\">env</span>.<span class=\"hljs-property\">SYNAPSE_URL</span>;\n<span class=\"hljs-keyword\">await</span> <span class=\"hljs-title function_\">fetch</span>(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${url}</span>/memory/recall`</span>, {\n  <span class=\"hljs-attr\">headers</span>: { <span class=\"hljs-title class_\">Authorization</span>: <span class=\"hljs-string\">`Bearer <span class=\"hljs-subst\">${mindKey}</span>`</span> },\n});</code></pre><h3>MCP-Server-Config</h3>\n<pre><code class=\"hljs language-json\"><span class=\"hljs-punctuation\">{</span>\n  <span class=\"hljs-attr\">&quot;mcpServers&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">{</span>\n    <span class=\"hljs-attr\">&quot;synapse&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">{</span>\n      <span class=\"hljs-attr\">&quot;command&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;npx&quot;</span><span class=\"hljs-punctuation\">,</span>\n      <span class=\"hljs-attr\">&quot;args&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">[</span><span class=\"hljs-string\">&quot;-y&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;synapse-mcp-api@latest&quot;</span><span class=\"hljs-punctuation\">]</span><span class=\"hljs-punctuation\">,</span>\n      <span class=\"hljs-attr\">&quot;env&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">{</span>\n        <span class=\"hljs-attr\">&quot;SYNAPSE_MIND_KEY&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;mk_yourMindKeyHere&quot;</span><span class=\"hljs-punctuation\">,</span>\n        <span class=\"hljs-attr\">&quot;SYNAPSE_URL&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;https://synapse.schaefer.zone&quot;</span>\n      <span class=\"hljs-punctuation\">}</span>\n    <span class=\"hljs-punctuation\">}</span>\n  <span class=\"hljs-punctuation\">}</span>\n<span class=\"hljs-punctuation\">}</span></code></pre><h2>Multi-Mind-Pattern</h2>\n<p>Jeder Nutzer kann mehrere Minds haben. Häufige Patterns:</p>\n<table>\n<thead>\n<tr>\n<th>Mind-Name</th>\n<th>Zweck</th>\n</tr>\n</thead>\n<tbody><tr>\n<td><code>work</code></td>\n<td>Job-bezogene Memories</td>\n</tr>\n<tr>\n<td><code>personal</code></td>\n<td>Persönliche Präferenzen, Familie</td>\n</tr>\n<tr>\n<td><code>project-synapse</code></td>\n<td>Spezifischer Projekt-Kontext</td>\n</tr>\n<tr>\n<td><code>learning-german</code></td>\n<td>Lernfortschritt</td>\n</tr>\n<tr>\n<td><code>assistant-default</code></td>\n<td>Allzweck-Fallback</td>\n</tr>\n</tbody></table>\n<p>Verwende in verschiedenen LLM-Sessions unterschiedliche Mind Keys, um Kontexte\ngetrennt zu halten.</p>\n<h2>Rate Limits</h2>\n<table>\n<thead>\n<tr>\n<th>Auth-Methode</th>\n<th>Limit</th>\n<th>Scope</th>\n</tr>\n</thead>\n<tbody><tr>\n<td>Mind Key (Header)</td>\n<td>Keins</td>\n<td>Pro-Mind</td>\n</tr>\n<tr>\n<td>Mind Key (?key=)</td>\n<td>60/min</td>\n<td>Pro-IP</td>\n</tr>\n<tr>\n<td>JWT (Header)</td>\n<td>Keins</td>\n<td>Pro-Nutzer</td>\n</tr>\n<tr>\n<td>Öffentliche Endpunkte</td>\n<td>Keins</td>\n<td>Global</td>\n</tr>\n</tbody></table>\n<p>Rate-Limit-Header (<code>X-RateLimit-Limit</code>, <code>X-RateLimit-Remaining</code>, <code>Retry-After</code>)\nwerden bei Bedarf in Antworten mitgeliefert.</p>\n<h2>Nächste Schritte</h2>\n<ul>\n<li><a href=\"/docs/getting-started/mind-key-vs-jwt\">Mind Key vs JWT</a> — wann was verwenden</li>\n<li><a href=\"/docs/api/memory\">Memory-API</a> — was du mit einem Mind Key tun kannst</li>\n<li><a href=\"/docs/api/user\">User-API</a> — Kontoverwaltung mit JWTs</li>\n</ul>\n","urls":{"html":"/docs/getting-started/authentication","text":"/docs/getting-started/authentication?format=text","json":"/docs/getting-started/authentication?format=json","llm":"/docs/getting-started/authentication?format=llm"},"translations_available":["en","zh","hi","es","fr","ar","pt","ru","ja","de","it","ko","nl","pl","tr","sv","vi","th","id","uk"]}