Overview
The W2 model extracts and structures information from W2 tax forms, including employee and employer information, wage data, and tax withholdings.Schema Structure
Form Metadata
| Field | Type | Description |
|---|---|---|
W2FormVariant | string? | Type of W2 form |
TaxYear | string? | Tax year of the form |
W2Copy | string? | Copy type of the W2 |
ControlNumber | string? | Form control number |
Employee Information
| Field | Type | Description |
|---|---|---|
Employee.SocialSecurityNumber | string? | Employee SSN |
Employee.Name | string? | Employee’s full name |
Employee.Address | string? | Employee’s address |
Employer Information
| Field | Type | Description |
|---|---|---|
Employer.IdNumber | string? | Employer’s identification number |
Employer.Name | string? | Employer’s name |
Employer.Address | string? | Employer’s address |
Wage and Tax Information
| Field | Type | Description |
|---|---|---|
WagesTipsAndOtherCompensation | number? | Total wages, tips, and compensation |
FederalIncomeTaxWithheld | number? | Federal income tax withheld |
SocialSecurityWages | number? | Social security wages |
SocialSecurityTaxWithheld | number? | Social security tax withheld |
MedicareWagesAndTips | number? | Medicare wages and tips |
MedicareTaxWithheld | number? | Medicare tax withheld |
SocialSecurityTips | number? | Social security tips |
AllocatedTips | number? | Allocated tips |
DependentCareBenefits | number? | Dependent care benefits |
NonQualifiedPlans | number? | Non-qualified plans |
VerificationCode | string? | W2 form verification code |
Status Flags
| Field | Type | Description |
|---|---|---|
IsStatutoryEmployee | boolean? | Statutory employee status |
IsRetirementPlan | boolean? | Retirement plan status |
IsThirdPartySickPay | boolean? | Third party sick pay status |
Other | string? | Other information |
Additional Information
Each entry in theAdditionalInfo array contains:
| Field | Type | Description |
|---|---|---|
LetterCode | string? | IRS W2 box 12 letter code |
Amount | number? | Code amount |
State Tax Information
Each entry in theStateTaxInfos array contains:
| Field | Type | Description |
|---|---|---|
State | string? | Two letter state code |
EmployerStateIdNumber | string? | Employer state ID number |
StateWagesTipsEtc | number? | State wages and tips |
StateIncomeTax | number? | State income tax |
Local Tax Information
Each entry in theLocalTaxInfos array contains:
| Field | Type | Description |
|---|---|---|
LocalWagesTipsEtc | number? | Local wages and tips |
LocalIncomeTax | number? | Local income tax |
LocalityName | string? | Locality name |
Type Definitions
Validation Rules
Basic Validation
- All fields are optional by default
- Arrays (AdditionalInfo, StateTaxInfos, LocalTaxInfos) default to empty arrays if not specified
Strict Validation
The following fields are required in strict mode:- TaxYear
- Employee.Name
- Employee.SocialSecurityNumber
- Employer.Name
- Employer.IdNumber
- WagesTipsAndOtherCompensation
- FederalIncomeTaxWithheld
Example Usage
Best Practices
- Always validate W2 forms:
- Access data through the result property:
- Handle optional fields appropriately:
- Check arrays before processing:
- Verify required fields in strict mode: