{"title":"Limiti di traffico e quote","slug":"rate-limits","category":"api","summary":"Politica di rate limit dell'API Synapse — header Bearer (illimitato), ?key= (60/min), endpoint pubblici.","audience":["human","llm"],"tags":["api","rate-limits","quotas","throttling"],"difficulty":"beginner","updated":"2026-06-27","word_count":353,"read_minutes":2,"llm_context":"Mind Key (Authorization: Bearer header) → NO rate limit\nMind Key (?key= query param) → 60 req/min per IP\nJWT (Authorization: Bearer header) → NO rate limit\nPublic endpoints (/tools/*, /docs, /health, /endpoints) → NO rate limit\nRate limit headers: X-RateLimit-Limit, X-RateLimit-Remaining, Retry-After\nRecommendation: ALWAYS use Authorization header. Use ?key= only for URL-only tools.\n","lang":"it","translated":true,"requested_lang":"it","content_markdown":"\n# Limiti di traffico e quote\n\nSynapse ha una politica di rate limit semplice e prevedibile, progettata per\nprevenire abusi senza intralciare l'uso legittimo.\n\n## Politica di rate limit\n\n| Metodo di auth | Limite | Ambito |\n|-------------|-------|-------|\n| Mind Key (`Authorization: Bearer`) | **Nessuno** | Per-mente |\n| Mind Key (`?key=`) | 60 req/min | Per-IP |\n| JWT (`Authorization: Bearer`) | **Nessuno** | Per-utente |\n| Endpoint pubblici | **Nessuno** | Globale |\n\n> [!TIP]\n> **Usi sempre l'header `Authorization: Bearer`** quando possibile. Non ha\n> limiti di traffico. Usi `?key=` solo per strumenti che non possono impostare\n> header personalizzati.\n\n## Header di rate limit\n\nQuando usa l'autenticazione `?key=`, le risposte includono header di rate limit:\n\n```\nX-RateLimit-Limit: 60\nX-RateLimit-Remaining: 42\nX-RateLimit-Reset: 1782567840\n```\n\nQuando supera il limite:\n\n```\nHTTP/1.1 429 Too Many Requests\nX-RateLimit-Limit: 60\nX-RateLimit-Remaining: 0\nRetry-After: 42\nContent-Type: application/json\n\n{\n  \"statusCode\": 429,\n  \"error\": \"Too Many Requests\",\n  \"message\": \"Rate limit exceeded. Use Authorization header for unlimited access.\"\n}\n```\n\n## Quando raggiunge un limite\n\nSe ottiene un 429:\n\n1. **Passi all'header Authorization** (consigliato):\n   ```bash\n   # Don't: ?key=YOUR_MIND_KEY (60/min limit)\n   curl \".../memory/recall?key=YOUR_MIND_KEY\"\n   \n   # Do: Authorization header (unlimited)\n   curl -H \"Authorization: Bearer YOUR_MIND_KEY\" .../memory/recall\n   ```\n\n2. **Oppure attenda `Retry-After` secondi** e riprovi.\n\n## Perché esiste il limite ?key=\n\nIl parametro query `?key=` è comodo per strumenti solo-URL (browser, comandi\n`open`), ma ha implicazioni di sicurezza e prestazioni:\n\n- **Sicurezza:** I parametri query vengono registrati nei log di accesso del\n  server, nella cronologia del browser e negli header Referer. Limitarne l'uso\n  riduce l'esposizione.\n- **Prestazioni:** L'autenticazione tramite parametro query richiede un rate\n  limiter basato su IP (lookup Redis per richiesta), che aggiunge latenza.\n  L'autenticazione tramite header lo salta.\n- **Prevenzione abusi:** Un URL `?key=` leakato potrebbe essere condiviso e\n  bombardato di richieste. Il limite per IP contiene il raggio d'azione.\n\n## Modelli consigliati\n\n### Agenti LLM\n\n```python\n# Always use header auth\nheaders = {\"Authorization\": f\"Bearer {MIND_KEY}\"}\nresponse = requests.get(f\"{URL}/memory/recall\", headers=headers)\n```\n\n### Strumenti basati su browser\n\nSe il suo strumento può solo aprire URL:\n\n```bash\n# OK for occasional use (under 60/min)\nopen \"https://synapse.schaefer.zone/memory/recall?key=YOUR_MIND_KEY\"\n\n# For frequent use, switch to a tool that supports headers\ncurl -H \"Authorization: Bearer YOUR_MIND_KEY\" .../memory/recall\n```\n\n### Server MCP\n\nI server MCP usano sempre l'autenticazione tramite header usando la variabile\ndi ambiente `SYNAPSE_MIND_KEY` — nessun limite di traffico si applica.\n\n### Importazioni bulk\n\nPer operazioni bulk (es. importare 1000 memorie), usi sempre l'autenticazione\ntramite header. Le importazioni bulk tramite `?key=` raggiungono il limite entro\n1 minuto.\n\n## Quote (livello mente)\n\nAttualmente non ci sono quote per mente sulla dimensione di archiviazione o\nsul numero di memorie. Tutti i limiti sono a livello di auth/IP, non di dati.\nQuesto potrebbe cambiare in futuro per equità multi-tenant.\n\n## Monitoraggio dell'utilizzo\n\n```bash\n# Check your current rate limit status (with ?key= auth)\ncurl -i \"https://synapse.schaefer.zone/memory/stats?key=YOUR_MIND_KEY\" | grep -i ratelimit\n\n# Output:\n# X-RateLimit-Limit: 60\n# X-RateLimit-Remaining: 58\n# X-RateLimit-Reset: 1782567840\n```\n\n## Prossimi passi\n\n- [Autenticazione](/docs/getting-started/authentication)\n- [Errori e gestione degli errori](/docs/api/errors)\n","content_html":"<h1>Limiti di traffico e quote</h1>\n<p>Synapse ha una politica di rate limit semplice e prevedibile, progettata per\nprevenire abusi senza intralciare l&#39;uso legittimo.</p>\n<h2>Politica di rate limit</h2>\n<table>\n<thead>\n<tr>\n<th>Metodo di auth</th>\n<th>Limite</th>\n<th>Ambito</th>\n</tr>\n</thead>\n<tbody><tr>\n<td>Mind Key (<code>Authorization: Bearer</code>)</td>\n<td><strong>Nessuno</strong></td>\n<td>Per-mente</td>\n</tr>\n<tr>\n<td>Mind Key (<code>?key=</code>)</td>\n<td>60 req/min</td>\n<td>Per-IP</td>\n</tr>\n<tr>\n<td>JWT (<code>Authorization: Bearer</code>)</td>\n<td><strong>Nessuno</strong></td>\n<td>Per-utente</td>\n</tr>\n<tr>\n<td>Endpoint pubblici</td>\n<td><strong>Nessuno</strong></td>\n<td>Globale</td>\n</tr>\n</tbody></table>\n<div class=\"callout callout-ok\">**Usi sempre l'header `Authorization: Bearer`** quando possibile. Non ha\nlimiti di traffico. Usi `?key=` solo per strumenti che non possono impostare\nheader personalizzati.</div><h2>Header di rate limit</h2>\n<p>Quando usa l&#39;autenticazione <code>?key=</code>, le risposte includono header di rate limit:</p>\n<pre><code class=\"hljs language-plaintext\">X-RateLimit-Limit: 60\nX-RateLimit-Remaining: 42\nX-RateLimit-Reset: 1782567840</code></pre><p>Quando supera il limite:</p>\n<pre><code class=\"hljs language-plaintext\">HTTP/1.1 429 Too Many Requests\nX-RateLimit-Limit: 60\nX-RateLimit-Remaining: 0\nRetry-After: 42\nContent-Type: application/json\n\n{\n  &quot;statusCode&quot;: 429,\n  &quot;error&quot;: &quot;Too Many Requests&quot;,\n  &quot;message&quot;: &quot;Rate limit exceeded. Use Authorization header for unlimited access.&quot;\n}</code></pre><h2>Quando raggiunge un limite</h2>\n<p>Se ottiene un 429:</p>\n<ol>\n<li><p><strong>Passi all&#39;header Authorization</strong> (consigliato):</p>\n<pre><code class=\"hljs language-bash\"><span class=\"hljs-comment\"># Don&#x27;t: ?key=YOUR_MIND_KEY (60/min limit)</span>\ncurl <span class=\"hljs-string\">&quot;.../memory/recall?key=YOUR_MIND_KEY&quot;</span>\n\n<span class=\"hljs-comment\"># Do: Authorization header (unlimited)</span>\ncurl -H <span class=\"hljs-string\">&quot;Authorization: Bearer YOUR_MIND_KEY&quot;</span> .../memory/recall</code></pre></li>\n<li><p><strong>Oppure attenda <code>Retry-After</code> secondi</strong> e riprovi.</p>\n</li>\n</ol>\n<h2>Perché esiste il limite ?key=</h2>\n<p>Il parametro query <code>?key=</code> è comodo per strumenti solo-URL (browser, comandi\n<code>open</code>), ma ha implicazioni di sicurezza e prestazioni:</p>\n<ul>\n<li><strong>Sicurezza:</strong> I parametri query vengono registrati nei log di accesso del\nserver, nella cronologia del browser e negli header Referer. Limitarne l&#39;uso\nriduce l&#39;esposizione.</li>\n<li><strong>Prestazioni:</strong> L&#39;autenticazione tramite parametro query richiede un rate\nlimiter basato su IP (lookup Redis per richiesta), che aggiunge latenza.\nL&#39;autenticazione tramite header lo salta.</li>\n<li><strong>Prevenzione abusi:</strong> Un URL <code>?key=</code> leakato potrebbe essere condiviso e\nbombardato di richieste. Il limite per IP contiene il raggio d&#39;azione.</li>\n</ul>\n<h2>Modelli consigliati</h2>\n<h3>Agenti LLM</h3>\n<pre><code class=\"hljs language-python\"><span class=\"hljs-comment\"># Always use header auth</span>\nheaders = {<span class=\"hljs-string\">&quot;Authorization&quot;</span>: <span class=\"hljs-string\">f&quot;Bearer <span class=\"hljs-subst\">{MIND_KEY}</span>&quot;</span>}\nresponse = requests.get(<span class=\"hljs-string\">f&quot;<span class=\"hljs-subst\">{URL}</span>/memory/recall&quot;</span>, headers=headers)</code></pre><h3>Strumenti basati su browser</h3>\n<p>Se il suo strumento può solo aprire URL:</p>\n<pre><code class=\"hljs language-bash\"><span class=\"hljs-comment\"># OK for occasional use (under 60/min)</span>\nopen <span class=\"hljs-string\">&quot;https://synapse.schaefer.zone/memory/recall?key=YOUR_MIND_KEY&quot;</span>\n\n<span class=\"hljs-comment\"># For frequent use, switch to a tool that supports headers</span>\ncurl -H <span class=\"hljs-string\">&quot;Authorization: Bearer YOUR_MIND_KEY&quot;</span> .../memory/recall</code></pre><h3>Server MCP</h3>\n<p>I server MCP usano sempre l&#39;autenticazione tramite header usando la variabile\ndi ambiente <code>SYNAPSE_MIND_KEY</code> — nessun limite di traffico si applica.</p>\n<h3>Importazioni bulk</h3>\n<p>Per operazioni bulk (es. importare 1000 memorie), usi sempre l&#39;autenticazione\ntramite header. Le importazioni bulk tramite <code>?key=</code> raggiungono il limite entro\n1 minuto.</p>\n<h2>Quote (livello mente)</h2>\n<p>Attualmente non ci sono quote per mente sulla dimensione di archiviazione o\nsul numero di memorie. Tutti i limiti sono a livello di auth/IP, non di dati.\nQuesto potrebbe cambiare in futuro per equità multi-tenant.</p>\n<h2>Monitoraggio dell&#39;utilizzo</h2>\n<pre><code class=\"hljs language-bash\"><span class=\"hljs-comment\"># Check your current rate limit status (with ?key= auth)</span>\ncurl -i <span class=\"hljs-string\">&quot;https://synapse.schaefer.zone/memory/stats?key=YOUR_MIND_KEY&quot;</span> | grep -i ratelimit\n\n<span class=\"hljs-comment\"># Output:</span>\n<span class=\"hljs-comment\"># X-RateLimit-Limit: 60</span>\n<span class=\"hljs-comment\"># X-RateLimit-Remaining: 58</span>\n<span class=\"hljs-comment\"># X-RateLimit-Reset: 1782567840</span></code></pre><h2>Prossimi passi</h2>\n<ul>\n<li><a href=\"/docs/getting-started/authentication\">Autenticazione</a></li>\n<li><a href=\"/docs/api/errors\">Errori e gestione degli errori</a></li>\n</ul>\n","urls":{"html":"/docs/api/rate-limits","text":"/docs/api/rate-limits?format=text","json":"/docs/api/rate-limits?format=json","llm":"/docs/api/rate-limits?format=llm"},"translations_available":["en","zh","hi","es","fr","ar","pt","ru","ja","de","it","ko","nl","pl","tr","sv","vi","th","id","uk"]}