{"openapi":"3.0.3","info":{"title":"AI@HR Recruitment API","version":"1.0.0","description":"API contract for the AI@HR recruitment workflow represented by the supplied\nrequirements, ERD V1 and UI designs.\n\nSource-of-truth rules used in this contract:\n- JD input is Markdown only.\n- CV upload accepts PDF and DOCX.\n- A CV batch supports up to 200 files.\n- Unsupported CV files are rejected per-file; valid files continue.\n- A CV that later cannot be parsed is moved to Needs Review without failing the batch.\n- Screening result categories are Fast-Track, Standard Review, Low-Priority and Needs Review.\n\nPersistence coverage:\n- Endpoints tagged Jobs, Job Description and CV Batches map directly to ERD V1.\n- Endpoints tagged Screening Results are required by the provided UI/requirements,\n  but their assessment/candidate persistence tables are not present in ERD V1 yet.\n  Their schemas therefore define the API contract that the next ERD revision must support.\n"},"servers":[{"description":"SwaggerHub API Auto Mocking","url":"https://virtserver.swaggerhub.com/digitaltransformatio-4d0/AI_HR/1.0.0"},{"url":"/api/v1"}],"tags":[{"name":"Jobs"},{"name":"Job Description"},{"name":"CV Batches"},{"name":"Screening Results"}],"paths":{"/jobs":{"get":{"tags":["Jobs"],"summary":"List jobs for the Jobs management screen","operationId":"listJobs","parameters":[{"$ref":"#/components/parameters/Search"},{"$ref":"#/components/parameters/JobStatus"},{"$ref":"#/components/parameters/Page"},{"$ref":"#/components/parameters/PageSize"}],"responses":{"200":{"description":"Jobs and dashboard counters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobListResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"}}},"post":{"tags":["Jobs","Job Description"],"summary":"Create a job from a Markdown Job Description","description":"Supports both UI modes shown in \"Create job from JD\":\nuploading a .md file or pasting Markdown directly.\nThe server validates the template, creates the stable Job,\npersists the JD metadata/storage reference and starts JD parsing.\n","operationId":"createJobFromJd","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"Markdown (.md) file only."}}}},"application/json":{"schema":{"$ref":"#/components/schemas/CreateJobFromMarkdownRequest"}}}},"responses":{"201":{"description":"Job created and JD accepted for parsing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobDetailResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"415":{"description":"Unsupported JD file type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"},"example":{"code":"UNSUPPORTED_JD_FORMAT","message":"Job Description must be a Markdown (.md) file.","field":"file"}}}}}}},"/jobs/{jobId}":{"get":{"tags":["Jobs"],"summary":"Get job detail","operationId":"getJob","parameters":[{"$ref":"#/components/parameters/JobId"}],"responses":{"200":{"description":"Job detail used by the Job Description detail screen","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobDetailResponse"}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Jobs"],"summary":"Update job lifecycle status","operationId":"updateJob","parameters":[{"$ref":"#/components/parameters/JobId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["status"],"properties":{"status":{"$ref":"#/components/schemas/JobStatus"}}}}}},"responses":{"200":{"description":"Updated job","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/jobs/{jobId}/job-description":{"get":{"tags":["Job Description"],"summary":"Get parsed Job Description detail","operationId":"getJobDescription","parameters":[{"$ref":"#/components/parameters/JobId"}],"responses":{"200":{"description":"Parsed JD data required by the Detail and Markdown tabs, including\nstructured criteria, metadata, parse state and the raw Markdown text.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobDescriptionResponse"}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"put":{"tags":["Job Description"],"summary":"Replace the Job Description Markdown and re-parse","description":"Used by Edit Markdown. The new Markdown becomes the current source,\nparse status returns to processing, and structured criteria are rebuilt.\n","operationId":"replaceJobDescription","parameters":[{"$ref":"#/components/parameters/JobId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["markdown"],"properties":{"markdown":{"type":"string","minLength":1}}}}}},"responses":{"202":{"description":"Replacement accepted and parsing started","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobDescriptionResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/jobs/{jobId}/cv-batches":{"post":{"tags":["CV Batches"],"summary":"Upload multiple CVs for a job","description":"Accepts up to 200 CV files in a single submission.\nPDF and DOCX are supported. Unsupported files are rejected individually;\nvalid files remain accepted and can continue through processing.\n","operationId":"createCvBatch","parameters":[{"$ref":"#/components/parameters/JobId"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["files"],"properties":{"files":{"type":"array","minItems":1,"maxItems":200,"items":{"type":"string","format":"binary"}}}}}}},"responses":{"201":{"description":"Batch created; includes accepted/rejected result per file","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CvBatchResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/jobs/{jobId}/cv-batches/{batchId}":{"get":{"tags":["CV Batches"],"summary":"Get CV batch processing status","description":"Referal Screen: Sceening pipelin. UI call API to get all CVs in batch and categorize them to 4 folder.\n","operationId":"getCvBatch","parameters":[{"$ref":"#/components/parameters/JobId"},{"$ref":"#/components/parameters/BatchId"}],"responses":{"200":{"description":"Batch summary and individual file states","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CvBatchResponse"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/jobs/{jobId}/cv-batches/{batchId}/screen":{"post":{"tags":["CV Batches","Screening Results"],"summary":"Start screening an uploaded CV batch","description":"- Starts asynchronous screening. The client does not need to stay on the page.\nThis endpoint is required by the \"Screen CVs\" action shown in the UI.\n- Referal Screen: Import and Screen CVs.\n","operationId":"startScreening","parameters":[{"$ref":"#/components/parameters/JobId"},{"$ref":"#/components/parameters/BatchId"}],"responses":{"202":{"description":"Screening run started","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScreeningRun"}}}},"409":{"description":"Batch cannot be screened in its current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/jobs/{jobId}/screening":{"get":{"tags":["Screening Results"],"summary":"Get screening pipeline summary","description":"Supplies the tab counters and selected-job context for the Screening Pipeline UI.\nScreening persistence is not represented in ERD V1 and must be added in a later ERD.\n","operationId":"getScreeningSummary","parameters":[{"$ref":"#/components/parameters/JobId"}],"responses":{"200":{"description":"Pipeline counts and current run progress","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScreeningSummaryResponse"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/jobs/{jobId}/candidates":{"get":{"tags":["Screening Results"],"summary":"List candidates in a screening result category","operationId":"listCandidates","parameters":[{"$ref":"#/components/parameters/JobId"},{"name":"category","in":"query","required":false,"schema":{"$ref":"#/components/schemas/ResultCategory"}},{"name":"search","in":"query","required":false,"schema":{"type":"string"}},{"$ref":"#/components/parameters/Page"},{"$ref":"#/components/parameters/PageSize"}],"responses":{"200":{"description":"Ranked candidates for the requested category","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CandidateListResponse"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/jobs/{jobId}/candidates/{candidateId}/assessment":{"get":{"tags":["Screening Results"],"summary":"Get full candidate assessment","description":"Returns every object displayed on Fast-Track, Standard Review and Low-Priority\ncandidate detail screens: identity, overall score, strengths, missing requirements,\ndimension score/reason/evidence/confidence and result category.\n","operationId":"getCandidateAssessment","parameters":[{"$ref":"#/components/parameters/JobId"},{"$ref":"#/components/parameters/CandidateId"}],"responses":{"200":{"description":"Full candidate assessment","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CandidateAssessmentResponse"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/jobs/{jobId}/needs-review":{"get":{"tags":["Screening Results"],"summary":"List files/candidates requiring manual review","description":"Supplies the Needs Review screen, grouped by failure reason such as parse failure,\nretry exhaustion or invalid AI output.\n","operationId":"getNeedsReview","parameters":[{"$ref":"#/components/parameters/JobId"}],"responses":{"200":{"description":"Needs Review groups and affected candidates/files","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NeedsReviewResponse"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/cv-documents/{cvDocumentId}/content":{"get":{"tags":["CV Batches"],"summary":"Get a CV document for View CV","operationId":"getCvDocumentContent","parameters":[{"name":"cvDocumentId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Original CV file","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{"schema":{"type":"string","format":"binary"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}}},"components":{"parameters":{"JobId":{"name":"jobId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},"BatchId":{"name":"batchId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},"CandidateId":{"name":"candidateId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},"Search":{"name":"search","in":"query","required":false,"description":"Search by job title or job code.","schema":{"type":"string"}},"JobStatus":{"name":"status","in":"query","required":false,"schema":{"$ref":"#/components/schemas/JobStatus"}},"Page":{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1}},"PageSize":{"name":"pageSize","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}},"responses":{"BadRequest":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"NotFound":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"schemas":{"JobStatus":{"type":"string","enum":["draft","open","closed"]},"JdParseStatus":{"type":"string","enum":["uploaded","processing","parsed","failed"]},"JdCriterionType":{"type":"string","enum":["must_have","preferred","responsibility"]},"CvBatchStatus":{"type":"string","enum":["uploaded","processing","completed","completed_with_issues"]},"CvValidationStatus":{"type":"string","enum":["accepted","rejected"]},"CvProcessingStatus":{"type":"string","enum":["awaiting_processing","processing","processed","needs_review"]},"ResultCategory":{"type":"string","enum":["fast_track","standard_review","low_priority","needs_review"]},"ConfidenceLevel":{"type":"string","enum":["high","medium","low"]},"ApiError":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"field":{"type":"string","nullable":true},"details":{"type":"object","additionalProperties":true,"nullable":true}}},"PageMeta":{"type":"object","required":["page","pageSize","totalItems","totalPages"],"properties":{"page":{"type":"integer"},"pageSize":{"type":"integer"},"totalItems":{"type":"integer"},"totalPages":{"type":"integer"}}},"Job":{"type":"object","required":["id","jobCode","title","status","createdAt","updatedAt"],"properties":{"id":{"type":"string","format":"uuid"},"jobCode":{"type":"string","maxLength":50,"example":"JD-QC03082026-PQC"},"title":{"type":"string","example":"Professional QC Engineer"},"status":{"$ref":"#/components/schemas/JobStatus"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"JobListItem":{"allOf":[{"$ref":"#/components/schemas/Job"},{"type":"object","required":["candidateCount"],"properties":{"candidateCount":{"type":"integer","minimum":0,"description":"Total CV/candidate count associated with the job."},"department":{"type":"string","nullable":true},"seniorityLevel":{"type":"string","nullable":true},"employmentType":{"type":"string","nullable":true},"location":{"type":"string","nullable":true},"workMode":{"type":"string","nullable":true}}}]},"JobDashboardSummary":{"type":"object","description":"Counters rendered in the Jobs management screen.","required":["openJobs","totalCvs","cvsAwaitingScreen","fastTrack"],"properties":{"openJobs":{"type":"integer"},"totalCvs":{"type":"integer"},"cvsAwaitingScreen":{"type":"integer"},"fastTrack":{"type":"integer"}}},"JobListResponse":{"type":"object","required":["summary","items","pagination"],"properties":{"summary":{"$ref":"#/components/schemas/JobDashboardSummary"},"items":{"type":"array","items":{"$ref":"#/components/schemas/JobListItem"}},"pagination":{"$ref":"#/components/schemas/PageMeta"}}},"CreateJobFromMarkdownRequest":{"type":"object","required":["markdown"],"properties":{"markdown":{"type":"string","description":"Markdown content following the JD template.\nFront matter is expected to contain type, jobId and jobName as shown in the UI.\n","example":"---\ntype: job-description\njobId: JD-QC03082026-PQC\njobName: Professional QC Engineer\n---\n# Professional QC Engineer\n\n## About the Role\n...\n\n## What You'll Do\n- ...\n\n## What We're Looking For\n### Required\n- ...\n### Nice to Have\n- ...\n"}}},"JobDetailResponse":{"type":"object","required":["job","jobDescription"],"properties":{"job":{"$ref":"#/components/schemas/Job"},"jobDescription":{"$ref":"#/components/schemas/JobDescriptionSummary"}}},"JobDescriptionSummary":{"type":"object","required":["id","parseStatus","originalFileName","uploadedAt"],"properties":{"id":{"type":"string","format":"uuid"},"originalFileName":{"type":"string"},"parseStatus":{"$ref":"#/components/schemas/JdParseStatus"},"department":{"type":"string","nullable":true},"seniorityLevel":{"type":"string","nullable":true},"employmentType":{"type":"string","nullable":true},"location":{"type":"string","nullable":true},"workMode":{"type":"string","nullable":true},"uploadedAt":{"type":"string","format":"date-time"},"parsedAt":{"type":"string","format":"date-time","nullable":true},"parseError":{"allOf":[{"$ref":"#/components/schemas/ParseError"}],"nullable":true}}},"ParseError":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","example":"MISSING_REQUIRED_SECTION"},"message":{"type":"string","example":"Required section \"What We're Looking For / Required\" is missing."},"section":{"type":"string","nullable":true}}},"JobCriterion":{"type":"object","required":["id","criterionType","description","sortOrder"],"properties":{"id":{"type":"string","format":"uuid"},"criterionType":{"$ref":"#/components/schemas/JdCriterionType"},"title":{"type":"string","nullable":true},"description":{"type":"string"},"sortOrder":{"type":"integer"}}},"ParsedRequirementsMatrix":{"type":"object","description":"UI-shaped grouping of criteria from job_description_criteria.","required":["mustHave","niceToHave","responsibilities"],"properties":{"mustHave":{"type":"array","items":{"$ref":"#/components/schemas/JobCriterion"}},"niceToHave":{"type":"array","items":{"$ref":"#/components/schemas/JobCriterion"}},"responsibilities":{"type":"array","items":{"$ref":"#/components/schemas/JobCriterion"}}}},"JobDescriptionResponse":{"type":"object","required":["job","jobDescription","requirementsMatrix","rawMarkdown"],"properties":{"job":{"$ref":"#/components/schemas/Job"},"jobDescription":{"$ref":"#/components/schemas/JobDescriptionSummary"},"requirementsMatrix":{"$ref":"#/components/schemas/ParsedRequirementsMatrix"},"rawMarkdown":{"type":"string","description":"Raw Markdown for the Markdown tab. ERD V1 stores the source in external storage,\nso the service resolves storage_key and returns the text here.\n"},"ui":{"type":"object","description":"Derived values needed by the supplied JD detail screen.","properties":{"tierGroupCount":{"type":"integer","example":3},"parsingSuccessPercent":{"type":"integer","minimum":0,"maximum":100,"example":100}}}}},"CvFileResult":{"type":"object","required":["id","originalFileName","validationStatus","processingStatus","createdAt"],"properties":{"id":{"type":"string","format":"uuid"},"originalFileName":{"type":"string"},"fileExtension":{"type":"string"},"mimeType":{"type":"string","nullable":true},"fileSizeBytes":{"type":"integer","format":"int64","nullable":true},"validationStatus":{"$ref":"#/components/schemas/CvValidationStatus"},"validationError":{"type":"string","nullable":true},"processingStatus":{"$ref":"#/components/schemas/CvProcessingStatus"},"processedAt":{"type":"string","format":"date-time","nullable":true}}},"CvBatchResponse":{"type":"object","required":["id","jobId","status","counts","files","createdAt"],"properties":{"id":{"type":"string","format":"uuid"},"jobId":{"type":"string","format":"uuid"},"status":{"$ref":"#/components/schemas/CvBatchStatus"},"counts":{"type":"object","required":["total","accepted","rejected","ready","needsReview"],"properties":{"total":{"type":"integer"},"accepted":{"type":"integer"},"rejected":{"type":"integer"},"ready":{"type":"integer"},"needsReview":{"type":"integer"}}},"files":{"type":"array","items":{"$ref":"#/components/schemas/CvFileResult"}},"createdAt":{"type":"string","format":"date-time"},"processingStartedAt":{"type":"string","format":"date-time","nullable":true},"completedAt":{"type":"string","format":"date-time","nullable":true}}},"ScreeningRun":{"type":"object","description":"API contract required by US-024/025/026 and the UI.\nA corresponding screening_runs table is not present in ERD V1.\n","required":["id","jobId","batchId","status","progress","createdAt"],"properties":{"id":{"type":"string","format":"uuid"},"jobId":{"type":"string","format":"uuid"},"batchId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["queued","processing","completed","needs_attention","failed"]},"progress":{"type":"object","required":["total","processed","succeeded","needsReview"],"properties":{"total":{"type":"integer"},"processed":{"type":"integer"},"succeeded":{"type":"integer"},"needsReview":{"type":"integer"}}},"createdAt":{"type":"string","format":"date-time"},"startedAt":{"type":"string","format":"date-time","nullable":true},"completedAt":{"type":"string","format":"date-time","nullable":true}}},"CategoryCounters":{"type":"object","required":["fastTrack","standardReview","lowPriority","needsReview"],"properties":{"fastTrack":{"type":"integer"},"standardReview":{"type":"integer"},"lowPriority":{"type":"integer"},"needsReview":{"type":"integer"}}},"ScreeningSummaryResponse":{"type":"object","required":["job","counters"],"properties":{"job":{"$ref":"#/components/schemas/Job"},"counters":{"$ref":"#/components/schemas/CategoryCounters"},"activeRun":{"allOf":[{"$ref":"#/components/schemas/ScreeningRun"}],"nullable":true}}},"CandidateListItem":{"type":"object","required":["candidateId","cvDocumentId","name","category"],"properties":{"candidateId":{"type":"string","format":"uuid"},"cvDocumentId":{"type":"string","format":"uuid"},"name":{"type":"string"},"email":{"type":"string","format":"email","nullable":true},"location":{"type":"string","nullable":true},"currentRole":{"type":"string","nullable":true},"overallScore":{"type":"integer","minimum":0,"maximum":100,"nullable":true},"category":{"$ref":"#/components/schemas/ResultCategory"},"rank":{"type":"integer","nullable":true}}},"CandidateListResponse":{"type":"object","required":["items","pagination"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/CandidateListItem"}},"pagination":{"$ref":"#/components/schemas/PageMeta"}}},"CandidateInformation":{"type":"object","required":["candidateId","cvDocumentId","name"],"properties":{"candidateId":{"type":"string","format":"uuid"},"cvDocumentId":{"type":"string","format":"uuid"},"name":{"type":"string"},"email":{"type":"string","format":"email","nullable":true},"phone":{"type":"string","nullable":true},"location":{"type":"string","nullable":true},"currentRole":{"type":"string","nullable":true}}},"AssessmentFinding":{"type":"object","required":["text"],"properties":{"text":{"type":"string"},"evidence":{"type":"string","nullable":true},"confidence":{"allOf":[{"$ref":"#/components/schemas/ConfidenceLevel"}],"nullable":true}}},"DimensionScore":{"type":"object","required":["id","name","score","reason","evidence","confidence"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","example":"Backend Engineering"},"score":{"type":"integer","minimum":0,"maximum":100},"reason":{"type":"string"},"evidence":{"type":"string","description":"Use \"Not explicitly mentioned\" when no supporting CV evidence exists."},"confidence":{"$ref":"#/components/schemas/ConfidenceLevel"}}},"CandidateAssessmentResponse":{"type":"object","description":"UI contract for the complete per-candidate assessment.\nCandidate/assessment/dimension entities require additional ERD tables beyond V1.\n","required":["candidate","category","overallScore","strengths","missingRequirements","dimensions"],"properties":{"candidate":{"$ref":"#/components/schemas/CandidateInformation"},"category":{"$ref":"#/components/schemas/ResultCategory"},"overallScore":{"type":"integer","minimum":0,"maximum":100},"recommendation":{"type":"string","nullable":true},"strengths":{"type":"array","items":{"$ref":"#/components/schemas/AssessmentFinding"}},"missingRequirements":{"type":"array","items":{"$ref":"#/components/schemas/AssessmentFinding"}},"dimensions":{"type":"array","items":{"$ref":"#/components/schemas/DimensionScore"}},"evaluatedAt":{"type":"string","format":"date-time","nullable":true}}},"NeedsReviewReason":{"type":"string","enum":["parse_failed","retry_failed","invalid_ai_output"]},"NeedsReviewItem":{"type":"object","required":["cvDocumentId","displayName","reason"],"properties":{"cvDocumentId":{"type":"string","format":"uuid"},"candidateId":{"type":"string","format":"uuid","nullable":true},"displayName":{"type":"string"},"reason":{"$ref":"#/components/schemas/NeedsReviewReason"},"message":{"type":"string","nullable":true}}},"NeedsReviewGroup":{"type":"object","required":["reason","count","items"],"properties":{"reason":{"$ref":"#/components/schemas/NeedsReviewReason"},"count":{"type":"integer"},"title":{"type":"string","example":"Parse Failed"},"description":{"type":"string","example":"CV content couldn't be extracted."},"items":{"type":"array","items":{"$ref":"#/components/schemas/NeedsReviewItem"}}}},"NeedsReviewResponse":{"type":"object","required":["total","groups"],"properties":{"total":{"type":"integer"},"groups":{"type":"array","items":{"$ref":"#/components/schemas/NeedsReviewGroup"}}}}}}}