API Documentation

SimpleLits API

Authentication

All API endpoints accept an optional Authorization: Bearer sl_live_... header. Without a key, requests use the free tier (30 req/day).

curl -X POST https://simplelits.com/api/simplify \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sl_live_abc123..." \
  -d '{"text": "お釈迦様は蓮池の縁に...", "context": "蜘蛛の糸"}'

POST /api/simplify

Simplify classical Japanese into 4 formats.

Request

{
  "text": "Japanese passage (required)",
  "context": "Book title (optional)"
}

Response

{
  "ok": true,
  "result": {
    "simplifiedJapanese": "...",
    "englishTranslation": "...",
    "westernizedRetelling": "...",
    "funSummary": "..."
  }
}

POST /api/explain

Get AI grammar breakdown of a word or sentence.

{
  "text": "踏み殺そうと致しました",
  "context": "蜘蛛の糸"
}
// → literalTranslation, naturalTranslation, grammarNotes[], vocabulary[], coachNote

POST /api/translate

Translate into 4 languages with 3 style options.

{
  "text": "Japanese passage",
  "targetLanguage": "english | chinese | korean | french",
  "style": "literary | plain | educational"
}
// → translation, notes

POST /api/snapshot

Generate TikTok-style character mapping + plot shots.

{
  "text": "First 2500 chars of a chapter"
}
// → characterMap: [{original, mapped, role}], shots: ["Jack meets...", ...]

GET /api/dictionary

Search the EDICT2 dictionary (215K+ words, offline, no AI needed).

GET /api/dictionary?q=蜘蛛
// → entries: [{term, reading, glosses, common, tags}]

Rate Limits

All AI endpoints return rate limit headers:

X-RateLimit-Limit: 500
X-RateLimit-Remaining: 499
X-SimpleLits-Plan: reader
PlanDaily limitPrice
Free30$0
Reader500$4.99/mo
ScholarUnlimited$9.99/mo
API10,000$19.99/mo

Error Handling

// 429 Too Many Requests
{
  "error": "Rate limit exceeded",
  "limit": 30,
  "remaining": 0,
  "plan": "free",
  "upgrade": "https://simplelits.com/pricing"
}

// 401 Unauthorized
{ "error": "Invalid API key" }