{"openapi":"3.1.0","info":{"title":"AI Career Coach — ATS Gap API","version":"2.0.0","description":"Degree-aware ATS keyword gap analysis. Context (degree_program, target_role, target_industry) is stored during upload and inherited automatically by the ATS gap endpoint — no re-submission required.\n"},"servers":[{"url":"http://localhost:8000","description":"Local development"}],"paths":{"/api/upload":{"post":{"summary":"Upload and analyse a resume or LinkedIn profile","description":"Accepts a PDF or DOCX file. Returns a full analysis record including scores, improvements, and rewritten bullets. The three context fields (degree_program, target_role, target_industry) are optional — when supplied they are stored on the record and automatically used by subsequent ATS gap requests for this analysis_id.\n","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"PDF or DOCX file, max 5 MB."},"profile_type":{"type":"string","enum":["resume","linkedin"],"default":"resume","description":"Determines which LLM prompt and scoring weights are applied."},"collect_consent":{"type":"string","enum":["true","false"],"default":"false","description":"When \"true\" the anonymised resume text is added to the peer-comparison corpus."},"degree_program":{"type":"string","nullable":true,"enum":["applied_business","applied_health","communication","family_human_services","information_technology","professional_studies","software_development"],"description":"BYU Pathway degree program. Drives degree-specific keyword boosting in ATS gap analysis. Omit to skip degree context.\n"},"target_role":{"type":"string","nullable":true,"maxLength":100,"example":"Healthcare Administrator","description":"Student's target job title. Stored and inherited by ATS gap."},"target_industry":{"type":"string","nullable":true,"maxLength":100,"example":"Healthcare","description":"Student's target industry. Stored and inherited by ATS gap."}}}}}},"responses":{"201":{"description":"Analysis complete.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"413":{"$ref":"#/components/responses/FileTooLarge"},"422":{"$ref":"#/components/responses/UnprocessableEntity"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/api/ats-gap":{"post":{"summary":"Keyword gap analysis against a job description","description":"Compares the resume text stored under analysis_id against the supplied job description. degree_program, target_role, and target_industry are read automatically from the stored record — the caller does not need to re-supply them.\n**Ranking behaviour:** Missing keywords are sorted by priority weight. Degree-required skills (×1.5), degree-preferred skills (×1.2), and role-family keywords (×1.3) all rank above generic terms. Weights are cumulative.\n**Determinism:** The same analysis_id + job_description always returns the same match_percentage.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AtsGapRequest"},"example":{"analysis_id":"4ddbc2d1-eb7a-46d4-8fbe-8d98df71195a","job_description":"Requirements:\n- HIPAA compliance experience required\n- EHR documentation required (Epic preferred)\n- Patient care and care coordination\n- Clinical documentation standards\n- Strong communication skills\n"}}}},"responses":{"200":{"description":"Gap analysis complete.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AtsGapResponse"},"example":{"analysis_id":"4ddbc2d1-eb7a-46d4-8fbe-8d98df71195a","match_percentage":41,"job_keyword_count":12,"matched_keywords":["communication","documentation","compliance","clinical"],"missing_keywords":["hipaa","ehr","patient care","epic","leadership","excel"],"top_matched":["communication","documentation","compliance","clinical"],"top_missing":["hipaa","ehr","patient care","epic","leadership"],"degree_program":"applied_health","target_role":"Healthcare Administrator","target_industry":"Healthcare"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/UnprocessableEntity"}}}}},"components":{"schemas":{"AtsGapRequest":{"type":"object","required":["analysis_id","job_description"],"properties":{"analysis_id":{"type":"string","format":"uuid","description":"ID returned by POST /api/upload.","example":"4ddbc2d1-eb7a-46d4-8fbe-8d98df71195a"},"job_description":{"type":"string","minLength":1,"description":"Full text of the target job description. Must contain at least 8 words — shorter input returns 400.\n","example":"Requirements:\n- HIPAA compliance required\n- EHR experience required"}}},"AtsGapResponse":{"type":"object","required":["analysis_id","match_percentage","job_keyword_count","matched_keywords","missing_keywords","top_matched","top_missing","degree_program","target_role","target_industry"],"properties":{"analysis_id":{"type":"string","format":"uuid","description":"Echoed from the request."},"match_percentage":{"type":"integer","minimum":0,"maximum":100,"description":"Weighted keyword match score. Degree-relevant keywords carry higher weight so the percentage reflects field fit, not just raw keyword count.\n"},"job_keyword_count":{"type":"integer","minimum":0,"description":"Total number of distinct keywords detected in the job description."},"matched_keywords":{"type":"array","items":{"type":"string"},"maxItems":50,"description":"All job keywords found in the resume, sorted by priority weight (highest first). Capped at 50.\n"},"missing_keywords":{"type":"array","items":{"type":"string"},"maxItems":50,"description":"All job keywords absent from the resume, sorted by priority weight (highest first). Degree-required terms appear at the top. Capped at 50.\n"},"top_matched":{"type":"array","items":{"type":"string"},"maxItems":10,"description":"Top 10 from matched_keywords. Use this for UI display."},"top_missing":{"type":"array","items":{"type":"string"},"maxItems":10,"description":"Top 10 from missing_keywords. Use this for UI display and as input to POST /api/suggest-bullets.\n"},"degree_program":{"type":"string","nullable":true,"enum":["applied_business","applied_health","communication","family_human_services","information_technology","professional_studies","software_development",null],"description":"Degree program inherited from the upload record. null when the student did not supply one during upload.\n"},"target_role":{"type":"string","nullable":true,"maxLength":100,"description":"Target job title inherited from the upload record. null when not supplied.","example":"Healthcare Administrator"},"target_industry":{"type":"string","nullable":true,"maxLength":100,"description":"Target industry inherited from the upload record. null when not supplied.","example":"Healthcare"}}},"UploadResponse":{"type":"object","required":["analysis_id","overall_score","profile_type","analysis_source"],"properties":{"analysis_id":{"type":"string","format":"uuid","description":"Use this ID for all subsequent requests (ATS gap, suggest bullets, export)."},"overall_score":{"type":"integer","minimum":0,"maximum":100},"profile_type":{"type":"string","enum":["resume","linkedin"]},"analysis_source":{"type":"string","enum":["hybrid","rule_based"]},"degree_program":{"type":"string","nullable":true,"description":"Echoed back from the upload request."},"target_role":{"type":"string","nullable":true,"description":"Echoed back from the upload request."},"target_industry":{"type":"string","nullable":true,"description":"Echoed back from the upload request."}}},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable SCREAMING_SNAKE_CASE error code.","example":"ANALYSIS_NOT_FOUND"},"message":{"type":"string","description":"Human-readable description.","example":"No analysis found for the provided ID."},"details":{"type":"object","description":"Optional extra context (field names, limits, etc.)."}}}}}},"responses":{"BadRequest":{"description":"Request validation failed. Common causes: job_description has fewer than 8 words (ATS gap), invalid profile_type or degree_program (upload).\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":{"code":"INVALID_ATS_GAP_PAYLOAD","message":"job_description is too short. Provide at least 8 words.","details":{}}}}}},"NotFound":{"description":"analysis_id does not exist in the store.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":{"code":"ANALYSIS_NOT_FOUND","message":"No analysis found for the provided ID.","details":{}}}}}},"UnprocessableEntity":{"description":"Request shape is valid but the content cannot be processed. For ATS gap: the stored record has no extractable resume text. For upload: file text could not be extracted.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":{"code":"ATS_GAP_FAILED","message":"No source text is available for ATS gap analysis.","details":{}}}}}},"FileTooLarge":{"description":"Uploaded file exceeds the 5 MB limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":{"code":"FILE_TOO_LARGE","message":"File size exceeds 5MB limit.","details":{"max_size_bytes":5242880}}}}}},"ServiceUnavailable":{"description":"Azure OpenAI call failed. Rule-based scores are unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":{"code":"LLM_UNAVAILABLE","message":"AI enrichment service is temporarily unavailable.","details":{}}}}}}}}}