{"title":"Tổng quan API & Base URL","slug":"overview","category":"api","summary":"Tất cả endpoint API Synapse, base URL, mẫu xác thực và định dạng phản hồi trong một glance.","audience":["human","llm"],"tags":["api","overview","endpoints"],"difficulty":"beginner","updated":"2026-06-27","word_count":688,"read_minutes":3,"llm_context":"Base URL: https://synapse.schaefer.zone\nAuth: Authorization: Bearer YOUR_MIND_KEY (header, no rate limit)\n      OR ?key=YOUR_MIND_KEY (query, 60 req/min)\nAll responses are JSON except /memory/recall (text/plain) and /docs (HTML/text/json)\nAll 404 responses mean the path does not exist — do NOT guess paths.\nGET /endpoints returns machine-readable list of all valid endpoints.\n","lang":"vi","translated":true,"requested_lang":"vi","content_markdown":"\n# Tổng quan API & Base URL\n\nSynapse API là HTTP API RESTful. Tất cả endpoint trả về JSON (trừ khi có ghi\nchú). Trang này bao gồm những điều thiết yếu bạn cần biết trước khi đi sâu vào\ncác endpoint cụ thể.\n\n## Base URL\n\n```\nhttps://synapse.schaefer.zone\n```\n\nTất cả đường dẫn trong tài liệu này đều tương đối với base URL này. Đối với\ncác thể hiện self-hosted, thay bằng URL của bạn.\n\n## Xác thực\n\nHai phương thức, cả hai đều gửi qua header `Authorization`:\n\n```\nAuthorization: Bearer YOUR_MIND_KEY    # for data endpoints\nAuthorization: Bearer YOUR_JWT          # for account endpoints\n```\n\nHoặc qua tham số query (giới hạn 60/phút):\n\n```\n?key=YOUR_MIND_KEY\n```\n\nXem [Xác thực](/docs/getting-started/authentication) để biết chi tiết.\n\n## Nhóm endpoint\n\n| Nhóm | Xác thực | Mô tả |\n|-------|------|-------------|\n| Public | Không | Trang chủ, health, OpenAPI, docs |\n| Memory | Mind Key | CRUD, tìm kiếm, đồng bộ, embeddings |\n| Chat | Mind Key / JWT | Nhắn tin bất đồng bộ giữa con người và agent |\n| Tasks | Mind Key | Quản lý tác vụ |\n| Scripts | Mind Key / JWT | Lưu trữ script cố định |\n| Scheduler | Mind Key | Cron job + biến |\n| Webhooks | Mind Key | HTTP callback khi có sự kiện |\n| Computers | Mind Key / JWT | Điều khiển máy tính từ xa |\n| User/Minds | JWT | Tài khoản + quản lý mind |\n| Sharing | JWT | Chia sẻ mind giữa người dùng |\n| Push | JWT | Đăng ký Web Push |\n| Tools | Không | Thời gian, calc, random (tiện ích công khai) |\n\n## Định dạng phản hồi\n\n- **JSON** (mặc định): `{ \"key\": \"value\", ... }`\n- **Văn bản thuần**: `/memory/recall` trả về văn bản tối ưu cho LLM\n- **HTML**: `/`, `/docs`, `/human`, `/support`, `/playground`\n\n## Envelope phản hồi chuẩn\n\nPhản hồi thành công trả về dữ liệu trực tiếp:\n\n```json\n{ \"id\": \"mem_001\", \"status\": \"stored\" }\n```\n\nPhản hồi lỗi sử dụng định dạng này:\n\n```json\n{\n  \"statusCode\": 401,\n  \"error\": \"Unauthorized\",\n  \"message\": \"Mind Key fehlt oder ungültig.\",\n  \"docs\": \"https://synapse.schaefer.zone/docs/getting-started/authentication\"\n}\n```\n\n> [!NOTE]\n> Trường `docs` liên kết tới tài liệu liên quan cho các lỗi phổ biến.\n\n## Mã trạng thái HTTP\n\n| Mã | Ý nghĩa |\n|------|---------|\n| 200 | Thành công (GET, PUT) |\n| 201 | Đã tạo (POST) |\n| 204 | Không có nội dung (DELETE) |\n| 400 | Yêu cầu sai (lỗi validation) |\n| 401 | Không được ủy quyền (thiếu/sai token) |\n| 403 | Bị cấm (sai loại token) |\n| 404 | Không tìm thấy (đường dẫn không tồn tại) |\n| 409 | Xung đột (trùng lặp) |\n| 429 | Quá nhiều yêu cầu (giới hạn tốc độ) |\n| 500 | Lỗi server |\n\n## Endpoint khám phá\n\n| Endpoint | Mục đích |\n|----------|---------|\n| `GET /` | Trang chủ (tối ưu cho LLM) |\n| `GET /endpoints` | Danh sách đọc được bằng máy của tất cả endpoint |\n| `GET /endpoints?format=text` | Danh sách endpoint dạng văn bản thuần |\n| `GET /openapi.json` | Đặc tả OpenAPI 3.0 |\n| `GET /help` | Tài liệu API đầy đủ (HTML) |\n| `GET /help?format=json` | Tài liệu API dạng JSON |\n| `GET /docs` | Hệ thống tài liệu (HTML) |\n| `GET /docs?format=json` | Mục lục tài liệu (JSON) |\n| `GET /docs?format=text&scope=all` | Tất cả tài liệu trong một khối văn bản |\n| `GET /playground` | Playground API tương tác |\n\n## Giới hạn tốc độ\n\n| Phương thức xác thực | Giới hạn |\n|-------------|-------|\n| Mind Key (header) | Không |\n| Mind Key (?key=) | 60/phút mỗi IP |\n| JWT (header) | Không |\n| Endpoint công khai | Không |\n\nPhản hồi bị giới hạn tốc độ bao gồm:\n\n```\nX-RateLimit-Limit: 60\nX-RateLimit-Remaining: 42\nRetry-After: 30  (only when 429)\n```\n\n## Phân trang\n\nEndpoint dạng danh sách hỗ trợ `?limit=` và `?offset=`:\n\n```\nGET /memory?limit=50&offset=100\nGET /mind/tasks?status=pending\n```\n\nGiới hạn mặc định: 100. Giới hạn tối đa: 500.\n\n## CORS\n\nTất cả endpoint hỗ trợ CORS cho client dựa trên trình duyệt:\n\n```\nAccess-Control-Allow-Origin: *\nAccess-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS\nAccess-Control-Allow-Headers: Authorization, Content-Type, X-Synapse-JWT, Mcp-Session-Id, Mcp-Tool-Profile\n```\n\n## SDK & Client\n\n- **Node.js SDK**: `npm install synapse-memory-sdk` ([repo](https://gitlab.com/schaefer-services/synapse-sdk-js))\n- **MCP Server**: `npx -y synapse-mcp-api@latest` ([repo](https://gitlab.com/schaefer-services/synapse-mcp))\n- **HTTP client**: bất kỳ thư viện HTTP nào (curl, fetch, axios, v.v.)\n\n## Bước tiếp theo\n\n- [Memory API](/docs/api/memory) — các endpoint quan trọng nhất\n- [Chat API](/docs/api/chat) — giao tiếp bất đồng bộ giữa con người và agent\n- [Lỗi & Xử lý lỗi](/docs/api/errors)\n","content_html":"<h1>Tổng quan API &amp; Base URL</h1>\n<p>Synapse API là HTTP API RESTful. Tất cả endpoint trả về JSON (trừ khi có ghi\nchú). Trang này bao gồm những điều thiết yếu bạn cần biết trước khi đi sâu vào\ncác endpoint cụ thể.</p>\n<h2>Base URL</h2>\n<pre><code class=\"hljs language-plaintext\">https://synapse.schaefer.zone</code></pre><p>Tất cả đường dẫn trong tài liệu này đều tương đối với base URL này. Đối với\ncác thể hiện self-hosted, thay bằng URL của bạn.</p>\n<h2>Xác thực</h2>\n<p>Hai phương thức, cả hai đều gửi qua header <code>Authorization</code>:</p>\n<pre><code class=\"hljs language-plaintext\">Authorization: Bearer YOUR_MIND_KEY    # for data endpoints\nAuthorization: Bearer YOUR_JWT          # for account endpoints</code></pre><p>Hoặc qua tham số query (giới hạn 60/phút):</p>\n<pre><code class=\"hljs language-plaintext\">?key=YOUR_MIND_KEY</code></pre><p>Xem <a href=\"/docs/getting-started/authentication\">Xác thực</a> để biết chi tiết.</p>\n<h2>Nhóm endpoint</h2>\n<table>\n<thead>\n<tr>\n<th>Nhóm</th>\n<th>Xác thực</th>\n<th>Mô tả</th>\n</tr>\n</thead>\n<tbody><tr>\n<td>Public</td>\n<td>Không</td>\n<td>Trang chủ, health, OpenAPI, docs</td>\n</tr>\n<tr>\n<td>Memory</td>\n<td>Mind Key</td>\n<td>CRUD, tìm kiếm, đồng bộ, embeddings</td>\n</tr>\n<tr>\n<td>Chat</td>\n<td>Mind Key / JWT</td>\n<td>Nhắn tin bất đồng bộ giữa con người và agent</td>\n</tr>\n<tr>\n<td>Tasks</td>\n<td>Mind Key</td>\n<td>Quản lý tác vụ</td>\n</tr>\n<tr>\n<td>Scripts</td>\n<td>Mind Key / JWT</td>\n<td>Lưu trữ script cố định</td>\n</tr>\n<tr>\n<td>Scheduler</td>\n<td>Mind Key</td>\n<td>Cron job + biến</td>\n</tr>\n<tr>\n<td>Webhooks</td>\n<td>Mind Key</td>\n<td>HTTP callback khi có sự kiện</td>\n</tr>\n<tr>\n<td>Computers</td>\n<td>Mind Key / JWT</td>\n<td>Điều khiển máy tính từ xa</td>\n</tr>\n<tr>\n<td>User/Minds</td>\n<td>JWT</td>\n<td>Tài khoản + quản lý mind</td>\n</tr>\n<tr>\n<td>Sharing</td>\n<td>JWT</td>\n<td>Chia sẻ mind giữa người dùng</td>\n</tr>\n<tr>\n<td>Push</td>\n<td>JWT</td>\n<td>Đăng ký Web Push</td>\n</tr>\n<tr>\n<td>Tools</td>\n<td>Không</td>\n<td>Thời gian, calc, random (tiện ích công khai)</td>\n</tr>\n</tbody></table>\n<h2>Định dạng phản hồi</h2>\n<ul>\n<li><strong>JSON</strong> (mặc định): <code>{ &quot;key&quot;: &quot;value&quot;, ... }</code></li>\n<li><strong>Văn bản thuần</strong>: <code>/memory/recall</code> trả về văn bản tối ưu cho LLM</li>\n<li><strong>HTML</strong>: <code>/</code>, <code>/docs</code>, <code>/human</code>, <code>/support</code>, <code>/playground</code></li>\n</ul>\n<h2>Envelope phản hồi chuẩn</h2>\n<p>Phản hồi thành công trả về dữ liệu trực tiếp:</p>\n<pre><code class=\"hljs language-json\"><span class=\"hljs-punctuation\">{</span> <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> <span class=\"hljs-attr\">&quot;status&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;stored&quot;</span> <span class=\"hljs-punctuation\">}</span></code></pre><p>Phản hồi lỗi sử dụng định dạng này:</p>\n<pre><code class=\"hljs language-json\"><span class=\"hljs-punctuation\">{</span>\n  <span class=\"hljs-attr\">&quot;statusCode&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-number\">401</span><span class=\"hljs-punctuation\">,</span>\n  <span class=\"hljs-attr\">&quot;error&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;Unauthorized&quot;</span><span class=\"hljs-punctuation\">,</span>\n  <span class=\"hljs-attr\">&quot;message&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;Mind Key fehlt oder ungültig.&quot;</span><span class=\"hljs-punctuation\">,</span>\n  <span class=\"hljs-attr\">&quot;docs&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;https://synapse.schaefer.zone/docs/getting-started/authentication&quot;</span>\n<span class=\"hljs-punctuation\">}</span></code></pre><div class=\"callout callout-note\">Trường `docs` liên kết tới tài liệu liên quan cho các lỗi phổ biến.</div><h2>Mã trạng thái HTTP</h2>\n<table>\n<thead>\n<tr>\n<th>Mã</th>\n<th>Ý nghĩa</th>\n</tr>\n</thead>\n<tbody><tr>\n<td>200</td>\n<td>Thành công (GET, PUT)</td>\n</tr>\n<tr>\n<td>201</td>\n<td>Đã tạo (POST)</td>\n</tr>\n<tr>\n<td>204</td>\n<td>Không có nội dung (DELETE)</td>\n</tr>\n<tr>\n<td>400</td>\n<td>Yêu cầu sai (lỗi validation)</td>\n</tr>\n<tr>\n<td>401</td>\n<td>Không được ủy quyền (thiếu/sai token)</td>\n</tr>\n<tr>\n<td>403</td>\n<td>Bị cấm (sai loại token)</td>\n</tr>\n<tr>\n<td>404</td>\n<td>Không tìm thấy (đường dẫn không tồn tại)</td>\n</tr>\n<tr>\n<td>409</td>\n<td>Xung đột (trùng lặp)</td>\n</tr>\n<tr>\n<td>429</td>\n<td>Quá nhiều yêu cầu (giới hạn tốc độ)</td>\n</tr>\n<tr>\n<td>500</td>\n<td>Lỗi server</td>\n</tr>\n</tbody></table>\n<h2>Endpoint khám phá</h2>\n<table>\n<thead>\n<tr>\n<th>Endpoint</th>\n<th>Mục đích</th>\n</tr>\n</thead>\n<tbody><tr>\n<td><code>GET /</code></td>\n<td>Trang chủ (tối ưu cho LLM)</td>\n</tr>\n<tr>\n<td><code>GET /endpoints</code></td>\n<td>Danh sách đọc được bằng máy của tất cả endpoint</td>\n</tr>\n<tr>\n<td><code>GET /endpoints?format=text</code></td>\n<td>Danh sách endpoint dạng văn bản thuần</td>\n</tr>\n<tr>\n<td><code>GET /openapi.json</code></td>\n<td>Đặc tả OpenAPI 3.0</td>\n</tr>\n<tr>\n<td><code>GET /help</code></td>\n<td>Tài liệu API đầy đủ (HTML)</td>\n</tr>\n<tr>\n<td><code>GET /help?format=json</code></td>\n<td>Tài liệu API dạng JSON</td>\n</tr>\n<tr>\n<td><code>GET /docs</code></td>\n<td>Hệ thống tài liệu (HTML)</td>\n</tr>\n<tr>\n<td><code>GET /docs?format=json</code></td>\n<td>Mục lục tài liệu (JSON)</td>\n</tr>\n<tr>\n<td><code>GET /docs?format=text&amp;scope=all</code></td>\n<td>Tất cả tài liệu trong một khối văn bản</td>\n</tr>\n<tr>\n<td><code>GET /playground</code></td>\n<td>Playground API tương tác</td>\n</tr>\n</tbody></table>\n<h2>Giới hạn tốc độ</h2>\n<table>\n<thead>\n<tr>\n<th>Phương thức xác thực</th>\n<th>Giới hạn</th>\n</tr>\n</thead>\n<tbody><tr>\n<td>Mind Key (header)</td>\n<td>Không</td>\n</tr>\n<tr>\n<td>Mind Key (?key=)</td>\n<td>60/phút mỗi IP</td>\n</tr>\n<tr>\n<td>JWT (header)</td>\n<td>Không</td>\n</tr>\n<tr>\n<td>Endpoint công khai</td>\n<td>Không</td>\n</tr>\n</tbody></table>\n<p>Phản hồi bị giới hạn tốc độ bao gồm:</p>\n<pre><code class=\"hljs language-plaintext\">X-RateLimit-Limit: 60\nX-RateLimit-Remaining: 42\nRetry-After: 30  (only when 429)</code></pre><h2>Phân trang</h2>\n<p>Endpoint dạng danh sách hỗ trợ <code>?limit=</code> và <code>?offset=</code>:</p>\n<pre><code class=\"hljs language-plaintext\">GET /memory?limit=50&amp;offset=100\nGET /mind/tasks?status=pending</code></pre><p>Giới hạn mặc định: 100. Giới hạn tối đa: 500.</p>\n<h2>CORS</h2>\n<p>Tất cả endpoint hỗ trợ CORS cho client dựa trên trình duyệt:</p>\n<pre><code class=\"hljs language-plaintext\">Access-Control-Allow-Origin: *\nAccess-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS\nAccess-Control-Allow-Headers: Authorization, Content-Type, X-Synapse-JWT, Mcp-Session-Id, Mcp-Tool-Profile</code></pre><h2>SDK &amp; Client</h2>\n<ul>\n<li><strong>Node.js SDK</strong>: <code>npm install synapse-memory-sdk</code> (<a href=\"https://gitlab.com/schaefer-services/synapse-sdk-js\">repo</a>)</li>\n<li><strong>MCP Server</strong>: <code>npx -y synapse-mcp-api@latest</code> (<a href=\"https://gitlab.com/schaefer-services/synapse-mcp\">repo</a>)</li>\n<li><strong>HTTP client</strong>: bất kỳ thư viện HTTP nào (curl, fetch, axios, v.v.)</li>\n</ul>\n<h2>Bước tiếp theo</h2>\n<ul>\n<li><a href=\"/docs/api/memory\">Memory API</a> — các endpoint quan trọng nhất</li>\n<li><a href=\"/docs/api/chat\">Chat API</a> — giao tiếp bất đồng bộ giữa con người và agent</li>\n<li><a href=\"/docs/api/errors\">Lỗi &amp; Xử lý lỗi</a></li>\n</ul>\n","urls":{"html":"/docs/api/overview","text":"/docs/api/overview?format=text","json":"/docs/api/overview?format=json","llm":"/docs/api/overview?format=llm"},"translations_available":["en","zh","hi","es","fr","ar","pt","ru","ja","de","it","ko","nl","pl","tr","sv","vi","th","id","uk"]}