{"title":"Authenticatie & Mind Keys","slug":"authentication","category":"getting-started","summary":"Hoe Synapse-authenticatie werkt: Mind Keys voor agents, JWT's voor mensen, ?key= voor URL-only tools.","audience":["human","llm"],"tags":["auth","mind-key","jwt","security"],"difficulty":"beginner","updated":"2026-06-27","word_count":443,"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":"nl","translated":true,"requested_lang":"nl","content_markdown":"\n# Authenticatie & Mind Keys\n\nSynapse gebruikt twee authenticatiemethoden, elk geoptimaliseerd voor een ander doel.\nHet verschil begrijpen is essentieel voor het bouwen van betrouwbare integraties.\n\n## Twee auth-methoden\n\n| Methode | Gebruik | Ratelimit | Verval |\n|---------|---------|-----------|--------|\n| **Mind Key** | LLM-agents, geautomatiseerde tools | Geen (header) / 60 per min (query) | Nooit |\n| **JWT** | Mensgerichte UI, account-operaties | Geen | 7 dagen |\n\n## Mind Key (voor agents)\n\nEen Mind Key is een tenant-scoped API-token. Het authenticeert de data van één mind\n(herinneringen, taken, chat, scripts, enz.). Gebruik het voor:\n\n- LLM-agents die de API aanroepen\n- Achtergrond-automatiseringsscripts\n- MCP-server-configuratie\n- Elke langlevende integratie\n\n### Header-authenticatie (aanbevolen)\n\n```bash\ncurl -H \"Authorization: Bearer mk_yourMindKeyHere\" \\\n     https://synapse.schaefer.zone/memory/recall\n```\n\n### Queryparameter (voor URL-only tools)\n\n```bash\ncurl https://synapse.schaefer.zone/memory/recall?key=mk_yourMindKeyHere\n```\n\n> [!WARNING]\n> De `?key=`-queryparameter is gelimiteerd tot **60 verzoeken per minuut**.\n> De Bearer-header heeft geen ratelimit. Gebruik de header wanneer uw client\n> aangepaste headers ondersteunt.\n\n### Een Mind Key aanmaken\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\nDe respons bevat `mind_key` — **sla deze onmiddellijk op**, deze wordt slechts één keer getoond.\n\n### Uw minds tonen\n\n```bash\ncurl -H \"Authorization: Bearer YOUR_JWT\" \\\n     https://synapse.schaefer.zone/minds\n```\n\n### Een mind verwijderen (onomkeerbaar!)\n\n```bash\ncurl -X DELETE -H \"Authorization: Bearer YOUR_JWT\" \\\n     https://synapse.schaefer.zone/minds/m_xyz789\n```\n\n## JWT (voor mensen)\n\nJWT's authenticeren het **gebruikersaccount**, niet een specifieke mind. Gebruik ze voor:\n\n- Accountregistratie en login\n- Minds aanmaken/tonen/verwijderen\n- Minds delen met andere gebruikers\n- Web Push-abonnementsbeheer\n\n### Registreren\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\nRetourneert: `{ \"jwt\": \"eyJ...\", \"user\": {...} }`\n\n### Inloggen\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\nRetourneert: `{ \"jwt\": \"eyJ...\", \"user\": {...} }`\n\n### JWT-verval\n\nJWT's vervallen na **7 dagen**. Wanneer een JWT vervalt, roept u gewoon opnieuw `/login`\naan om een verse te krijgen. De Mind Key vervalt nooit, dus bestaande agent-integraties\nblijven werken.\n\n## Beveiligings-best-practices\n\n> [!CRITICAL]\n> - **Commit Mind Keys nooit naar git.** Gebruik omgevingsvariabelen.\n> - **Log Mind Keys nooit.** Maskeer ze in logs (`mk_***...***xyz`).\n> - **Roteer sleutels** bij vermoeden van een lek (verwijder de mind, maak een nieuwe aan).\n> - **Gebruik één mind per project** om de schade bij een lek te beperken.\n\n### Omgevingsvariabele-patroon\n\n```bash\n# .env (NOOIT dit bestand committen)\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-patroon\n\nElke gebruiker kan meerdere minds hebben. Veelvoorkomende patronen:\n\n| Mind-naam | Doel |\n|-----------|------|\n| `work` | Werkgerelateerde herinneringen |\n| `personal` | Persoonlijke voorkeuren, familie |\n| `project-synapse` | Specifieke projectcontext |\n| `learning-german` | Leervoortgang |\n| `assistant-default` | Algemene fallback |\n\nGebruik verschillende Mind Keys voor verschillende LLM-sessies om contexten gescheiden te houden.\n\n## Ratelimits\n\n| Auth-methode | Limiet | Bereik |\n|--------------|--------|--------|\n| Mind Key (header) | Geen | Per-mind |\n| Mind Key (?key=) | 60/min | Per-IP |\n| JWT (header) | Geen | Per-gebruiker |\n| Openbare eindpunten | Geen | Globaal |\n\nRatelimit-headers (`X-RateLimit-Limit`, `X-RateLimit-Remaining`, `Retry-After`)\nworden in responsen opgenomen waar van toepassing.\n\n## Volgende stappen\n\n- [Mind Key vs JWT](/docs/getting-started/mind-key-vs-jwt) — wanneer welke gebruiken\n- [Memory API](/docs/api/memory) — wat u kunt doen met een Mind Key\n- [User API](/docs/api/user) — accountbeheer met JWT's\n","content_html":"<h1>Authenticatie &amp; Mind Keys</h1>\n<p>Synapse gebruikt twee authenticatiemethoden, elk geoptimaliseerd voor een ander doel.\nHet verschil begrijpen is essentieel voor het bouwen van betrouwbare integraties.</p>\n<h2>Twee auth-methoden</h2>\n<table>\n<thead>\n<tr>\n<th>Methode</th>\n<th>Gebruik</th>\n<th>Ratelimit</th>\n<th>Verval</th>\n</tr>\n</thead>\n<tbody><tr>\n<td><strong>Mind Key</strong></td>\n<td>LLM-agents, geautomatiseerde tools</td>\n<td>Geen (header) / 60 per min (query)</td>\n<td>Nooit</td>\n</tr>\n<tr>\n<td><strong>JWT</strong></td>\n<td>Mensgerichte UI, account-operaties</td>\n<td>Geen</td>\n<td>7 dagen</td>\n</tr>\n</tbody></table>\n<h2>Mind Key (voor agents)</h2>\n<p>Een Mind Key is een tenant-scoped API-token. Het authenticeert de data van één mind\n(herinneringen, taken, chat, scripts, enz.). Gebruik het voor:</p>\n<ul>\n<li>LLM-agents die de API aanroepen</li>\n<li>Achtergrond-automatiseringsscripts</li>\n<li>MCP-server-configuratie</li>\n<li>Elke langlevende integratie</li>\n</ul>\n<h3>Header-authenticatie (aanbevolen)</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>Queryparameter (voor URL-only 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\">De `?key=`-queryparameter is gelimiteerd tot **60 verzoeken per minuut**.\nDe Bearer-header heeft geen ratelimit. Gebruik de header wanneer uw client\naangepaste headers ondersteunt.</div><h3>Een Mind Key aanmaken</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>De respons bevat <code>mind_key</code> — <strong>sla deze onmiddellijk op</strong>, deze wordt slechts één keer getoond.</p>\n<h3>Uw minds tonen</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>Een mind verwijderen (onomkeerbaar!)</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 (voor mensen)</h2>\n<p>JWT&#39;s authenticeren het <strong>gebruikersaccount</strong>, niet een specifieke mind. Gebruik ze voor:</p>\n<ul>\n<li>Accountregistratie en login</li>\n<li>Minds aanmaken/tonen/verwijderen</li>\n<li>Minds delen met andere gebruikers</li>\n<li>Web Push-abonnementsbeheer</li>\n</ul>\n<h3>Registreren</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>Retourneert: <code>{ &quot;jwt&quot;: &quot;eyJ...&quot;, &quot;user&quot;: {...} }</code></p>\n<h3>Inloggen</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>Retourneert: <code>{ &quot;jwt&quot;: &quot;eyJ...&quot;, &quot;user&quot;: {...} }</code></p>\n<h3>JWT-verval</h3>\n<p>JWT&#39;s vervallen na <strong>7 dagen</strong>. Wanneer een JWT vervalt, roept u gewoon opnieuw <code>/login</code>\naan om een verse te krijgen. De Mind Key vervalt nooit, dus bestaande agent-integraties\nblijven werken.</p>\n<h2>Beveiligings-best-practices</h2>\n<div class=\"callout callout-critical\"></div><h3>Omgevingsvariabele-patroon</h3>\n<pre><code class=\"hljs language-bash\"><span class=\"hljs-comment\"># .env (NOOIT dit bestand committen)</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-patroon</h2>\n<p>Elke gebruiker kan meerdere minds hebben. Veelvoorkomende patronen:</p>\n<table>\n<thead>\n<tr>\n<th>Mind-naam</th>\n<th>Doel</th>\n</tr>\n</thead>\n<tbody><tr>\n<td><code>work</code></td>\n<td>Werkgerelateerde herinneringen</td>\n</tr>\n<tr>\n<td><code>personal</code></td>\n<td>Persoonlijke voorkeuren, familie</td>\n</tr>\n<tr>\n<td><code>project-synapse</code></td>\n<td>Specifieke projectcontext</td>\n</tr>\n<tr>\n<td><code>learning-german</code></td>\n<td>Leervoortgang</td>\n</tr>\n<tr>\n<td><code>assistant-default</code></td>\n<td>Algemene fallback</td>\n</tr>\n</tbody></table>\n<p>Gebruik verschillende Mind Keys voor verschillende LLM-sessies om contexten gescheiden te houden.</p>\n<h2>Ratelimits</h2>\n<table>\n<thead>\n<tr>\n<th>Auth-methode</th>\n<th>Limiet</th>\n<th>Bereik</th>\n</tr>\n</thead>\n<tbody><tr>\n<td>Mind Key (header)</td>\n<td>Geen</td>\n<td>Per-mind</td>\n</tr>\n<tr>\n<td>Mind Key (?key=)</td>\n<td>60/min</td>\n<td>Per-IP</td>\n</tr>\n<tr>\n<td>JWT (header)</td>\n<td>Geen</td>\n<td>Per-gebruiker</td>\n</tr>\n<tr>\n<td>Openbare eindpunten</td>\n<td>Geen</td>\n<td>Globaal</td>\n</tr>\n</tbody></table>\n<p>Ratelimit-headers (<code>X-RateLimit-Limit</code>, <code>X-RateLimit-Remaining</code>, <code>Retry-After</code>)\nworden in responsen opgenomen waar van toepassing.</p>\n<h2>Volgende stappen</h2>\n<ul>\n<li><a href=\"/docs/getting-started/mind-key-vs-jwt\">Mind Key vs JWT</a> — wanneer welke gebruiken</li>\n<li><a href=\"/docs/api/memory\">Memory API</a> — wat u kunt doen met een Mind Key</li>\n<li><a href=\"/docs/api/user\">User API</a> — accountbeheer met JWT&#39;s</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"]}