เอกสาร API

ทุกอย่างที่คุณต้องการเพื่อผสานรวม Seizn เข้ากับแอปพลิเคชันของคุณ เพิ่มหน่วยความจำถาวรให้กับ AI ของคุณด้วยโค้ดเพียงไม่กี่บรรทัด

เริ่มต้นอย่างรวดเร็ว

รับคีย์ API ของคุณจาก แดชบอร์ด จากนั้นเริ่มส่งคำขอ:

bash
# Add a memory
curl -X POST https://seizn.com/api/memories \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"content": "User prefers dark mode interfaces"}'

# Search memories
curl "https://seizn.com/api/memories?query=user+preferences" \
  -H "Authorization: Bearer YOUR_API_KEY"

การยืนยันตัวตน

คำขอ API ทั้งหมดต้องการคีย์ API ใน x-api-key header

bash
curl -H "Authorization: Bearer szn_your_api_key_here" \
  https://seizn.com/api/memories?query=test

ความปลอดภัย: เก็บรักษาคีย์ API ของคุณเป็นความลับ อย่าเปิดเผยในโค้ดฝั่ง client ใช้ตัวแปรสภาพแวดล้อมหรือ backend proxy

API Endpoints

POST/api/memories

เพิ่มความทรงจำใหม่ลงในที่เก็บของผู้ใช้

Request Body

content-string (required)
memory_type-string - fact, preference, experience, relationship, instruction
tags-string[]
namespace-string (default: "default")
scope-string - user, session, agent
session_id-string
agent_id-string

การตอบกลับ

{
  "success": true,
  "memory": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "content": "User prefers dark mode interfaces",
    "memory_type": "preference",
    "tags": ["ui", "settings"],
    "namespace": "default",
    "created_at": "2026-01-08T10:30:00Z"
  }
}
GET/api/memories

ค้นหาความทรงจำด้วยความคล้ายคลึงทางความหมาย

Query Parameters

query-string (required)
limit-number (default: 10, max: 100)
threshold-number 0-1 (default: 0.7)
namespace-string

การตอบกลับ

{
  "success": true,
  "results": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "content": "User prefers dark mode interfaces",
      "memory_type": "preference",
      "tags": ["ui", "settings"],
      "similarity": 0.89
    }
  ],
  "count": 1
}
DELETE/api/memories

ลบความทรงจำตาม ID

Query Parameters

ids-string (required) - comma-separated

การตอบกลับ

{
  "success": true,
  "deleted": 3
}
POST/api/extract

ดึงและจัดเก็บความทรงจำจากการสนทนาด้วย AI

Request Body

conversation-string (required)
model-string - haiku | sonnet (default: haiku)
auto_store-boolean (default: true)
namespace-string (default: "default")

การตอบกลับ

{
  "message": "Extracted 3 memories, stored 3",
  "extracted": [
    {
      "content": "User is a software developer working with Python",
      "memory_type": "fact",
      "tags": ["profession", "programming"],
      "confidence": 0.95,
      "importance": 7
    }
  ],
  "stored": [...]
}
POST/api/query

รับการตอบกลับจาก AI โดยใช้ความทรงจำที่เกี่ยวข้องเป็นบริบท (RAG)

Request Body

query-string (required)
model-string - haiku | sonnet (default: haiku)
top_k-number (default: 5)
namespace-string
include_memories-boolean (default: true)

การตอบกลับ

{
  "response": "Based on your preferences, I'd recommend using VS Code with a dark theme...",
  "memories_used": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "content": "User prefers dark mode interfaces",
      "similarity": 0.85
    }
  ],
  "model_used": "haiku"
}

ขีดจำกัด

แผนการเรียก API รายเดือนความทรงจำสูงสุดคีย์ API
ฟรี1,0001002
Starter50,0005,0003
Plus500,00050,0005
Pro2,000,000ไม่จำกัด10
องค์กรไม่จำกัดไม่จำกัด100

เมื่อคุณเกินขีดจำกัด API จะส่งคืน 429 Too Many Requests การตอบกลับ

รหัสข้อผิดพลาด

รหัสคำอธิบาย
200สำเร็จ
400Bad Request - ขาดหรือพารามิเตอร์ไม่ถูกต้อง
401Unauthorized - คีย์ API ไม่ถูกต้องหรือขาด
429Too Many Requests - เกินขีดจำกัด
500Internal Server Error - เกิดข้อผิดพลาด

ความปลอดภัยและการกำกับดูแล

ความปลอดภัยข้อมูล

  • การเข้ารหัสขณะเก็บ: ข้อมูลทั้งหมดถูกเข้ารหัสด้วย AES-256
  • การเข้ารหัสขณะส่ง: TLS 1.3 สำหรับการเชื่อมต่อทั้งหมด
  • การแยกผู้เช่า: การแยกข้อมูลอย่างสมบูรณ์ระหว่างบัญชี

การจัดการคีย์ API

  • การหมุนเวียนคีย์: หมุนเวียนคีย์ได้ตลอดเวลาจากแดชบอร์ด
  • การหมดอายุคีย์: คีย์หมดอายุอัตโนมัติหลัง 90 วัน (กำหนดค่าได้)
  • การติดตามการใช้งาน: การตรวจสอบการใช้งานแบบเรียลไทม์ต่อคีย์

การเก็บรักษาและลบข้อมูล

  • ส่งออก: ส่งออกข้อมูลทั้งหมดได้ตลอดเวลาผ่าน API หรือแดชบอร์ด
  • การลบ: การลบถาวรไม่มีการเก็บรักษาหลัง 30 วัน
  • GDPR/CCPA: ปฏิบัติตามสิทธิ์ของเจ้าของข้อมูลอย่างสมบูรณ์

SDKs

Python

bash
pip install seizn
python
from seizn import Seizn

client = Seizn(api_key="your_api_key")

# Add memory
client.add("User prefers dark mode")

# Search
results = client.search("preferences")

# Extract from conversation
client.extract(conversation="...")

JavaScript

bash
npm install seizn
javascript
import { Seizn } from 'seizn';

const client = new Seizn({ apiKey: 'your_api_key' });

// Add memory
await client.add('User prefers dark mode');

// Search
const results = await client.search('preferences');

// Extract from conversation
await client.extract({ conversation: '...' });

MCP Server — Every Editor, One Memory

The Seizn MCP Server (seizn-mcp) bridges your Seizn memories to AI coding assistants via the Model Context Protocol. 40+ tools, MCP Resources, webhooks, OAuth device flow, and multi-editor config sync — all in one package.

bash
# Install globally or use npx
npx seizn-mcp@latest

# Or add to Claude Code settings (~/.claude/settings.json)
{
  "mcpServers": {
    "seizn": {
      "command": "npx",
      "args": ["-y", "seizn-mcp@latest"],
      "env": { "SEIZN_API_KEY": "your-api-key" }
    }
  }
}

Supported Editors

  • > Claude Code — native MCP
  • > Cursor — native MCP
  • > Windsurf — native MCP
  • > Cline — native MCP
  • ~ GitHub Copilot — via config sync
  • ~ Aider — via config sync
  • ~ OpenAI Codex — via config sync

Key Features

  • > 40+ MCP Tools — memories, knowledge graph, profile, webhooks, config sync
  • > MCP Resources — seizn://memories/recent, seizn://profile, seizn://context/{format}
  • > OAuth Device Flow — browser auth, no API key copy
  • > Auto Context — detects project from package.json, pyproject.toml, Cargo.toml
  • > UTF-8 Support — Korean, Japanese, Chinese, Arabic and 100+ languages

Multi-Editor Config Sync

Seizn exports your memories as editor-specific configuration files. Your AI preferences follow you across every tool.

FileAI ToolMethod
CLAUDE.mdClaude CodeMCP + File
AGENTS.mdOpenAI CodexFile Sync
.cursor/rulesCursorMCP + File
.windsurfrulesWindsurfMCP + File
.github/copilot-instructions.mdGitHub CopilotFile Sync
.clinerulesClineMCP + File
CONVENTIONS.mdAiderFile Sync

OAuth Device Flow

No more copying API keys. The MCP server supports RFC 8628 Device Authorization Grant for browser-based authentication.

1

Run auth_login tool

2

Enter code ABCD-1234 in browser

3

Token saved to ~/.seizn/

Zero-copy auth: The device flow generates a human-readable code, opens your browser, and saves credentials automatically. Works with any terminal or SSH session.