W-2 Extraction API for Batch Intake
Extract structured data from w-2s with a single POST request. Built for tax and document-intake teams reviewing W-2 batches who want to automate, not click. Upload a file as multipart form data and receive JSON.
Quick start
cURL
curl -X POST https://w2extractor.com/api/extract \ -H "Authorization: Bearer YOUR_API_KEY" \ -F "file=@w2.pdf"
Python
import requests
with open("w2.pdf", "rb") as source:
response = requests.post(
"https://w2extractor.com/api/extract",
headers={"Authorization": "Bearer YOUR_API_KEY"},
files={"file": source},
timeout=120,
)
response.raise_for_status()
result = response.json()
if not result.get("success"):
raise RuntimeError(result.get("error", "Extraction failed"))
if result.get("needsReview") or result.get("ocrWarning"):
print("Review required:", result.get("needsReview"), result.get("ocrWarning"))
print(result["data"]) # Validate required fields before using them.Node.js
import { readFile } from "node:fs/promises";
const form = new FormData();
form.append("file", new Blob([await readFile("w2.pdf")]), "w2.pdf");
const response = await fetch("https://w2extractor.com/api/extract", {
method: "POST",
headers: { Authorization: "Bearer YOUR_API_KEY" },
body: form,
signal: AbortSignal.timeout(120000),
});
if (!response.ok) throw new Error(`Extraction HTTP ${response.status}`);
const result = await response.json();
if (!result.success) throw new Error(result.error || "Extraction failed");
if (result.needsReview?.length || result.ocrWarning) {
console.warn("Review required:", result.needsReview, result.ocrWarning);
}
console.log(result.data); // Validate required fields before using them.The snippets use Python with requests or Node.js 20+ in an ES module. They surface errors and review flags; they do not automatically approve data. Keep API keys on your server, and do not blindly retry a timed-out extraction. Use the document-specific example and review checklist.
Fields returned
- ✓Wages, tips, other comp (Box 1)
- ✓Federal income tax withheld (Box 2)
- ✓Social Security wages & tax (Boxes 3-4)
- ✓Medicare wages & tax (Boxes 5-6)
- ✓State wages & tax (Boxes 15-17)
- ✓Employer EIN & name
Per-document pricing
No per-page billing. No enterprise minimums.
Confidence signals
Returned configured fields include confidence values to help prioritize review.
Batch & async
Submit many w-2s and poll for results.
FAQ
Is there a w-2 parsing API?
Yes. W-2 Extractor exposes a REST endpoint — POST a w-2 file to /api/extract with your API key and receive structured JSON. No SDK required; it is a standard multipart upload.
How is the w-2 API priced?
By document, not per page. Free includes 3 w-2s; paid plans run from $9/mo (20 docs) to $199/mo (1,000 docs) with full API access on every tier. No per-page surprises and no enterprise minimums.
What does the API return?
A JSON object with the extracted fields (Wages, tips, other comp (Box 1), Federal income tax withheld (Box 2), Social Security wages & tax (Boxes 3-4), and more) and available confidence signals, needsReview flags, and OCR warnings. Review the output before using the dashboard export workflow.
How do I get an API key?
Sign up (free, no credit card), open your dashboard, and copy your key. You can start calling the API within a minute.
Can I process w-2s in batch?
Yes. Use the batch and async endpoints to submit many w-2s at once and poll for results — ideal for high-volume automation.