{"title":"User & Minds API","slug":"user","category":"api","summary":"アカウント管理 — 登録、ログイン、mind の作成・一覧・削除。JWT で保護。","audience":["human","llm"],"tags":["api","user","account","minds","jwt"],"difficulty":"beginner","updated":"2026-06-27","word_count":148,"read_minutes":1,"llm_context":"Auth: JWT (from /register or /login)\nRegister: POST /register { email, password, display_name? } → returns JWT\nLogin: POST /login { email, password } → returns JWT\nCreate mind: POST /minds { name, description? } → returns mind_key (shown once!)\nList minds: GET /minds\nDelete mind: DELETE /minds/:id (irreversible — deletes all memories!)\nJWT expires after 7 days. Mind Key never expires.\nMind Key is shown only once at creation — save it permanently.\n","lang":"ja","translated":true,"requested_lang":"ja","content_markdown":"\n# User & Minds API\n\nUser & Minds API はアカウント管理を扱います。これらのエンドポイントはアカウントレベル（mind レベルではなく）で動作するため、Mind Key ではなく JWT 認証を使用します。\n\n## 認証エンドポイント\n\n### POST /register\n\n新規ユーザーアカウントを作成します。\n\n```bash\ncurl -X POST https://synapse.schaefer.zone/register \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"email\": \"you@example.com\",\n    \"password\": \"your-secure-password\",\n    \"display_name\": \"Michael\"\n  }'\n```\n\nレスポンス：\n\n```json\n{\n  \"jwt\": \"eyJhbGci...\",\n  \"user\": {\n    \"id\": \"u_abc123\",\n    \"email\": \"you@example.com\",\n    \"display_name\": \"Michael\",\n    \"created_at\": \"2026-06-27T...\"\n  }\n}\n```\n\n### POST /login\n\n既存アカウントにログインします。\n\n```bash\ncurl -X POST https://synapse.schaefer.zone/login \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"email\": \"you@example.com\",\n    \"password\": \"your-secure-password\"\n  }'\n```\n\nレスポンス：`/register` と同じ。\n\n## Minds エンドポイント\n\n### POST /minds\n\n新しい mind を作成します。Mind Key を返します — **すぐに保存してください**。一度しか表示されません。\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 '{\n    \"name\": \"Work Mind\",\n    \"description\": \"Job-related memories\"\n  }'\n```\n\nレスポンス：\n\n```json\n{\n  \"id\": \"m_xyz789\",\n  \"name\": \"Work Mind\",\n  \"description\": \"Job-related memories\",\n  \"mind_key\": \"mk_aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789\",\n  \"created_at\": \"2026-06-27T...\"\n}\n```\n\n> [!CRITICAL]\n> `mind_key` は一度しか表示されません。紛失した場合は再取得できず、mind を削除して新規作成する必要があります（保存された全メモリが失われます）。\n\n### GET /minds\n\n現在のユーザーの全 mind を一覧表示します。\n\n```bash\ncurl -H \"Authorization: Bearer YOUR_JWT\" \\\n     https://synapse.schaefer.zone/minds\n```\n\nレスポンス：\n\n```json\n{\n  \"minds\": [\n    {\n      \"id\": \"m_xyz789\",\n      \"name\": \"Work Mind\",\n      \"description\": \"Job-related memories\",\n      \"created_at\": \"2026-06-27T...\",\n      \"memory_count\": 142,\n      \"last_activity\": \"2026-06-27T...\"\n    }\n  ]\n}\n```\n\n### DELETE /minds/:id\n\nmind を完全に削除します。\n\n```bash\ncurl -X DELETE -H \"Authorization: Bearer YOUR_JWT\" \\\n     https://synapse.schaefer.zone/minds/m_xyz789\n```\n\n> [!WARNING]\n> mind の削除は**取り消せません**。その mind 内の全メモリ、タスク、チャット履歴、スクリプトが完全に失われます。バックアップが必要な場合は、事前に `GET /memory/mind-export` でエクスポートしてください。\n\n## マルチ mind パターン\n\nほとんどのユーザーは、コンテキストを分離するために複数の mind を作成すると便利です。\n\n```bash\n# Create minds for different contexts\ncurl -X POST .../minds -d '{\"name\": \"work\", \"description\": \"Job\"}'\n# → mind_key: mk_work...\n\ncurl -X POST .../minds -d '{\"name\": \"personal\", \"description\": \"Personal life\"}'\n# → mind_key: mk_personal...\n\ncurl -X POST .../minds -d '{\"name\": \"project-synapse\", \"description\": \"Synapse dev\"}'\n# → mind_key: mk_synapse...\n```\n\n異なる LLM セッションで異なる Mind Key を使用することで、コンテキストを分離できます。\n\n## アカウントセキュリティ\n\n### パスワード要件\n\n- 最低 6 文字\n- 上限なし（パスワードマネージャーの使用を推奨）\n- bcrypt ハッシュで保存（プレーンテキストにはなりません）\n\n### JWT の有効期限\n\nJWT は **7 日後**に期限切れになります。期限切れの場合は、再度 `/login` を呼び出してください。\n\n### Mind Key のセキュリティ\n\nMind Key は期限切れになりません。Mind Key が侵害された場合：\n\n1. `POST /minds` で新しい mind を作成\n2. LLM 設定を新しい Mind Key で更新\n3. `DELETE /minds/:id` で侵害された mind を削除\n\n## 次のステップ\n\n- [Authentication](/docs/getting-started/authentication) — 完全な認証ガイド\n- [Mind Key vs JWT](/docs/getting-started/mind-key-vs-jwt) — 判断ガイド\n- [Sharing API](/docs/api/user) — 他のユーザーとの mind 共有\n","content_html":"<h1>User &amp; Minds API</h1>\n<p>User &amp; Minds API はアカウント管理を扱います。これらのエンドポイントはアカウントレベル（mind レベルではなく）で動作するため、Mind Key ではなく JWT 認証を使用します。</p>\n<h2>認証エンドポイント</h2>\n<h3>POST /register</h3>\n<p>新規ユーザーアカウントを作成します。</p>\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;{\n    &quot;email&quot;: &quot;you@example.com&quot;,\n    &quot;password&quot;: &quot;your-secure-password&quot;,\n    &quot;display_name&quot;: &quot;Michael&quot;\n  }&#x27;</span></code></pre><p>レスポンス：</p>\n<pre><code class=\"hljs language-json\"><span class=\"hljs-punctuation\">{</span>\n  <span class=\"hljs-attr\">&quot;jwt&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;eyJhbGci...&quot;</span><span class=\"hljs-punctuation\">,</span>\n  <span class=\"hljs-attr\">&quot;user&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">{</span>\n    <span class=\"hljs-attr\">&quot;id&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;u_abc123&quot;</span><span class=\"hljs-punctuation\">,</span>\n    <span class=\"hljs-attr\">&quot;email&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;you@example.com&quot;</span><span class=\"hljs-punctuation\">,</span>\n    <span class=\"hljs-attr\">&quot;display_name&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;Michael&quot;</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-27T...&quot;</span>\n  <span class=\"hljs-punctuation\">}</span>\n<span class=\"hljs-punctuation\">}</span></code></pre><h3>POST /login</h3>\n<p>既存アカウントにログインします。</p>\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;{\n    &quot;email&quot;: &quot;you@example.com&quot;,\n    &quot;password&quot;: &quot;your-secure-password&quot;\n  }&#x27;</span></code></pre><p>レスポンス：<code>/register</code> と同じ。</p>\n<h2>Minds エンドポイント</h2>\n<h3>POST /minds</h3>\n<p>新しい mind を作成します。Mind Key を返します — <strong>すぐに保存してください</strong>。一度しか表示されません。</p>\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;{\n    &quot;name&quot;: &quot;Work Mind&quot;,\n    &quot;description&quot;: &quot;Job-related memories&quot;\n  }&#x27;</span></code></pre><p>レスポンス：</p>\n<pre><code class=\"hljs language-json\"><span class=\"hljs-punctuation\">{</span>\n  <span class=\"hljs-attr\">&quot;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;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;description&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;Job-related memories&quot;</span><span class=\"hljs-punctuation\">,</span>\n  <span class=\"hljs-attr\">&quot;mind_key&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;mk_aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789&quot;</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-27T...&quot;</span>\n<span class=\"hljs-punctuation\">}</span></code></pre><div class=\"callout callout-critical\">`mind_key` は一度しか表示されません。紛失した場合は再取得できず、mind を削除して新規作成する必要があります（保存された全メモリが失われます）。</div><h3>GET /minds</h3>\n<p>現在のユーザーの全 mind を一覧表示します。</p>\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><p>レスポンス：</p>\n<pre><code class=\"hljs language-json\"><span class=\"hljs-punctuation\">{</span>\n  <span class=\"hljs-attr\">&quot;minds&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;m_xyz789&quot;</span><span class=\"hljs-punctuation\">,</span>\n      <span class=\"hljs-attr\">&quot;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;description&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;Job-related memories&quot;</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-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;last_activity&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>DELETE /minds/:id</h3>\n<p>mind を完全に削除します。</p>\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><div class=\"callout callout-warn\">mind の削除は**取り消せません**。その mind 内の全メモリ、タスク、チャット履歴、スクリプトが完全に失われます。バックアップが必要な場合は、事前に `GET /memory/mind-export` でエクスポートしてください。</div><h2>マルチ mind パターン</h2>\n<p>ほとんどのユーザーは、コンテキストを分離するために複数の mind を作成すると便利です。</p>\n<pre><code class=\"hljs language-bash\"><span class=\"hljs-comment\"># Create minds for different contexts</span>\ncurl -X POST .../minds -d <span class=\"hljs-string\">&#x27;{&quot;name&quot;: &quot;work&quot;, &quot;description&quot;: &quot;Job&quot;}&#x27;</span>\n<span class=\"hljs-comment\"># → mind_key: mk_work...</span>\n\ncurl -X POST .../minds -d <span class=\"hljs-string\">&#x27;{&quot;name&quot;: &quot;personal&quot;, &quot;description&quot;: &quot;Personal life&quot;}&#x27;</span>\n<span class=\"hljs-comment\"># → mind_key: mk_personal...</span>\n\ncurl -X POST .../minds -d <span class=\"hljs-string\">&#x27;{&quot;name&quot;: &quot;project-synapse&quot;, &quot;description&quot;: &quot;Synapse dev&quot;}&#x27;</span>\n<span class=\"hljs-comment\"># → mind_key: mk_synapse...</span></code></pre><p>異なる LLM セッションで異なる Mind Key を使用することで、コンテキストを分離できます。</p>\n<h2>アカウントセキュリティ</h2>\n<h3>パスワード要件</h3>\n<ul>\n<li>最低 6 文字</li>\n<li>上限なし（パスワードマネージャーの使用を推奨）</li>\n<li>bcrypt ハッシュで保存（プレーンテキストにはなりません）</li>\n</ul>\n<h3>JWT の有効期限</h3>\n<p>JWT は <strong>7 日後</strong>に期限切れになります。期限切れの場合は、再度 <code>/login</code> を呼び出してください。</p>\n<h3>Mind Key のセキュリティ</h3>\n<p>Mind Key は期限切れになりません。Mind Key が侵害された場合：</p>\n<ol>\n<li><code>POST /minds</code> で新しい mind を作成</li>\n<li>LLM 設定を新しい Mind Key で更新</li>\n<li><code>DELETE /minds/:id</code> で侵害された mind を削除</li>\n</ol>\n<h2>次のステップ</h2>\n<ul>\n<li><a href=\"/docs/getting-started/authentication\">Authentication</a> — 完全な認証ガイド</li>\n<li><a href=\"/docs/getting-started/mind-key-vs-jwt\">Mind Key vs JWT</a> — 判断ガイド</li>\n<li><a href=\"/docs/api/user\">Sharing API</a> — 他のユーザーとの mind 共有</li>\n</ul>\n","urls":{"html":"/docs/api/user","text":"/docs/api/user?format=text","json":"/docs/api/user?format=json","llm":"/docs/api/user?format=llm"},"translations_available":["en","zh","hi","es","fr","ar","pt","ru","ja","de","it","ko","nl","pl","tr","sv","vi","th","id","uk"]}