Skip to main content

Delete Resume

Permanently deletes a resume and all associated data, including the stored file, analysis records, and linked interview sessions. This operation cannot be undone.

Endpoint

DELETE /api/resumes/{id}

Authentication

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

Path Parameters

id
long
required
The unique identifier of the resume to delete

Response

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

Examples

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

Response Example

Success Response

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

Error Responses

Error Codes
object

Error Response Example

{
  "code": 2001,
  "message": "简历不存在",
  "data": null
}

What Gets Deleted

When a resume is deleted, the following data is permanently removed:
  • The original uploaded file is deleted from RustFS storage
  • Storage key and URL become invalid
  • File deletion failures are logged but don’t prevent database cleanup
  • Resume entity record (filename, upload date, etc.)
  • Parsed resume text content
  • Content hash used for duplicate detection
  • Access count and statistics
  • All analysis history records
  • Scores (overall, content, structure, etc.)
  • Strengths and suggestions
  • AI-generated summaries
  • Analysis timestamps and status
  • All mock interview sessions created from this resume
  • Interview questions and answers
  • Interview evaluation results and scores
  • Interview session metadata and timestamps

Deletion Process

The deletion follows this sequence:
  1. Validation: Verify resume exists and user has permission
  2. File Removal: Delete the stored file from RustFS (best effort)
  3. Interview Cleanup: Delete all associated interview sessions and answers
  4. Database Cleanup: Remove resume record and all analysis records (cascading)
  5. Response: Return success confirmation
Cascading Deletion: The database schema is configured with cascading deletes, ensuring all related records (analyses, interviews) are automatically removed when the resume is deleted.
Storage Deletion: If file deletion from storage fails (e.g., network issue), the operation logs a warning but continues with database cleanup. This ensures data consistency even if storage cleanup fails.

Use Cases

  1. Privacy Compliance: Allow users to remove personal data
  2. Cleanup: Remove outdated or incorrect resumes
  3. Storage Management: Free up storage space
  4. Testing: Clean up test data in development environments
  5. Account Closure: Remove all user data when closing account

Best Practices

Always implement a confirmation dialog to prevent accidental deletions:
async function deleteResume(resumeId) {
  const confirmed = confirm(
    'Are you sure you want to delete this resume? ' +
    'This will also delete all analysis results and interview sessions. ' +
    'This action cannot be undone.'
  );
  
  if (!confirmed) return;
  
  try {
    const response = await fetch(`/api/resumes/${resumeId}`, {
      method: 'DELETE',
      headers: { 'Authorization': `Bearer ${token}` }
    });
    
    if (response.ok) {
      showSuccess('Resume deleted successfully');
      refreshResumeList();
    } else {
      const error = await response.json();
      showError(`Deletion failed: ${error.message}`);
    }
  } catch (error) {
    showError(`Network error: ${error.message}`);
  }
}
For better UX, update the UI immediately and handle errors:
async function deleteResumeOptimistically(resumeId) {
  // Remove from UI immediately
  removeResumeFromUI(resumeId);
  
  try {
    const response = await fetch(`/api/resumes/${resumeId}`, {
      method: 'DELETE'
    });
    
    if (!response.ok) {
      // Restore on error
      restoreResumeInUI(resumeId);
      throw new Error('Deletion failed');
    }
  } catch (error) {
    showError('Failed to delete resume');
    restoreResumeInUI(resumeId);
  }
}
Warn users about associated data that will be deleted:
async function deleteResumeWithWarning(resumeId) {
  // Fetch resume details first
  const detail = await fetch(`/api/resumes/${resumeId}/detail`)
    .then(r => r.json());
  
  const interviewCount = detail.data.interviews.length;
  const analysisCount = detail.data.analyses.length;
  
  const message = `Delete "${detail.data.filename}"?\n\n` +
    `This will also delete:\n` +
    `- ${analysisCount} analysis record(s)\n` +
    `- ${interviewCount} interview session(s)\n\n` +
    `This action cannot be undone.`;
  
  if (confirm(message)) {
    await deleteResume(resumeId);
  }
}
For critical applications, consider implementing soft delete on the backend:
// Instead of permanent deletion, mark as deleted
public void softDeleteResume(Long id) {
    ResumeEntity resume = findById(id);
    resume.setDeleted(true);
    resume.setDeletedAt(LocalDateTime.now());
    resumeRepository.save(resume);
}

// Add to queries to exclude soft-deleted records
@Query("SELECT r FROM ResumeEntity r WHERE r.deleted = false")
List<ResumeEntity> findAllActive();
Benefits:
  • Allows data recovery if deleted by mistake
  • Maintains referential integrity
  • Supports compliance and audit requirements

Security Considerations

Authorization: Ensure the authenticated user owns the resume before allowing deletion. The backend should verify ownership:
public void deleteResume(Long resumeId, Long userId) {
    ResumeEntity resume = findById(resumeId);
    
    if (!resume.getUserId().equals(userId)) {
        throw new ForbiddenException("Cannot delete another user's resume");
    }
    
    // Proceed with deletion
}
Audit Logging: For compliance, log all deletion operations:
log.info("Resume deleted: id={}, userId={}, filename={}, timestamp={}",
    resumeId, userId, resume.getFilename(), LocalDateTime.now());

Troubleshooting

Problem: Receive error 2001 even though resume ID is validPossible Causes:
  • Resume was already deleted
  • User doesn’t have access to this resume
  • Database synchronization issue
Solution:
  • Verify resume exists by calling GET /api/resumes/detail first
  • Check user authentication and permissions
  • Refresh the resume list to get current state
Problem: Delete request times out or takes very longPossible Causes:
  • Large number of associated interviews
  • Storage service is slow or unavailable
  • Database performance issues
Solution:
  • Implement client-side timeout handling
  • Show loading indicator to user
  • Consider async deletion for resumes with many associations
Problem: Resume deleted from database but file remains in storageImpact:
  • Orphaned files consume storage space
  • Not critical as files are inaccessible without database record
Solution:
  • Backend logs warning for investigation
  • Implement periodic cleanup job for orphaned files
  • Contact support if storage costs become concerning

Build docs developers (and LLMs) love