{"title":"Sauvegarde & restauration","slug":"backup-restore","category":"guides","summary":"Exportez vos mémoires pour sauvegarde, migrez entre minds, restaurez après une perte de données.","audience":["human","llm"],"tags":["guide","backup","restore","migration"],"difficulty":"beginner","updated":"2026-06-27","word_count":292,"read_minutes":1,"lang":"fr","translated":true,"requested_lang":"fr","content_markdown":"\n# Sauvegarde & restauration\n\nSynapse fournit un export/import complet pour la sauvegarde de mémoire, la migration\net la reprise après sinistre. Ce guide couvre les opérations essentielles.\n\n## Export\n\n### Export complet du mind\n\nExportez toutes les mémoires d'un mind en JSON :\n\n```bash\ncurl -H \"Authorization: Bearer YOUR_MIND_KEY\" \\\n     https://synapse.schaefer.zone/memory/mind-export > backup.json\n```\n\nFormat de réponse :\n\n```json\n{\n  \"mind_id\": \"m_xyz789\",\n  \"mind_name\": \"Work Mind\",\n  \"exported_at\": \"2026-06-27T...\",\n  \"memory_count\": 142,\n  \"memories\": [\n    {\n      \"id\": \"mem_001\",\n      \"category\": \"identity\",\n      \"key\": \"user_name\",\n      \"content\": \"Michael Schäfer\",\n      \"tags\": [\"person\", \"identity\"],\n      \"priority\": \"critical\",\n      \"source\": \"user\",\n      \"verified\": true,\n      \"created_at\": \"2026-06-15T...\",\n      \"updated_at\": \"2026-06-27T...\"\n    }\n  ]\n}\n```\n\n### Export incrémental (diff)\n\nExportez uniquement les mémoires modifiées depuis un horodatage :\n\n```bash\nSINCE=$(date -d \"2026-06-01\" +%s)\ncurl -H \"Authorization: Bearer YOUR_MIND_KEY\" \\\n     \"https://synapse.schaefer.zone/memory/diff?since=$SINCE\" > incremental.json\n```\n\nRéponse :\n\n```json\n{\n  \"added\": [...],\n  \"updated\": [...],\n  \"deleted\": [...]\n}\n```\n\n### Sauvegardes automatisées\n\nPlanifiez des sauvegardes quotidiennes via cron :\n\n```bash\ncurl -X POST https://synapse.schaefer.zone/cron \\\n  -H \"Authorization: Bearer YOUR_MIND_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"schedule\": \"0 2 * * *\",\n    \"endpoint\": \"https://synapse.schaefer.zone/memory/mind-export\",\n    \"method\": \"GET\",\n    \"headers\": {\"Authorization\": \"Bearer YOUR_MIND_KEY\"}\n  }'\n```\n\n> [!NOTE]\n> L'endpoint cron reçoit la réponse mais ne la stocke pas. Pour de vraies sauvegardes,\n> pointez le cron vers votre propre serveur de sauvegarde qui enregistre la réponse.\n\n### Mieux : script de sauvegarde externe\n\n```bash\n#!/bin/bash\n# backup-synapse.sh\nMIND_KEY=\"${SYNAPSE_MIND_KEY}\"\nDATE=$(date +%Y%m%d)\nBACKUP_DIR=\"/backups/synapse\"\n\nmkdir -p \"$BACKUP_DIR\"\n\ncurl -s -H \"Authorization: Bearer $MIND_KEY\" \\\n     https://synapse.schaefer.zone/memory/mind-export \\\n     > \"$BACKUP_DIR/synapse-$DATE.json\"\n\n# Conserver les 30 derniers jours\nfind \"$BACKUP_DIR\" -name \"synapse-*.json\" -mtime +30 -delete\n\necho \"Backup saved: $BACKUP_DIR/synapse-$DATE.json\"\n```\n\nAjoutez à crontab :\n\n```cron\n0 2 * * * /usr/local/bin/backup-synapse.sh\n```\n\n## Restauration\n\n### Restaurer vers le même mind\n\n```bash\n# Analyser la sauvegarde et re-POSTer chaque mémoire\njq -c '.memories[]' backup.json | while read mem; do\n  curl -X POST https://synapse.schaefer.zone/memory \\\n    -H \"Authorization: Bearer YOUR_MIND_KEY\" \\\n    -H \"Content-Type: application/json\" \\\n    -d \"$(echo \"$mem\" | jq '{category, key, content, tags, priority}')\"\ndone\n```\n\n### Restaurer vers un nouveau mind\n\n```bash\n# 1. Créer un nouveau mind\nNEW_KEY=$(curl -s -X POST https://synapse.schaefer.zone/minds \\\n  -H \"Authorization: Bearer YOUR_JWT\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"name\":\"Restored Mind\",\"description\":\"Restore from backup\"}' \\\n  | jq -r .mind_key)\n\n# 2. Importer les mémoires vers le nouveau mind\njq -c '.memories[]' backup.json | while read mem; do\n  curl -X POST https://synapse.schaefer.zone/memory \\\n    -H \"Authorization: Bearer $NEW_KEY\" \\\n    -H \"Content-Type: application/json\" \\\n    -d \"$(echo \"$mem\" | jq '{category, key, content, tags, priority}')\"\ndone\n```\n\n### Script de restauration Python\n\n```python\nimport json\nimport requests\n\nURL = \"https://synapse.schaefer.zone\"\nMIND_KEY = \"mk_...\"\n\ndef restore(backup_file):\n    with open(backup_file) as f:\n        data = json.load(f)\n    \n    for mem in data[\"memories\"]:\n        requests.post(\n            f\"{URL}/memory\",\n            headers={\n                \"Authorization\": f\"Bearer {MIND_KEY}\",\n                \"Content-Type\": \"application/json\"\n            },\n            json={\n                \"category\": mem[\"category\"],\n                \"key\": mem[\"key\"],\n                \"content\": mem[\"content\"],\n                \"tags\": mem.get(\"tags\", []),\n                \"priority\": mem.get(\"priority\", \"normal\")\n            }\n        )\n    \n    print(f\"Restored {len(data['memories'])} memories\")\n\nrestore(\"backup.json\")\n```\n\n## Migration entre minds\n\n```python\ndef migrate_memories(source_key, target_key):\n    \"\"\"Migrate all memories from source mind to target mind.\"\"\"\n    # Export depuis la source\n    r = requests.get(\n        f\"{URL}/memory/mind-export\",\n        headers={\"Authorization\": f\"Bearer {source_key}\"}\n    )\n    data = r.json()\n    \n    # Import vers la cible\n    for mem in data[\"memories\"]:\n        requests.post(\n            f\"{URL}/memory\",\n            headers={\n                \"Authorization\": f\"Bearer {target_key}\",\n                \"Content-Type\": \"application/json\"\n            },\n            json={\n                \"category\": mem[\"category\"],\n                \"key\": mem[\"key\"],\n                \"content\": mem[\"content\"],\n                \"tags\": mem.get(\"tags\", []),\n                \"priority\": mem.get(\"priority\", \"normal\")\n            }\n        )\n    \n    print(f\"Migrated {len(data['memories'])} memories\")\n```\n\n## Sauvegarder d'autres données\n\nN'oubliez pas de sauvegarder :\n\n| Type de données | Endpoint |\n|-----------|----------|\n| Mémoires | `GET /memory/mind-export` |\n| Tâches | `GET /mind/tasks` |\n| Scripts | `GET /scripts` |\n| Webhooks | `GET /webhooks` |\n| Tâches cron | `GET /cron` |\n| Variables | `GET /var` |\n| Historique chat | `GET /chat/history?limit=10000` |\n\n## Vérification\n\nAprès restauration, vérifiez :\n\n```bash\n# Compter les mémoires\ncurl -s -H \"Authorization: Bearer $KEY\" \\\n     https://synapse.schaefer.zone/memory/stats | jq .total\n\n# Comparer avec la sauvegarde\njq .memory_count backup.json\n```\n\n## Bonnes pratiques\n\n> [!TIP]\n> - **Sauvegardez quotidiennement** — automatisez avec cron\n> - **Testez les restaurations** — une sauvegarde que vous ne pouvez pas restaurer est inutile\n> - **Conservez plusieurs versions** — au moins 30 jours\n> - **Stockez hors site** — S3, Backblaze B2, etc.\n> - **Chiffrez les sauvegardes sensibles** — les mémoires peuvent contenir des PII\n> - **Documentez le processus de restauration** — vous l'aurez oublié quand vous en aurez besoin\n\n## Prochaines étapes\n\n- [API Memory](/docs/api/memory)\n- [Cron & Scheduler](/docs/api/cron) — pour les sauvegardes automatisées\n","content_html":"<h1>Sauvegarde &amp; restauration</h1>\n<p>Synapse fournit un export/import complet pour la sauvegarde de mémoire, la migration\net la reprise après sinistre. Ce guide couvre les opérations essentielles.</p>\n<h2>Export</h2>\n<h3>Export complet du mind</h3>\n<p>Exportez toutes les mémoires d&#39;un mind en JSON :</p>\n<pre><code class=\"hljs language-bash\">curl -H <span class=\"hljs-string\">&quot;Authorization: Bearer YOUR_MIND_KEY&quot;</span> \\\n     https://synapse.schaefer.zone/memory/mind-export &gt; backup.json</code></pre><p>Format de réponse :</p>\n<pre><code class=\"hljs language-json\"><span class=\"hljs-punctuation\">{</span>\n  <span class=\"hljs-attr\">&quot;mind_id&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;m_xyz789&quot;</span><span class=\"hljs-punctuation\">,</span>\n  <span class=\"hljs-attr\">&quot;mind_name&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;Work Mind&quot;</span><span class=\"hljs-punctuation\">,</span>\n  <span class=\"hljs-attr\">&quot;exported_at&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;2026-06-27T...&quot;</span><span class=\"hljs-punctuation\">,</span>\n  <span class=\"hljs-attr\">&quot;memory_count&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-number\">142</span><span class=\"hljs-punctuation\">,</span>\n  <span class=\"hljs-attr\">&quot;memories&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">[</span>\n    <span class=\"hljs-punctuation\">{</span>\n      <span class=\"hljs-attr\">&quot;id&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;mem_001&quot;</span><span class=\"hljs-punctuation\">,</span>\n      <span class=\"hljs-attr\">&quot;category&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;identity&quot;</span><span class=\"hljs-punctuation\">,</span>\n      <span class=\"hljs-attr\">&quot;key&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;user_name&quot;</span><span class=\"hljs-punctuation\">,</span>\n      <span class=\"hljs-attr\">&quot;content&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;Michael Schäfer&quot;</span><span class=\"hljs-punctuation\">,</span>\n      <span class=\"hljs-attr\">&quot;tags&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">[</span><span class=\"hljs-string\">&quot;person&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;identity&quot;</span><span class=\"hljs-punctuation\">]</span><span class=\"hljs-punctuation\">,</span>\n      <span class=\"hljs-attr\">&quot;priority&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;critical&quot;</span><span class=\"hljs-punctuation\">,</span>\n      <span class=\"hljs-attr\">&quot;source&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;user&quot;</span><span class=\"hljs-punctuation\">,</span>\n      <span class=\"hljs-attr\">&quot;verified&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-literal\"><span class=\"hljs-keyword\">true</span></span><span class=\"hljs-punctuation\">,</span>\n      <span class=\"hljs-attr\">&quot;created_at&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;2026-06-15T...&quot;</span><span class=\"hljs-punctuation\">,</span>\n      <span class=\"hljs-attr\">&quot;updated_at&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;2026-06-27T...&quot;</span>\n    <span class=\"hljs-punctuation\">}</span>\n  <span class=\"hljs-punctuation\">]</span>\n<span class=\"hljs-punctuation\">}</span></code></pre><h3>Export incrémental (diff)</h3>\n<p>Exportez uniquement les mémoires modifiées depuis un horodatage :</p>\n<pre><code class=\"hljs language-bash\">SINCE=$(<span class=\"hljs-built_in\">date</span> -d <span class=\"hljs-string\">&quot;2026-06-01&quot;</span> +%s)\ncurl -H <span class=\"hljs-string\">&quot;Authorization: Bearer YOUR_MIND_KEY&quot;</span> \\\n     <span class=\"hljs-string\">&quot;https://synapse.schaefer.zone/memory/diff?since=<span class=\"hljs-variable\">$SINCE</span>&quot;</span> &gt; incremental.json</code></pre><p>Réponse :</p>\n<pre><code class=\"hljs language-json\"><span class=\"hljs-punctuation\">{</span>\n  <span class=\"hljs-attr\">&quot;added&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">[</span>...<span class=\"hljs-punctuation\">]</span><span class=\"hljs-punctuation\">,</span>\n  <span class=\"hljs-attr\">&quot;updated&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">[</span>...<span class=\"hljs-punctuation\">]</span><span class=\"hljs-punctuation\">,</span>\n  <span class=\"hljs-attr\">&quot;deleted&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">[</span>...<span class=\"hljs-punctuation\">]</span>\n<span class=\"hljs-punctuation\">}</span></code></pre><h3>Sauvegardes automatisées</h3>\n<p>Planifiez des sauvegardes quotidiennes via cron :</p>\n<pre><code class=\"hljs language-bash\">curl -X POST https://synapse.schaefer.zone/cron \\\n  -H <span class=\"hljs-string\">&quot;Authorization: Bearer YOUR_MIND_KEY&quot;</span> \\\n  -H <span class=\"hljs-string\">&quot;Content-Type: application/json&quot;</span> \\\n  -d <span class=\"hljs-string\">&#x27;{\n    &quot;schedule&quot;: &quot;0 2 * * *&quot;,\n    &quot;endpoint&quot;: &quot;https://synapse.schaefer.zone/memory/mind-export&quot;,\n    &quot;method&quot;: &quot;GET&quot;,\n    &quot;headers&quot;: {&quot;Authorization&quot;: &quot;Bearer YOUR_MIND_KEY&quot;}\n  }&#x27;</span></code></pre><div class=\"callout callout-note\">L'endpoint cron reçoit la réponse mais ne la stocke pas. Pour de vraies sauvegardes,\npointez le cron vers votre propre serveur de sauvegarde qui enregistre la réponse.</div><h3>Mieux : script de sauvegarde externe</h3>\n<pre><code class=\"hljs language-bash\"><span class=\"hljs-meta\">#!/bin/bash</span>\n<span class=\"hljs-comment\"># backup-synapse.sh</span>\nMIND_KEY=<span class=\"hljs-string\">&quot;<span class=\"hljs-variable\">${SYNAPSE_MIND_KEY}</span>&quot;</span>\nDATE=$(<span class=\"hljs-built_in\">date</span> +%Y%m%d)\nBACKUP_DIR=<span class=\"hljs-string\">&quot;/backups/synapse&quot;</span>\n\n<span class=\"hljs-built_in\">mkdir</span> -p <span class=\"hljs-string\">&quot;<span class=\"hljs-variable\">$BACKUP_DIR</span>&quot;</span>\n\ncurl -s -H <span class=\"hljs-string\">&quot;Authorization: Bearer <span class=\"hljs-variable\">$MIND_KEY</span>&quot;</span> \\\n     https://synapse.schaefer.zone/memory/mind-export \\\n     &gt; <span class=\"hljs-string\">&quot;<span class=\"hljs-variable\">$BACKUP_DIR</span>/synapse-<span class=\"hljs-variable\">$DATE</span>.json&quot;</span>\n\n<span class=\"hljs-comment\"># Conserver les 30 derniers jours</span>\nfind <span class=\"hljs-string\">&quot;<span class=\"hljs-variable\">$BACKUP_DIR</span>&quot;</span> -name <span class=\"hljs-string\">&quot;synapse-*.json&quot;</span> -mtime +30 -delete\n\n<span class=\"hljs-built_in\">echo</span> <span class=\"hljs-string\">&quot;Backup saved: <span class=\"hljs-variable\">$BACKUP_DIR</span>/synapse-<span class=\"hljs-variable\">$DATE</span>.json&quot;</span></code></pre><p>Ajoutez à crontab :</p>\n<pre><code class=\"hljs language-plaintext\">0 2 * * * /usr/local/bin/backup-synapse.sh</code></pre><h2>Restauration</h2>\n<h3>Restaurer vers le même mind</h3>\n<pre><code class=\"hljs language-bash\"><span class=\"hljs-comment\"># Analyser la sauvegarde et re-POSTer chaque mémoire</span>\njq -c <span class=\"hljs-string\">&#x27;.memories[]&#x27;</span> backup.json | <span class=\"hljs-keyword\">while</span> <span class=\"hljs-built_in\">read</span> mem; <span class=\"hljs-keyword\">do</span>\n  curl -X POST https://synapse.schaefer.zone/memory \\\n    -H <span class=\"hljs-string\">&quot;Authorization: Bearer YOUR_MIND_KEY&quot;</span> \\\n    -H <span class=\"hljs-string\">&quot;Content-Type: application/json&quot;</span> \\\n    -d <span class=\"hljs-string\">&quot;<span class=\"hljs-subst\">$(echo <span class=\"hljs-string\">&quot;<span class=\"hljs-variable\">$mem</span>&quot;</span> | jq &#x27;{category, key, content, tags, priority}&#x27;)</span>&quot;</span>\n<span class=\"hljs-keyword\">done</span></code></pre><h3>Restaurer vers un nouveau mind</h3>\n<pre><code class=\"hljs language-bash\"><span class=\"hljs-comment\"># 1. Créer un nouveau mind</span>\nNEW_KEY=$(curl -s -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;Restored Mind&quot;,&quot;description&quot;:&quot;Restore from backup&quot;}&#x27;</span> \\\n  | jq -r .mind_key)\n\n<span class=\"hljs-comment\"># 2. Importer les mémoires vers le nouveau mind</span>\njq -c <span class=\"hljs-string\">&#x27;.memories[]&#x27;</span> backup.json | <span class=\"hljs-keyword\">while</span> <span class=\"hljs-built_in\">read</span> mem; <span class=\"hljs-keyword\">do</span>\n  curl -X POST https://synapse.schaefer.zone/memory \\\n    -H <span class=\"hljs-string\">&quot;Authorization: Bearer <span class=\"hljs-variable\">$NEW_KEY</span>&quot;</span> \\\n    -H <span class=\"hljs-string\">&quot;Content-Type: application/json&quot;</span> \\\n    -d <span class=\"hljs-string\">&quot;<span class=\"hljs-subst\">$(echo <span class=\"hljs-string\">&quot;<span class=\"hljs-variable\">$mem</span>&quot;</span> | jq &#x27;{category, key, content, tags, priority}&#x27;)</span>&quot;</span>\n<span class=\"hljs-keyword\">done</span></code></pre><h3>Script de restauration Python</h3>\n<pre><code class=\"hljs language-python\"><span class=\"hljs-keyword\">import</span> json\n<span class=\"hljs-keyword\">import</span> requests\n\nURL = <span class=\"hljs-string\">&quot;https://synapse.schaefer.zone&quot;</span>\nMIND_KEY = <span class=\"hljs-string\">&quot;mk_...&quot;</span>\n\n<span class=\"hljs-keyword\">def</span> <span class=\"hljs-title function_\">restore</span>(<span class=\"hljs-params\">backup_file</span>):\n    <span class=\"hljs-keyword\">with</span> <span class=\"hljs-built_in\">open</span>(backup_file) <span class=\"hljs-keyword\">as</span> f:\n        data = json.load(f)\n    \n    <span class=\"hljs-keyword\">for</span> mem <span class=\"hljs-keyword\">in</span> data[<span class=\"hljs-string\">&quot;memories&quot;</span>]:\n        requests.post(\n            <span class=\"hljs-string\">f&quot;<span class=\"hljs-subst\">{URL}</span>/memory&quot;</span>,\n            headers={\n                <span class=\"hljs-string\">&quot;Authorization&quot;</span>: <span class=\"hljs-string\">f&quot;Bearer <span class=\"hljs-subst\">{MIND_KEY}</span>&quot;</span>,\n                <span class=\"hljs-string\">&quot;Content-Type&quot;</span>: <span class=\"hljs-string\">&quot;application/json&quot;</span>\n            },\n            json={\n                <span class=\"hljs-string\">&quot;category&quot;</span>: mem[<span class=\"hljs-string\">&quot;category&quot;</span>],\n                <span class=\"hljs-string\">&quot;key&quot;</span>: mem[<span class=\"hljs-string\">&quot;key&quot;</span>],\n                <span class=\"hljs-string\">&quot;content&quot;</span>: mem[<span class=\"hljs-string\">&quot;content&quot;</span>],\n                <span class=\"hljs-string\">&quot;tags&quot;</span>: mem.get(<span class=\"hljs-string\">&quot;tags&quot;</span>, []),\n                <span class=\"hljs-string\">&quot;priority&quot;</span>: mem.get(<span class=\"hljs-string\">&quot;priority&quot;</span>, <span class=\"hljs-string\">&quot;normal&quot;</span>)\n            }\n        )\n    \n    <span class=\"hljs-built_in\">print</span>(<span class=\"hljs-string\">f&quot;Restored <span class=\"hljs-subst\">{<span class=\"hljs-built_in\">len</span>(data[<span class=\"hljs-string\">&#x27;memories&#x27;</span>])}</span> memories&quot;</span>)\n\nrestore(<span class=\"hljs-string\">&quot;backup.json&quot;</span>)</code></pre><h2>Migration entre minds</h2>\n<pre><code class=\"hljs language-python\"><span class=\"hljs-keyword\">def</span> <span class=\"hljs-title function_\">migrate_memories</span>(<span class=\"hljs-params\">source_key, target_key</span>):\n    <span class=\"hljs-string\">&quot;&quot;&quot;Migrate all memories from source mind to target mind.&quot;&quot;&quot;</span>\n    <span class=\"hljs-comment\"># Export depuis la source</span>\n    r = requests.get(\n        <span class=\"hljs-string\">f&quot;<span class=\"hljs-subst\">{URL}</span>/memory/mind-export&quot;</span>,\n        headers={<span class=\"hljs-string\">&quot;Authorization&quot;</span>: <span class=\"hljs-string\">f&quot;Bearer <span class=\"hljs-subst\">{source_key}</span>&quot;</span>}\n    )\n    data = r.json()\n    \n    <span class=\"hljs-comment\"># Import vers la cible</span>\n    <span class=\"hljs-keyword\">for</span> mem <span class=\"hljs-keyword\">in</span> data[<span class=\"hljs-string\">&quot;memories&quot;</span>]:\n        requests.post(\n            <span class=\"hljs-string\">f&quot;<span class=\"hljs-subst\">{URL}</span>/memory&quot;</span>,\n            headers={\n                <span class=\"hljs-string\">&quot;Authorization&quot;</span>: <span class=\"hljs-string\">f&quot;Bearer <span class=\"hljs-subst\">{target_key}</span>&quot;</span>,\n                <span class=\"hljs-string\">&quot;Content-Type&quot;</span>: <span class=\"hljs-string\">&quot;application/json&quot;</span>\n            },\n            json={\n                <span class=\"hljs-string\">&quot;category&quot;</span>: mem[<span class=\"hljs-string\">&quot;category&quot;</span>],\n                <span class=\"hljs-string\">&quot;key&quot;</span>: mem[<span class=\"hljs-string\">&quot;key&quot;</span>],\n                <span class=\"hljs-string\">&quot;content&quot;</span>: mem[<span class=\"hljs-string\">&quot;content&quot;</span>],\n                <span class=\"hljs-string\">&quot;tags&quot;</span>: mem.get(<span class=\"hljs-string\">&quot;tags&quot;</span>, []),\n                <span class=\"hljs-string\">&quot;priority&quot;</span>: mem.get(<span class=\"hljs-string\">&quot;priority&quot;</span>, <span class=\"hljs-string\">&quot;normal&quot;</span>)\n            }\n        )\n    \n    <span class=\"hljs-built_in\">print</span>(<span class=\"hljs-string\">f&quot;Migrated <span class=\"hljs-subst\">{<span class=\"hljs-built_in\">len</span>(data[<span class=\"hljs-string\">&#x27;memories&#x27;</span>])}</span> memories&quot;</span>)</code></pre><h2>Sauvegarder d&#39;autres données</h2>\n<p>N&#39;oubliez pas de sauvegarder :</p>\n<table>\n<thead>\n<tr>\n<th>Type de données</th>\n<th>Endpoint</th>\n</tr>\n</thead>\n<tbody><tr>\n<td>Mémoires</td>\n<td><code>GET /memory/mind-export</code></td>\n</tr>\n<tr>\n<td>Tâches</td>\n<td><code>GET /mind/tasks</code></td>\n</tr>\n<tr>\n<td>Scripts</td>\n<td><code>GET /scripts</code></td>\n</tr>\n<tr>\n<td>Webhooks</td>\n<td><code>GET /webhooks</code></td>\n</tr>\n<tr>\n<td>Tâches cron</td>\n<td><code>GET /cron</code></td>\n</tr>\n<tr>\n<td>Variables</td>\n<td><code>GET /var</code></td>\n</tr>\n<tr>\n<td>Historique chat</td>\n<td><code>GET /chat/history?limit=10000</code></td>\n</tr>\n</tbody></table>\n<h2>Vérification</h2>\n<p>Après restauration, vérifiez :</p>\n<pre><code class=\"hljs language-bash\"><span class=\"hljs-comment\"># Compter les mémoires</span>\ncurl -s -H <span class=\"hljs-string\">&quot;Authorization: Bearer <span class=\"hljs-variable\">$KEY</span>&quot;</span> \\\n     https://synapse.schaefer.zone/memory/stats | jq .total\n\n<span class=\"hljs-comment\"># Comparer avec la sauvegarde</span>\njq .memory_count backup.json</code></pre><h2>Bonnes pratiques</h2>\n<div class=\"callout callout-ok\"></div><h2>Prochaines étapes</h2>\n<ul>\n<li><a href=\"/docs/api/memory\">API Memory</a></li>\n<li><a href=\"/docs/api/cron\">Cron &amp; Scheduler</a> — pour les sauvegardes automatisées</li>\n</ul>\n","urls":{"html":"/docs/guides/backup-restore","text":"/docs/guides/backup-restore?format=text","json":"/docs/guides/backup-restore?format=json","llm":"/docs/guides/backup-restore?format=llm"},"translations_available":["en","zh","hi","es","fr","ar","pt","ru","ja","de","it","ko","nl","pl","tr","sv","vi","th","id","uk"]}