Parse a Resume to JSON in Node.js
Node 18's native fetch and FormData cover the whole integration: no axios, no form-data package, no SDK required (though one exists). Upload, poll, read fields.
To parse a resume in Node.js, send the file as multipart form data to the SharpAPI parse_resume endpoint, then poll the returned status URL until the job reports success. Native fetch handles both calls; the result is 50+ structured candidate fields.
The whole flow, native fetch
import { readFile } from 'node:fs/promises';
const API_KEY = process.env.SHARP_API_KEY;
const headers = { Authorization: `Bearer ${API_KEY}` };
// 1. Submit — 202 Accepted + status URL, immediately
const form = new FormData();
form.append('file', new Blob([await readFile('resumes/candidate.pdf')]), 'candidate.pdf');
form.append('language', 'English');
const submit = await fetch('https://sharpapi.com/api/v1/hr/parse_resume', {
method: 'POST',
headers,
body: form,
});
const { status_url } = await submit.json();
// 2. Poll — jobs typically finish in seconds
let job;
do {
await new Promise((resolve) => setTimeout(resolve, 2000));
job = await (await fetch(status_url, { headers })).json();
} while (job.data.attributes.status === 'pending');
const candidate = job.data.attributes.result;
console.log(candidate.candidate_name);
candidate.positions.forEach((role) =>
console.log(`- ${role.position_name} @ ${role.company_name}`),
);
Or take the npm package
@sharpapi/sharpapi-node-parse-resume (built on @sharpapi/sharpapi-node-core) wraps the same flow with rate limiting and typed DTOs — worth it once resume parsing stops being a one-off script.
Typing the response
The schema is deterministic — every parse returns the same structure, with empty values where the document lacks data. That makes TypeScript pleasant: one interface, written once against the sample payload, describes every response your pipeline will ever see. Start from the field reference.
Production notes
- Webhooks over polling. Register a webhook URL at submission and delete the do-while loop — one Express route receives every result. Mandatory reading before a backfill: bulk resume parsing.
- Scans included. JPG, PNG and TIFF files go through the identical call — OCR runs server-side.
- Errors are statuses. A corrupt or password-protected file resolves to a failed status, not a hang; branch on it and keep the queue moving.
Questions, answered
Is there an npm package for SharpAPI resume parsing?
Yes — @sharpapi/sharpapi-node-parse-resume, built on @sharpapi/sharpapi-node-core. Plain fetch with FormData works too; the API is standard multipart REST.
Which Node.js version do I need?
Node 18 or newer gives you native fetch, FormData and Blob — no request libraries needed. Older versions work with undici or form-data packages.
Can I type the response in TypeScript?
Comfortably — the schema is deterministic, so one interface describes every response. Fields the resume lacks come back empty rather than missing, which keeps the types honest.