← Blog

How to Build a Resume Parser with the Claude API

2026-11-15 · 6 min read · SubToAPI Team

Parsing resumes reliably has always been a messy problem. Candidates submit PDFs, Word docs, scanned images, and plain text, each with wildly different layouts. Traditional resume parsers rely on regex and keyword matching, which breaks the moment someone formats their work history in a table or uses non-standard section headers. The Claude API solves this differently: instead of writing brittle extraction rules, you send the resume text (or image) to the model with a schema, and it returns structured JSON you can store directly in your database.

This tutorial walks through building a working resume parser with Claude — from raw file to structured candidate data — including prompt design, schema enforcement, and handling the quirks of real-world resumes (missing dates, multiple languages, inconsistent formatting).

Why Claude for resume parsing

Resumes are unstructured by nature, but the information inside them — name, contact details, work history, education, skills — is highly structured. This is exactly the kind of extraction task large language models are good at: they understand semantic meaning ("Senior Backend Engineer" is a job title even if it's not labeled as one), and they can normalize inconsistent formats (dates like "Jan 2021 – Present" vs "01/2021-now") into a single schema.

Claude in particular handles long documents well, which matters for multi-page resumes or CVs with extensive publication lists, and it's consistent at following JSON schemas when you give it clear instructions and a few examples.

Step 1: Extract raw text from the resume file

Before you can send anything to the API, you need plain text. For PDFs, use a library like pdf-parse (Node) or pdfplumber (Python). For DOCX files, mammoth or python-docx work well. Scanned/image resumes need OCR first (Tesseract or a vision model).

import fs from "fs";
import pdf from "pdf-parse";

async function extractText(filePath) {
  const buffer = fs.readFileSync(filePath);
  const data = await pdf(buffer);
  return data.text;
}

Keep this extraction step separate from the LLM call — it makes debugging much easier when something goes wrong, since you can inspect the raw text independently of the model's output.

Step 2: Define the output schema

Decide exactly what fields you need before writing the prompt. A typical resume parsing schema looks like this:

{
  "full_name": "string",
  "email": "string | null",
  "phone": "string | null",
  "location": "string | null",
  "summary": "string | null",
  "skills": ["string"],
  "work_experience": [
    {
      "company": "string",
      "title": "string",
      "start_date": "string | null",
      "end_date": "string | null",
      "description": "string"
    }
  ],
  "education": [
    {
      "institution": "string",
      "degree": "string",
      "field": "string | null",
      "graduation_year": "string | null"
    }
  ]
}

Being explicit about nullable fields matters — resumes frequently omit information, and you don't want the model inventing an email address or graduation year that isn't there.

Step 3: Write the extraction prompt

Put the schema directly in the system prompt and instruct the model to return only JSON, nothing else. Few-shot examples aren't strictly required for this task, but adding one example of a tricky case (overlapping job dates, non-English resume, missing contact info) improves consistency.

const systemPrompt = `You are a resume parsing engine. Extract structured data from the resume text below and return ONLY valid JSON matching this schema:

${JSON.stringify(schema, null, 2)}

Rules:
- If a field is missing, use null (or an empty array for lists).
- Normalize all dates to "YYYY-MM" format where possible.
- Do not invent information that isn't in the resume text.
- Return raw JSON only, no markdown formatting, no explanation.`;

Step 4: Call the API and validate the output

Here's a complete request using SubToAPI, which proxies Claude through a standard HTTPS endpoint with your own sub_live_... key — useful if your team already shares one Claude subscription and needs per-app API access without separate accounts:

curl https://api.subtoapi.app/v1/messages \
  -H "Authorization: Bearer $SUBTOAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-5",
    "max_tokens": 2000,
    "system": "You are a resume parsing engine...",
    "messages": [
      { "role": "user", "content": "Resume text:\n\n[raw resume text here]" }
    ]
  }'

Once you get the response, parse the JSON and validate it against your schema before writing to the database. Don't trust the output blindly — even well-prompted models occasionally wrap JSON in markdown fences or add a trailing comment.

function parseModelOutput(rawText) {
  const cleaned = rawText.replace(/```json|```/g, "").trim();
  try {
    return JSON.parse(cleaned);
  } catch (err) {
    throw new Error("Model returned invalid JSON: " + rawText.slice(0, 200));
  }
}

Running this against a batch of real resumes early is important — it will surface formatting edge cases (European date formats, resumes with no clear "experience" section, functional resumes organized by skill rather than job) that you'll want to address in the prompt before going to production.

Step 5: Handle scale and reliability

If you're parsing resumes in bulk — say, an ATS importing a candidate pipeline — batch the requests with a concurrency limit rather than firing hundreds at once. Add retry logic for transient failures, and log both the raw extracted text and the model's JSON output for every resume so you can audit mistakes later.

For production use, request streaming (/docs/streaming) isn't necessary here since you need the full JSON object before you can parse it — this is a case where a single non-streamed response is simpler and more reliable than reading tokens as they arrive.

Step 6: Add structured output guardrails

A few practical additions that make the parser more robust:

This same pattern — raw text in, schema out — works for invoices, contracts, and other semi-structured documents too; the resume-specific part is mostly the schema and the prompt rules around dates and missing fields.

If you're already running Claude through SubToAPI for other parts of your product, adding a resume parsing endpoint is just another call to the same /v1/messages endpoint (/docs/messages) — no separate integration needed, and usage shows up alongside your other requests in the dashboard for cost tracking.

Getting started

Check /docs/quickstart for setting up your first API key, and /pricing if you're evaluating plans — the Solo tier at €9/month is enough for most side projects and small ATS integrations, while Team and Scale add seats for larger engineering teams building this kind of pipeline together.

Questions

Can Claude parse resumes directly from PDF without text extraction? Not reliably for plain text models — you need to extract text first (or use a vision-capable call for scanned/image resumes). Text extraction plus a structured prompt is the most consistent approach for digital PDFs and DOCX files.

How accurate is LLM-based resume parsing compared to regex-based parsers? For varied, real-world resumes, LLM extraction is significantly more accurate because it understands context rather than matching fixed patterns. It still needs validation logic and occasional human review for low-confidence fields.

What's the best way to handle resumes in multiple languages? Decide upfront whether you want extracted fields translated to a single language or kept as-is, and state that explicitly in the prompt. Claude handles multilingual input well but needs clear instructions on your preferred output language.

Turn your Claude access into an HTTPS API

SubToAPI gives you application API keys, streaming, tool use and usage insights on top of your existing Claude access — set up in minutes.

Start free  Read the quickstart →