Skip to main content

Upload and Analyze Resume

Uploads a resume file and triggers asynchronous AI-powered analysis. The endpoint supports multiple file formats and includes built-in duplicate detection via content hash comparison.

Endpoint

POST /api/resumes/upload

Authentication

This endpoint requires authentication. Include your authentication token in the request headers.

Rate Limiting

This endpoint is rate-limited to 5 requests per IP address and globally. Exceeds will result in HTTP 429 (Too Many Requests).

Request

Headers

Content-Type
string
required
Must be multipart/form-data

Body Parameters

file
file
required
The resume file to upload and analyze.Supported formats:
  • PDF (.pdf)
  • Microsoft Word (.docx, .doc)
  • Plain text (.txt)
  • Markdown (.md)
Maximum file size: 10 MB

Response

code
integer
Status code. 200 indicates success.
message
string
Response message. Returns “检测到相同简历,已返回历史分析结果” if duplicate is detected.
data
object
Response data containing resume upload and analysis information.

Examples

curl -X POST https://api.example.com/api/resumes/upload \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -F "file=@/path/to/resume.pdf"

Response Examples

New Resume Upload (Success)

{
  "code": 200,
  "message": "success",
  "data": {
    "resume": {
      "id": 12345,
      "filename": "john_doe_resume.pdf",
      "analyzeStatus": "PENDING"
    },
    "storage": {
      "fileKey": "resumes/2026/03/10/abc123.pdf",
      "fileUrl": "https://storage.example.com/resumes/2026/03/10/abc123.pdf",
      "resumeId": 12345
    },
    "duplicate": false
  }
}

Duplicate Resume Detected

{
  "code": 200,
  "message": "检测到相同简历,已返回历史分析结果",
  "data": {
    "analysis": {
      "overallScore": 85,
      "contentScore": 88,
      "structureScore": 82,
      "skillMatchScore": 87,
      "expressionScore": 84,
      "projectScore": 86,
      "summary": "这是一份优秀的简历,展现了丰富的项目经验和扎实的技术能力。",
      "strengths": [
        "丰富的全栈开发经验",
        "清晰的项目成果展示",
        "技术栈覆盖广泛"
      ],
      "suggestions": [
        {
          "category": "内容优化",
          "description": "建议增加量化的业务成果数据"
        }
      ]
    },
    "storage": {
      "fileKey": "resumes/2026/03/05/xyz789.pdf",
      "fileUrl": "https://storage.example.com/resumes/2026/03/05/xyz789.pdf",
      "resumeId": 12340
    },
    "duplicate": true
  }
}

Error Responses

Error Codes
object

Error Response Example

{
  "code": 2002,
  "message": "无法从文件中提取文本内容,请确保文件不是扫描版PDF",
  "data": null
}

Processing Flow

  1. File Validation: The system validates file type, size, and content
  2. Duplicate Detection: Content hash is calculated and checked against existing resumes
  3. Text Extraction: Resume text is parsed from the uploaded file
  4. Storage: File is stored in RustFS with a unique key
  5. Database Persistence: Resume metadata is saved with PENDING status
  6. Async Analysis: Analysis task is queued to Redis Stream for background processing
  7. Response: Client receives immediate response with resume ID and storage info
Polling for Results: Since analysis is asynchronous, use the Get Resume Detail endpoint to poll for analysis completion. The analyzeStatus field will change from PENDING to COMPLETED when ready.

Notes

  • Analysis typically completes within 10-30 seconds depending on resume complexity
  • Duplicate detection uses SHA-256 content hashing
  • If a duplicate is found with existing analysis results, they are returned immediately
  • Failed analyses can be retried using the Reanalyze Resume endpoint

Reanalyze Resume

Manually trigger re-analysis of a previously uploaded resume. Useful for retrying failed analyses or getting updated results.

Endpoint

POST /api/resumes/{id}/reanalyze

Rate Limiting

This endpoint is rate-limited to 2 requests per IP address and globally per resume.

Path Parameters

id
long
required
The unique identifier of the resume to reanalyze

Response

code
integer
Status code. 200 indicates success.
message
string
Response message
data
null
No data returned for this endpoint

Example Request

curl -X POST https://api.example.com/api/resumes/12345/reanalyze \
  -H "Authorization: Bearer YOUR_TOKEN"

Success Response

{
  "code": 200,
  "message": "success",
  "data": null
}

Error Responses

Error Codes
object

Notes

  • The resume status is reset to PENDING when reanalysis is triggered
  • Any previous analysis errors are cleared
  • If resume text is not cached, the system will re-parse the original file from storage
  • Poll the Get Resume Detail endpoint to check analysis progress

Build docs developers (and LLMs) love