Endpoints
Get Upload Page
Retrieve the document upload page for a session.
Path Parameters
The unique identifier of the interview session.
Response
Returns an HTML page with upload forms for CV and job description.Example Request
Error Responses
- 403 Forbidden: “You don’t have access to this session”
- 404 Not Found: Session does not exist
Upload CV
Upload a CV file for text extraction and analysis.
Path Parameters
The unique identifier of the interview session.
Request Parameters
The CV file to upload. Supported formats:
- PDF (.pdf)
- Microsoft Word (.docx)
- Plain text (.txt)
Response
Redirects back to the upload page with a success or error message.Whether the upload was successful.
Success or error message.
Extracted text from the CV (minimum 50 characters required).
Example Request
Success Response
Error Responses
Returned when the file is invalid or cannot be processed.
Error message.
- “No file was uploaded”
- “CV seems too short. Please upload a complete CV (at least 50 characters)”
- “Unsupported file format”
- “Could not read file: [parsing error details]“
Upload Job Description
Submit the job description text for interview preparation.
Path Parameters
The unique identifier of the interview session.
Request Parameters
The complete job description text.
- Minimum: 50 characters
- Maximum: 10,000 characters
Response
Redirects back to the upload page with a success or error message.Whether the submission was successful.
Success or error message.
Example Request
Success Response
Error Responses
Example Errors:- “Job description cannot be empty”
- “Job description seems too short. Please provide a complete job description (at least 50 characters)”
- “Job description too long (max 10,000 characters)“
Supported CV File Formats
The API supports the following CV file formats:Portable Document Format. Text is extracted using pdfplumber.
Microsoft Word document. Text is extracted using python-docx.
Plain text file with UTF-8 encoding.
Document Processing
CV Processing Pipeline
- Upload: File is received via multipart form-data
- Storage: Temporarily saved to the server’s upload folder
- Extraction: Text is extracted based on file format:
- PDF: Uses pdfplumber to extract text from all pages
- DOCX: Uses python-docx to read paragraphs and tables
- TXT: Direct UTF-8 text reading
- Validation: Ensures extracted text is at least 50 characters
- Save: Text is stored in the session’s
cv_textfield - Cleanup: Original file is deleted from server
Job Description Processing
- Receive: Text submitted via form field
- Validation:
- Strips whitespace
- Checks minimum length (50 characters)
- Checks maximum length (10,000 characters)
- Save: Text is stored in the session’s
job_description_textfield
Validation Rules
CV Upload
A file must be included in the request.
Extracted text must be at least 50 characters.
Must be PDF, DOCX, or TXT format.
Job Description
Cannot be empty or whitespace-only.
Must be at least 50 characters.
Cannot exceed 10,000 characters.
Error Handling
HTTP Status Codes
- 302 Found: Successful redirect after upload
- 400 Bad Request: Validation error
- 403 Forbidden: Unauthorized session access
- 404 Not Found: Session not found
- 500 Internal Server Error: File processing error
Flash Messages
Success and error messages are displayed via Flask flash messages: Success Messages:- “CV uploaded and processed successfully!”
- “Job description saved successfully!”
- “No file was uploaded”
- “CV seems too short. Please upload a complete CV (at least 50 characters)”
- “Could not read file: [error details]”
- “Job description cannot be empty”
- “Job description seems too short. Please provide a complete job description (at least 50 characters)”
- “Job description too long (max 10,000 characters)”
- “Session not found”
Workflow Integration
The Documents API is the second step in the interview preparation workflow:- Create Session (Sessions API)
- Upload Documents (Documents API) ← You are here
- Conduct Interview (Interviews API)
- Receive Feedback (Feedback API)
is_ready_for_interview() method and will redirect back to the upload page if either is missing.