レッスンプランを作成
API バージョン 2026-10-affable-towhee
post https://api.getlingara.com/v1/lesson-plans
レッスンプランの生成を開始し、進捗をストリーミングします。started はプランが作成され次第その識別子を伝えるため、接続が切れても GET /v1/lesson-plans/{id}/stream で再接続できます。ストリームは result または error で終わります。ライブラリから提供されるプランは result 1つだけで届きます。
スコープ lesson_plans:write
パラメーター
Lingara-Versionheaderstring任意- このリクエストに応答する API バージョン。指定がない場合、アクセストークンはそのクライアントに固定されたバージョンを、トークンのないリクエストは現行バージョンを受け取ります。開発中のバージョンには、ここで指定した場合にのみアクセスできます。不明なバージョンにはコード
api_version_unknownとともに400を返します。GET /v1/versionsでバージョンを一覧できます。
リクエスト本文 application/json
contextstring必須source_langstring必須target_langstring必須levelinteger必須
レスポンス
200 プランの進捗、続いてプラン
ストリームイベント text/event-stream
15 秒ごとに keepalive コメントを送信します。
-
startedPlanStarted -
plan_idstring必須
-
phasePlanPhase -
phasestring必須attemptinteger必須
-
resultPlanResult ストリームを終了 -
planLessonPlan必須idstring必須statusPlanStatus必須titlestring | null任意source_langstring必須target_langstring必須levelinteger必須created_atstring必須completed_atstring | null任意ai_generatedboolean必須contentLessonPlanContent | null任意introductionstring | null任意learning_objectivesarray of string必須vocabularyarray of PlanWord必須wordstring必須pronunciationstring | null任意translationstring必須
setsarray of PlanSet必須numberinteger必須contextstring | null任意questionsarray of PlanQuestion必須typestring必須promptstring必須optionsarray of string | null任意answerstring必須explanationstring必須hintstring | null任意
-
errorStreamError ストリームを終了 -
200 レスポンスの中で届きます。ステータス行はすでに送信済みのため、ストリーム開始後の失敗はこのイベントとして通知されます。
codestring必須messagestring必須plan_idstring | null任意
エラー
402application/json- 従量課金クライアントの呼び出しは、何も消費する前に拒否されました。
spend_cap_reached:クライアントまたはそのアカウントが月間の支出上限に達しています。「連携」ページで上限を引き上げてください。metered_billing_inactive:このアカウントでは従量課金が有効になっていません。「連携」ページで設定するか、支払い方法を更新してください。 410application/json- このリクエストに応答する API バージョンは提供を終了しました。
Lingara-Versionでサポート対象のバージョンを送るか、クライアントを別のバージョンに固定し直してください。 4XXapplication/json- リクエストは拒否されました。
codeが理由を示し、errorがそれを文章で説明します。 503application/json · text/plain- サービスは一時的に利用できません。
Retry-Afterに示された秒数が経過してから再試行してください。メンテナンス中は、本文はエラーエンベロープではなくプレーンテキストになります。 5XXapplication/json- リクエストは拒否されました。
codeが理由を示し、errorがそれを文章で説明します。
codestring必須リクエストが拒否された理由を、分岐に使える安定したコードで示します。例:
insufficient_scope(403)、rate_limited(429)、従量課金クライアントの場合はspend_cap_reached(402)とmetered_billing_inactive(402)。errorstring必須
例
ライブラリを使いたい場合は、ライブラリのセクションをご覧ください。
ストリームの例
event: started
data: {"plan_id":"3f1c2a9e-5b7d-4e21-9a0c-6d8e4f2b1a37"}
event: phase
data: {"phase":"selecting_vocabulary","attempt":1}
event: result
data: {"plan":{"id":"3f1c2a9e-5b7d-4e21-9a0c-6d8e4f2b1a37","status":"complete","title":"At the night market","source_lang":"en","target_lang":"zh","level":2,"created_at":"2026-09-23T10:00:00Z","completed_at":"2026-09-23T10:00:41Z","ai_generated":true,"content":{"introduction":"Order food and ask prices at a night market.","learning_objectives":["Ask how much something costs"],"vocabulary":[{"word":"多少钱","pronunciation":"duōshao qián","translation":"how much"}],"sets":[{"number":1,"questions":[{"type":"multiple_choice_word","prompt":"Which word asks for a price?","options":["多少钱","谢谢"],"answer":"多少钱","explanation":"多少钱 means how much money."}]}]}}}翻訳と英語版リファレンスの内容が異なる場合は、英語版リファレンスが正しいものとします。