Skip to main content
This endpoint accepts a PDF file and extracts its text content using the SmartPDFParser library. It’s the first step in the resume processing pipeline.

Endpoint

POST /api/parse-resume

Request

This endpoint accepts multipart/form-data with a file upload.
file
file
required
PDF file to parse. Must be a valid PDF with application/pdf MIME type. Maximum file size is 5MB.

Response

numpages
number
Total number of pages in the PDF
numrender
number
Number of pages rendered during parsing
info
object
PDF metadata including title, author, creation date, and other document properties
metadata
object
Additional metadata from the PDF document
text
string
Extracted text content from the PDF
version
string
PDF version number

Example

curl -X POST https://wrkks.vercel.app/api/parse-resume \
  -H "Content-Type: multipart/form-data" \
  -F "[email protected]"

Response

{
  "numpages": 2,
  "numrender": 2,
  "info": {
    "Title": "John Doe Resume",
    "Author": "John Doe",
    "CreationDate": "D:20230115120000Z"
  },
  "metadata": null,
  "text": "John Doe\nSoftware Engineer\nSan Francisco, CA\n...",
  "version": "1.7"
}

Error responses

msg
string
Error message describing what went wrong
details
string
Additional error details (only present in 500 errors)

400 Bad Request

Returned when the uploaded file is not a valid PDF:
{
  "msg": "Please upload a valid PDF file"
}

413 Payload Too Large

Returned when the PDF file exceeds the 5MB limit:
{
  "msg": "File too large for instant parsing (Max 5MB)"
}

500 Internal Server Error

Returned when PDF parsing fails:
{
  "msg": "Failed to parse PDF",
  "details": "Error message from parser"
}

Implementation

The endpoint uses pdf-parse-new with the SmartPDFParser configured for serverless environments:
const parserInstance = new SmartPDFParser({
  oversaturationFactor: 1.5,
  enableFastPath: true,
  forceMethod: "batch",
});
Source: /app/api/parse-resume/route.ts:14-21

Build docs developers (and LLMs) love