{"openapi":"3.0.3","info":{"title":"Adaptive Learning V2 Plan Authoring API","version":"1.0.0","description":"API surface for adaptive_learning_v2 plan authoring and plan lifecycle operations."},"servers":[{"url":"http://localhost:8601","description":"Host app"},{"url":"http://localhost:8602","description":"Standalone v2 app"}],"tags":[{"name":"Plan V2","description":"Adaptive learning v2 plan authoring endpoints"}],"paths":{"/v2/health":{"get":{"tags":["Plan V2"],"summary":"Health check","operationId":"healthCheckV2","responses":{"200":{"description":"Service is healthy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}}}}},"/v2/plan/create":{"post":{"tags":["Plan V2"],"summary":"Create AI-authored learning plan","description":"Authors a new plan using the v2 LangGraph workflow.","operationId":"createPlanV2","parameters":[{"$ref":"#/components/parameters/WidHeader"},{"$ref":"#/components/parameters/RootOrgHeader"},{"$ref":"#/components/parameters/OrgHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanCreateRequest"}}}},"responses":{"201":{"description":"Plan authored and persisted successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanCreateResponse"}}}},"400":{"description":"Missing request body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Invalid request payload or authored plan failed validation","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/PlanCreateResponse"},{"$ref":"#/components/schemas/PydanticValidationErrorResponse"}]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/plan/{plan_id}":{"get":{"tags":["Plan V2"],"summary":"Get plan by id","operationId":"getPlanV2","parameters":[{"$ref":"#/components/parameters/PlanIdPath"},{"$ref":"#/components/parameters/WidHeader"},{"$ref":"#/components/parameters/RootOrgHeader"},{"$ref":"#/components/parameters/OrgHeader"}],"responses":{"200":{"description":"Plan found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanGetResponse"}}}},"404":{"description":"Plan not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/plans":{"get":{"tags":["Plan V2"],"summary":"List plans","description":"Lists plans from learning_plan index, newest first.","operationId":"listPlansV2","parameters":[{"$ref":"#/components/parameters/CreatedByQuery"},{"$ref":"#/components/parameters/StatusQuery"},{"$ref":"#/components/parameters/SizeQuery"}],"responses":{"200":{"description":"Plans fetched successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListPlansResponse"}}}},"400":{"description":"Invalid size query param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/plan/{plan_id}/status":{"patch":{"tags":["Plan V2"],"summary":"Update plan status","description":"Allowed status values are draft and live.","operationId":"updatePlanStatusV2","parameters":[{"$ref":"#/components/parameters/PlanIdPath"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusUpdateRequest"}}}},"responses":{"200":{"description":"Status updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ElasticsearchWriteResponse"}}}},"400":{"description":"Missing status in request body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Invalid status value","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"parameters":{"PlanIdPath":{"name":"plan_id","in":"path","required":true,"schema":{"type":"string"},"description":"Plan identifier"},"WidHeader":{"name":"wid","in":"header","required":false,"schema":{"type":"string"}},"RootOrgHeader":{"name":"rootOrg","in":"header","required":false,"schema":{"type":"string"}},"OrgHeader":{"name":"org","in":"header","required":false,"schema":{"type":"string"}},"CreatedByQuery":{"name":"created_by","in":"query","required":false,"schema":{"type":"string"}},"StatusQuery":{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["draft","live","invalid"]}},"SizeQuery":{"name":"size","in":"query","required":false,"schema":{"type":"integer","default":50,"minimum":1}}},"schemas":{"HealthResponse":{"type":"object","properties":{"status":{"type":"string","example":"healthy"},"service":{"type":"string","example":"plan_v2"}},"required":["status","service"]},"ErrorResponse":{"type":"object","properties":{"error":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"object","additionalProperties":true}}]}},"required":["error"]},"PydanticValidationErrorResponse":{"type":"object","properties":{"error":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"loc":{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"msg":{"type":"string"},"input":{},"ctx":{"type":"object","additionalProperties":true}},"additionalProperties":true}}},"required":["error"]},"LexReference":{"type":"object","properties":{"course_id":{"type":"string"},"title":{"type":"string","nullable":true},"modules":{"type":"array","items":{"type":"string"},"nullable":true},"note":{"type":"string","nullable":true}},"required":["course_id"]},"PlanCreateRequest":{"type":"object","properties":{"topic":{"type":"string"},"target_competency":{"type":"string"},"primary_audience":{"type":"string"},"entry_skills":{"type":"string"},"default_lens":{"type":"string","default":"balanced"},"mode":{"type":"string","default":"guided"},"deadline":{"type":"string","format":"date-time","nullable":true},"visibility":{"type":"string","default":"private"},"created_by":{"type":"string"},"lex_references":{"type":"array","items":{"$ref":"#/components/schemas/LexReference"},"default":[]},"max_nodes":{"type":"integer","nullable":true}},"required":["topic","target_competency","primary_audience","entry_skills","created_by"]},"ValidationResult":{"type":"object","properties":{"valid":{"type":"boolean"},"errors":{"type":"array","items":{"type":"string"},"default":[]},"warnings":{"type":"array","items":{"type":"string"},"default":[]}},"required":["valid","errors","warnings"]},"Prerequisite":{"type":"object","properties":{"node_id":{"type":"string"},"reason":{"type":"string"}},"required":["node_id","reason"]},"Objective":{"type":"object","properties":{"id":{"type":"string"},"text":{"type":"string"},"bloom_level":{"type":"string"}},"required":["id","text","bloom_level"]},"SkillTag":{"type":"object","properties":{"skill_id":{"type":"string"},"legacy_id":{"type":"string","nullable":true},"primary":{"type":"boolean"},"cross_domain":{"type":"boolean"}},"required":["skill_id","primary","cross_domain"]},"QuizAssessment":{"type":"object","properties":{"question_count":{"type":"integer"},"covers":{"type":"array","items":{"type":"string"}},"pass_threshold":{"type":"number","format":"float"},"test_out_threshold":{"type":"number","format":"float","nullable":true}},"required":["question_count","covers","pass_threshold"]},"HandsOnAssessment":{"type":"object","properties":{"brief":{"type":"string"},"covers":{"type":"array","items":{"type":"string"}}},"required":["brief","covers"]},"DemoAssessment":{"type":"object","properties":{"brief":{"type":"string"},"covers":{"type":"array","items":{"type":"string"}}},"required":["brief","covers"]},"AssessmentRef":{"type":"object","properties":{"quiz":{"$ref":"#/components/schemas/QuizAssessment"},"hands_on":{"$ref":"#/components/schemas/HandsOnAssessment"},"demo":{"$ref":"#/components/schemas/DemoAssessment"}},"additionalProperties":false},"ContentRef":{"type":"object","properties":{"type":{"type":"string"},"course_id":{"type":"string","nullable":true},"modules":{"type":"array","items":{"type":"string"},"nullable":true},"objective_map":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}},"nullable":true},"reuse_key":{"type":"string","nullable":true},"covers":{"type":"array","items":{"type":"string"},"nullable":true},"note":{"type":"string","nullable":true}},"required":["type"]},"SkillNode":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"competency_statement":{"type":"string"},"prerequisites":{"type":"array","items":{"$ref":"#/components/schemas/Prerequisite"}},"objectives":{"type":"array","items":{"$ref":"#/components/schemas/Objective"}},"skill_tags":{"type":"array","items":{"$ref":"#/components/schemas/SkillTag"}},"assessment_mode":{"type":"string"},"assessment_ref":{"$ref":"#/components/schemas/AssessmentRef"},"content_refs":{"type":"array","items":{"$ref":"#/components/schemas/ContentRef"}},"reuse_key":{"type":"string"},"estimated_duration_hours":{"type":"number","format":"float"},"status":{"type":"string"}},"required":["id","title","competency_statement","objectives","skill_tags","assessment_mode","assessment_ref","content_refs","reuse_key","estimated_duration_hours","status"]},"PrerequisiteEdge":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"},"reason":{"type":"string"}},"required":["from","to","reason"]},"LearningPlan":{"type":"object","properties":{"plan_id":{"type":"string"},"topic":{"type":"string"},"target_competency":{"type":"string"},"primary_audience":{"type":"string"},"entry_skills":{"type":"string"},"default_lens":{"type":"string"},"mode":{"type":"string"},"deadline":{"type":"string","format":"date-time","nullable":true},"visibility":{"type":"string"},"version":{"type":"string"},"status":{"type":"string"},"provenance":{"type":"string"},"estimated_total_hours":{"type":"number","format":"float"},"created_by":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"published_at":{"type":"string","format":"date-time"},"prerequisite_graph":{"type":"array","items":{"$ref":"#/components/schemas/PrerequisiteEdge"}},"skill_nodes":{"type":"array","items":{"$ref":"#/components/schemas/SkillNode"}}},"required":["plan_id","topic","target_competency","primary_audience","entry_skills","default_lens","mode","visibility","version","status","provenance","estimated_total_hours","created_by","created_at","published_at","prerequisite_graph","skill_nodes"]},"PlanCreateResponse":{"type":"object","properties":{"plan_id":{"type":"string"},"status":{"type":"string","enum":["draft","invalid"]},"validation":{"$ref":"#/components/schemas/ValidationResult"},"plan":{"$ref":"#/components/schemas/LearningPlan"}},"required":["plan_id","status","validation","plan"]},"PlanTopicDocument":{"type":"object","properties":{"identifier":{"type":"string"},"title":{"type":"string"},"competency_statement":{"type":"string"},"prerequisites":{"type":"array","items":{"$ref":"#/components/schemas/Prerequisite"}},"objectives":{"type":"array","items":{"$ref":"#/components/schemas/Objective"}},"skill_tags":{"type":"array","items":{"$ref":"#/components/schemas/SkillTag"}},"assessment_mode":{"type":"string"},"assessment_ref":{"$ref":"#/components/schemas/AssessmentRef"},"content_refs":{"type":"array","items":{"$ref":"#/components/schemas/ContentRef"}},"reuse_key":{"type":"string"},"estimated_duration_hours":{"type":"number","format":"float"},"status":{"type":"string"}},"required":["identifier","title","competency_statement","objectives","skill_tags","assessment_mode","assessment_ref","content_refs","reuse_key","estimated_duration_hours","status"]},"PlanGetResponse":{"type":"object","properties":{"identifier":{"type":"string"},"topic":{"type":"string"},"target_competency":{"type":"string"},"primary_audience":{"type":"string"},"entry_skills":{"type":"string"},"default_lens":{"type":"string"},"mode":{"type":"string"},"deadline":{"type":"string","format":"date-time","nullable":true},"visibility":{"type":"string"},"version":{"type":"string"},"status":{"type":"string"},"provenance":{"type":"string"},"estimated_total_hours":{"type":"number","format":"float"},"created_by":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"published_at":{"type":"string","format":"date-time"},"prerequisite_graph":{"type":"array","items":{"$ref":"#/components/schemas/PrerequisiteEdge"}},"topics":{"type":"array","items":{"$ref":"#/components/schemas/PlanTopicDocument"}}},"required":["identifier","status","topics"]},"PlanIndexDocument":{"type":"object","properties":{"identifier":{"type":"string"},"topic":{"type":"string"},"target_competency":{"type":"string"},"primary_audience":{"type":"string"},"entry_skills":{"type":"string"},"default_lens":{"type":"string"},"mode":{"type":"string"},"deadline":{"type":"string","format":"date-time","nullable":true},"visibility":{"type":"string"},"version":{"type":"string"},"status":{"type":"string"},"provenance":{"type":"string"},"estimated_total_hours":{"type":"number","format":"float"},"created_by":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"published_at":{"type":"string","format":"date-time"},"prerequisite_graph":{"type":"array","items":{"$ref":"#/components/schemas/PrerequisiteEdge"}},"topics":{"type":"array","items":{"type":"string"}}},"required":["identifier","status"]},"ListPlansResponse":{"type":"object","properties":{"count":{"type":"integer"},"plans":{"type":"array","items":{"$ref":"#/components/schemas/PlanIndexDocument"}}},"required":["count","plans"]},"StatusUpdateRequest":{"type":"object","properties":{"status":{"type":"string","enum":["draft","live"]}},"required":["status"]},"ElasticsearchWriteResponse":{"type":"object","properties":{"_index":{"type":"string"},"_id":{"type":"string"},"_version":{"type":"integer"},"result":{"type":"string"},"_shards":{"type":"object","additionalProperties":true},"_seq_no":{"type":"integer"},"_primary_term":{"type":"integer"}},"additionalProperties":true}}}}