{"title":"API de Usuário e Minds","slug":"user","category":"api","summary":"Gerenciamento de conta — registrar, login, criar minds, listar minds, excluir minds. Protegido por JWT.","audience":["human","llm"],"tags":["api","user","account","minds","jwt"],"difficulty":"beginner","updated":"2026-06-27","word_count":316,"read_minutes":2,"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":"pt","translated":true,"requested_lang":"pt","content_markdown":"\n# API de Usuário e Minds\n\nA API de Usuário e Minds cuida do gerenciamento de conta. Esses endpoints usam\nautenticação JWT (não Mind Keys) porque operam em nível de conta, não em nível\nde mind.\n\n## Endpoints de autenticação\n\n### POST /register\n\nCria uma nova conta de usuário.\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\nResposta:\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\nFaz login em uma conta existente.\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\nResposta: mesma de `/register`.\n\n## Endpoints de minds\n\n### POST /minds\n\nCria um novo mind. Retorna a Mind Key — **salve-a imediatamente**, ela é\nexibida apenas uma vez.\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\nResposta:\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> A `mind_key` é exibida apenas uma vez. Se você a perder, não poderá recuperá-\n> -la — será necessário excluir o mind e criar um novo (o que apaga todas as\n> memórias armazenadas).\n\n### GET /minds\n\nLista todos os minds do usuário atual.\n\n```bash\ncurl -H \"Authorization: Bearer YOUR_JWT\" \\\n     https://synapse.schaefer.zone/minds\n```\n\nResposta:\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\nExclui um mind permanentemente.\n\n```bash\ncurl -X DELETE -H \"Authorization: Bearer YOUR_JWT\" \\\n     https://synapse.schaefer.zone/minds/m_xyz789\n```\n\n> [!WARNING]\n> Excluir um mind é **irreversível**. Todas as memórias, tarefas, histórico de\n> chat e scripts desse mind são perdidos permanentemente. Exporte antes via\n> `GET /memory/mind-export` se precisar de backup.\n\n## Padrão multi-mind\n\nA maioria dos usuários se beneficia de múltiplos minds para manter contextos\nisolados:\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\nUse Mind Keys diferentes em sessões LLM diferentes para manter contextos\nisolados.\n\n## Segurança da conta\n\n### Requisitos de senha\n\n- Mínimo de 6 caracteres\n- Sem máximo (use um gerenciador de senhas)\n- Armazenada como hash bcrypt (nunca em texto puro)\n\n### Expiração do JWT\n\nJWTs expiram após **7 dias**. Quando expirar, basta chamar `/login` novamente.\n\n### Segurança da Mind Key\n\nMind Keys nunca expiram. Se uma Mind Key for comprometida:\n\n1. Crie um novo mind via `POST /minds`\n2. Atualize sua configuração de LLM com a nova Mind Key\n3. Exclua o mind comprometido via `DELETE /minds/:id`\n\n## Próximos passos\n\n- [Autenticação](/docs/getting-started/authentication) — guia completo de auth\n- [Mind Key vs JWT](/docs/getting-started/mind-key-vs-jwt) — guia de decisão\n- [API de Compartilhamento](/docs/api/user) — compartilhe minds com outros usuários\n","content_html":"<h1>API de Usuário e Minds</h1>\n<p>A API de Usuário e Minds cuida do gerenciamento de conta. Esses endpoints usam\nautenticação JWT (não Mind Keys) porque operam em nível de conta, não em nível\nde mind.</p>\n<h2>Endpoints de autenticação</h2>\n<h3>POST /register</h3>\n<p>Cria uma nova conta de usuário.</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>Resposta:</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>Faz login em uma conta existente.</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>Resposta: mesma de <code>/register</code>.</p>\n<h2>Endpoints de minds</h2>\n<h3>POST /minds</h3>\n<p>Cria um novo mind. Retorna a Mind Key — <strong>salve-a imediatamente</strong>, ela é\nexibida apenas uma vez.</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>Resposta:</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\">A `mind_key` é exibida apenas uma vez. Se você a perder, não poderá recuperá-\n-la — será necessário excluir o mind e criar um novo (o que apaga todas as\nmemórias armazenadas).</div><h3>GET /minds</h3>\n<p>Lista todos os minds do usuário atual.</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>Resposta:</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>Exclui um mind permanentemente.</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\">Excluir um mind é **irreversível**. Todas as memórias, tarefas, histórico de\nchat e scripts desse mind são perdidos permanentemente. Exporte antes via\n`GET /memory/mind-export` se precisar de backup.</div><h2>Padrão multi-mind</h2>\n<p>A maioria dos usuários se beneficia de múltiplos minds para manter contextos\nisolados:</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>Use Mind Keys diferentes em sessões LLM diferentes para manter contextos\nisolados.</p>\n<h2>Segurança da conta</h2>\n<h3>Requisitos de senha</h3>\n<ul>\n<li>Mínimo de 6 caracteres</li>\n<li>Sem máximo (use um gerenciador de senhas)</li>\n<li>Armazenada como hash bcrypt (nunca em texto puro)</li>\n</ul>\n<h3>Expiração do JWT</h3>\n<p>JWTs expiram após <strong>7 dias</strong>. Quando expirar, basta chamar <code>/login</code> novamente.</p>\n<h3>Segurança da Mind Key</h3>\n<p>Mind Keys nunca expiram. Se uma Mind Key for comprometida:</p>\n<ol>\n<li>Crie um novo mind via <code>POST /minds</code></li>\n<li>Atualize sua configuração de LLM com a nova Mind Key</li>\n<li>Exclua o mind comprometido via <code>DELETE /minds/:id</code></li>\n</ol>\n<h2>Próximos passos</h2>\n<ul>\n<li><a href=\"/docs/getting-started/authentication\">Autenticação</a> — guia completo de auth</li>\n<li><a href=\"/docs/getting-started/mind-key-vs-jwt\">Mind Key vs JWT</a> — guia de decisão</li>\n<li><a href=\"/docs/api/user\">API de Compartilhamento</a> — compartilhe minds com outros usuários</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"]}