{"title":"คำถามที่พบบ่อยเกี่ยวกับ API","slug":"api-faq","category":"faq","summary":"คำถามทั่วไปเกี่ยวกับ Synapse API — auth, rate limit, การจัดการ error, การค้นพบ endpoint","audience":["human","llm"],"tags":["faq","api","troubleshooting"],"difficulty":"beginner","updated":"2026-06-27","word_count":289,"read_minutes":1,"lang":"th","translated":true,"requested_lang":"th","content_markdown":"\n# คำถามที่พบบ่อยเกี่ยวกับ API\n\nคำถามทั่วไปเกี่ยวกับ Synapse API\n\n## ฉันยืนยันตัวตนอย่างไร?\n\nสองวิธี:\n\n1. **Mind Key** (สำหรับ endpoint ข้อมูล): `Authorization: Bearer mk_...`\n2. **JWT** (สำหรับ endpoint บัญชี): `Authorization: Bearer eyJ...`\n\nหรือผ่าน query parameter (จำกัด 60 req/min): `?key=mk_...`\n\nดู [Authentication](/docs/getting-started/authentication)\n\n## ความแตกต่างระหว่าง Mind Key และ JWT คืออะไร?\n\n- **Mind Key**: tenant-scoped, ไม่หมดอายุ, สำหรับข้อมูล memory/chat/tasks\n- **JWT**: user-scoped, หมดอายุ 7 วัน, สำหรับการจัดการบัญชี/mind\n\nดู [Mind Key vs JWT](/docs/getting-started/mind-key-vs-jwt)\n\n## ทำไมฉันได้ 401 Unauthorized?\n\nสาเหตุทั่วไป:\n\n1. ขาด `Authorization` header\n2. Mind Key ไม่ถูกต้อง (ตรวจว่าขึ้นต้นด้วย `mk_`)\n3. ใช้ JWT ในที่ที่ต้องใช้ Mind Key (หรือกลับกัน)\n4. Mind Key ถูกเพิกถอน\n\n**วิธีแก้:** ตรวจสอบ token ของคุณ ดู [Authentication](/docs/getting-started/authentication)\n\n## ทำไมฉันได้ 404 Not Found?\n\nคุณใช้ endpoint path ผิด Synapse มีเพียง path ที่แสดงใน `GET /endpoints`\n\n**วิธีแก้:** เรียก `GET /endpoints` เพื่อดู path ที่ถูกต้องทั้งหมด อย่าเดา\n\n## ทำไมฉันได้ 429 Too Many Requests?\n\nคุณใช้ auth ผ่าน `?key=` query parameter ซึ่งจำกัดที่ 60/min\n\n**วิธีแก้:** เปลี่ยนไปใช้ `Authorization: Bearer` header (ไม่จำกัดอัตรา)\n\nดู [Rate Limits](/docs/api/rate-limits)\n\n## ฉันจะระบุ endpoint ทั้งหมดได้อย่างไร?\n\n```bash\ncurl https://synapse.schaefer.zone/endpoints\ncurl https://synapse.schaefer.zone/endpoints?format=text\n```\n\n## ฉันจะหา endpoint ที่เหมาะสมได้อย่างไร?\n\n1. ตรวจ `GET /endpoints` สำหรับรายการ machine-readable\n2. ตรวจ `GET /help` สำหรับ API docs แบบเต็ม\n3. ดู `GET /docs` สำหรับระบบเอกสาร\n4. ใช้ `GET /openapi.json` สำหรับ OpenAPI 3.0 spec\n\n## ฉันใช้ GET แทน POST ได้ไหม?\n\nPOST endpoint บางตัวมี GET equivalent สำหรับเครื่องมือ URL-only:\n\n- `POST /memory` ↔ `GET /memory/store?content=...`\n- `POST /mind/task` ↔ `GET /mind/task?title=...`\n- `POST /chat/reply` ↔ `GET /chat/reply?content=...`\n\nตรวจ `GET /endpoints` สำหรับ GET variant ที่มี\n\n## ฉันจัดการ error อย่างไร?\n\nerror ทั้งหมดส่งกลับเป็น JSON:\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ดู [Errors & Error Handling](/docs/api/errors)\n\n## ขีดจำกัดขนาด request body คือเท่าไร?\n\n10 MB สำหรับ payload ที่ใหญ่กว่า (เช่น อัปโหลดไฟล์) ให้ใช้ multipart endpoint\n\n## API รองรับ CORS ไหม?\n\nใช่ ทุก endpoint ส่งกลับ:\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\n```\n\n## มี SDK ไหม?\n\nมี:\n\n- **Node.js**: `npm install synapse-memory-sdk`\n- **MCP**: `npx -y synapse-mcp-api@latest`\n\nดูรายละเอียดที่ [API Overview](/docs/api/overview)\n\n## ฉันทำ pagination อย่างไร?\n\nใช้ `?limit=` และ `?offset=`:\n\n```bash\ncurl \".../memory?limit=50&offset=100\"\n```\n\nLimit เริ่มต้น: 100 สูงสุด: 500\n\n## ฉันกรอง memory ตาม category หรือ tag ได้ไหม?\n\nได้:\n\n```bash\ncurl \".../memory?category=project\"\ncurl \".../memory?tag=docker\"\ncurl \".../memory/by-tag?tag=production\"\n```\n\n## ฉันค้นหา memory อย่างไร?\n\nสองวิธี:\n\n1. **FTS5 keyword search**: `GET /memory/search?q=docker+swarm`\n2. **Semantic search**: `GET /memory/semantic-search?q=container+orchestration`\n\nดู [FTS5 Search](/docs/concepts/fts5-search) และ [Semantic Search](/docs/concepts/semantic-search)\n\n## ฉันอัปเดต memory อย่างไร?\n\nPOST `/memory` ด้วย `category` + `key` เดิม — memory ที่มีอยู่จะถูกอัปเดต ไม่ซ้ำ\n\n```bash\n# Initial store\ncurl -X POST .../memory -d '{\"category\":\"fact\",\"key\":\"user_name\",\"content\":\"Michael\"}'\n\n# Update (same key)\ncurl -X POST .../memory -d '{\"category\":\"fact\",\"key\":\"user_name\",\"content\":\"Michael Schäfer\"}'\n```\n\n## ฉันลบ memory อย่างไร?\n\n```bash\ncurl -X DELETE -H \"Authorization: Bearer $KEY\" \\\n     https://synapse.schaefer.zone/memory/mem_001\n```\n\n## ลบเป็นจำนวนมากได้ไหม?\n\nได้:\n\n```bash\ncurl -X POST .../memory/bulk-delete \\\n  -d '{\"ids\": [\"mem_001\", \"mem_002\", \"mem_003\"]}'\n```\n\n## ขั้นตอนถัดไป\n\n- [API Overview](/docs/api/overview)\n- [Errors & Error Handling](/docs/api/errors)\n- [Authentication](/docs/getting-started/authentication)\n","content_html":"<h1>คำถามที่พบบ่อยเกี่ยวกับ API</h1>\n<p>คำถามทั่วไปเกี่ยวกับ Synapse API</p>\n<h2>ฉันยืนยันตัวตนอย่างไร?</h2>\n<p>สองวิธี:</p>\n<ol>\n<li><strong>Mind Key</strong> (สำหรับ endpoint ข้อมูล): <code>Authorization: Bearer mk_...</code></li>\n<li><strong>JWT</strong> (สำหรับ endpoint บัญชี): <code>Authorization: Bearer eyJ...</code></li>\n</ol>\n<p>หรือผ่าน query parameter (จำกัด 60 req/min): <code>?key=mk_...</code></p>\n<p>ดู <a href=\"/docs/getting-started/authentication\">Authentication</a></p>\n<h2>ความแตกต่างระหว่าง Mind Key และ JWT คืออะไร?</h2>\n<ul>\n<li><strong>Mind Key</strong>: tenant-scoped, ไม่หมดอายุ, สำหรับข้อมูล memory/chat/tasks</li>\n<li><strong>JWT</strong>: user-scoped, หมดอายุ 7 วัน, สำหรับการจัดการบัญชี/mind</li>\n</ul>\n<p>ดู <a href=\"/docs/getting-started/mind-key-vs-jwt\">Mind Key vs JWT</a></p>\n<h2>ทำไมฉันได้ 401 Unauthorized?</h2>\n<p>สาเหตุทั่วไป:</p>\n<ol>\n<li>ขาด <code>Authorization</code> header</li>\n<li>Mind Key ไม่ถูกต้อง (ตรวจว่าขึ้นต้นด้วย <code>mk_</code>)</li>\n<li>ใช้ JWT ในที่ที่ต้องใช้ Mind Key (หรือกลับกัน)</li>\n<li>Mind Key ถูกเพิกถอน</li>\n</ol>\n<p><strong>วิธีแก้:</strong> ตรวจสอบ token ของคุณ ดู <a href=\"/docs/getting-started/authentication\">Authentication</a></p>\n<h2>ทำไมฉันได้ 404 Not Found?</h2>\n<p>คุณใช้ endpoint path ผิด Synapse มีเพียง path ที่แสดงใน <code>GET /endpoints</code></p>\n<p><strong>วิธีแก้:</strong> เรียก <code>GET /endpoints</code> เพื่อดู path ที่ถูกต้องทั้งหมด อย่าเดา</p>\n<h2>ทำไมฉันได้ 429 Too Many Requests?</h2>\n<p>คุณใช้ auth ผ่าน <code>?key=</code> query parameter ซึ่งจำกัดที่ 60/min</p>\n<p><strong>วิธีแก้:</strong> เปลี่ยนไปใช้ <code>Authorization: Bearer</code> header (ไม่จำกัดอัตรา)</p>\n<p>ดู <a href=\"/docs/api/rate-limits\">Rate Limits</a></p>\n<h2>ฉันจะระบุ endpoint ทั้งหมดได้อย่างไร?</h2>\n<pre><code class=\"hljs language-bash\">curl https://synapse.schaefer.zone/endpoints\ncurl https://synapse.schaefer.zone/endpoints?format=text</code></pre><h2>ฉันจะหา endpoint ที่เหมาะสมได้อย่างไร?</h2>\n<ol>\n<li>ตรวจ <code>GET /endpoints</code> สำหรับรายการ machine-readable</li>\n<li>ตรวจ <code>GET /help</code> สำหรับ API docs แบบเต็ม</li>\n<li>ดู <code>GET /docs</code> สำหรับระบบเอกสาร</li>\n<li>ใช้ <code>GET /openapi.json</code> สำหรับ OpenAPI 3.0 spec</li>\n</ol>\n<h2>ฉันใช้ GET แทน POST ได้ไหม?</h2>\n<p>POST endpoint บางตัวมี GET equivalent สำหรับเครื่องมือ URL-only:</p>\n<ul>\n<li><code>POST /memory</code> ↔ <code>GET /memory/store?content=...</code></li>\n<li><code>POST /mind/task</code> ↔ <code>GET /mind/task?title=...</code></li>\n<li><code>POST /chat/reply</code> ↔ <code>GET /chat/reply?content=...</code></li>\n</ul>\n<p>ตรวจ <code>GET /endpoints</code> สำหรับ GET variant ที่มี</p>\n<h2>ฉันจัดการ error อย่างไร?</h2>\n<p>error ทั้งหมดส่งกลับเป็น JSON:</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><p>ดู <a href=\"/docs/api/errors\">Errors &amp; Error Handling</a></p>\n<h2>ขีดจำกัดขนาด request body คือเท่าไร?</h2>\n<p>10 MB สำหรับ payload ที่ใหญ่กว่า (เช่น อัปโหลดไฟล์) ให้ใช้ multipart endpoint</p>\n<h2>API รองรับ CORS ไหม?</h2>\n<p>ใช่ ทุก endpoint ส่งกลับ:</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</code></pre><h2>มี SDK ไหม?</h2>\n<p>มี:</p>\n<ul>\n<li><strong>Node.js</strong>: <code>npm install synapse-memory-sdk</code></li>\n<li><strong>MCP</strong>: <code>npx -y synapse-mcp-api@latest</code></li>\n</ul>\n<p>ดูรายละเอียดที่ <a href=\"/docs/api/overview\">API Overview</a></p>\n<h2>ฉันทำ pagination อย่างไร?</h2>\n<p>ใช้ <code>?limit=</code> และ <code>?offset=</code>:</p>\n<pre><code class=\"hljs language-bash\">curl <span class=\"hljs-string\">&quot;.../memory?limit=50&amp;offset=100&quot;</span></code></pre><p>Limit เริ่มต้น: 100 สูงสุด: 500</p>\n<h2>ฉันกรอง memory ตาม category หรือ tag ได้ไหม?</h2>\n<p>ได้:</p>\n<pre><code class=\"hljs language-bash\">curl <span class=\"hljs-string\">&quot;.../memory?category=project&quot;</span>\ncurl <span class=\"hljs-string\">&quot;.../memory?tag=docker&quot;</span>\ncurl <span class=\"hljs-string\">&quot;.../memory/by-tag?tag=production&quot;</span></code></pre><h2>ฉันค้นหา memory อย่างไร?</h2>\n<p>สองวิธี:</p>\n<ol>\n<li><strong>FTS5 keyword search</strong>: <code>GET /memory/search?q=docker+swarm</code></li>\n<li><strong>Semantic search</strong>: <code>GET /memory/semantic-search?q=container+orchestration</code></li>\n</ol>\n<p>ดู <a href=\"/docs/concepts/fts5-search\">FTS5 Search</a> และ <a href=\"/docs/concepts/semantic-search\">Semantic Search</a></p>\n<h2>ฉันอัปเดต memory อย่างไร?</h2>\n<p>POST <code>/memory</code> ด้วย <code>category</code> + <code>key</code> เดิม — memory ที่มีอยู่จะถูกอัปเดต ไม่ซ้ำ</p>\n<pre><code class=\"hljs language-bash\"><span class=\"hljs-comment\"># Initial store</span>\ncurl -X POST .../memory -d <span class=\"hljs-string\">&#x27;{&quot;category&quot;:&quot;fact&quot;,&quot;key&quot;:&quot;user_name&quot;,&quot;content&quot;:&quot;Michael&quot;}&#x27;</span>\n\n<span class=\"hljs-comment\"># Update (same key)</span>\ncurl -X POST .../memory -d <span class=\"hljs-string\">&#x27;{&quot;category&quot;:&quot;fact&quot;,&quot;key&quot;:&quot;user_name&quot;,&quot;content&quot;:&quot;Michael Schäfer&quot;}&#x27;</span></code></pre><h2>ฉันลบ memory อย่างไร?</h2>\n<pre><code class=\"hljs language-bash\">curl -X DELETE -H <span class=\"hljs-string\">&quot;Authorization: Bearer <span class=\"hljs-variable\">$KEY</span>&quot;</span> \\\n     https://synapse.schaefer.zone/memory/mem_001</code></pre><h2>ลบเป็นจำนวนมากได้ไหม?</h2>\n<p>ได้:</p>\n<pre><code class=\"hljs language-bash\">curl -X POST .../memory/bulk-delete \\\n  -d <span class=\"hljs-string\">&#x27;{&quot;ids&quot;: [&quot;mem_001&quot;, &quot;mem_002&quot;, &quot;mem_003&quot;]}&#x27;</span></code></pre><h2>ขั้นตอนถัดไป</h2>\n<ul>\n<li><a href=\"/docs/api/overview\">API Overview</a></li>\n<li><a href=\"/docs/api/errors\">Errors &amp; Error Handling</a></li>\n<li><a href=\"/docs/getting-started/authentication\">Authentication</a></li>\n</ul>\n","urls":{"html":"/docs/faq/api-faq","text":"/docs/faq/api-faq?format=text","json":"/docs/faq/api-faq?format=json","llm":"/docs/faq/api-faq?format=llm"},"translations_available":["en","zh","hi","es","fr","ar","pt","ru","ja","de","it","ko","nl","pl","tr","sv","vi","th","id","uk"]}