Skip to content

Finance & accountingUS W-2 EFW2

efw2.validate

Check a tax-year 2026 SSA, Maryland or Pennsylvania EFW2 file against the published format and reconcile its count and money totals. Price per employee-state, based on complete fixed-width records with an employee identity.

POSThttps://api.kanagu.dev/v1/efw2/validate
Price
$0.15 per employee-state, on successful calls only
Authentication
API key required.
MCP
call_operation with operation: "efw2.validate" at https://api.kanagu.dev/mcp

Compliance coverage

Jurisdictions
Jurisdictions: US
Standards
  • SSA Publication 42-007Tax year 2026, version 42026-11-12Source
  • Maryland Employer Reporting of W-2s Instructions and SpecificationsTax year 2026, version 1.02026-09-27Source
  • Pennsylvania myPATH W-2 Wage Records (EFW2)Undated web specification, snapshot 2026-11-262026-11-26Source
  • 26 CFR § 1.224-1(h), Table 1TD 100442026-04-13Source
Verification
efw2.generate checks generated files and efw2.validate checks submitted files locally against published fixed-width, sequence, field and total rules.
Last reviewed
2026-11-26
curl https://api.kanagu.dev/v1/efw2/validate \
  -H "Authorization: Bearer $KANAGU_KEY" \
  -H "Content-Type: application/json" \
  -d '{"destination":"SSA","text":"RA"}'
const res = await fetch("https://api.kanagu.dev/v1/efw2/validate", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.KANAGU_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "destination": "SSA",
    "text": "RA"
  }),
});
if (!res.ok) throw new Error((await res.json()).error.message);
const result = await res.json();
curl https://api.kanagu.dev/mcp \
  -H "Authorization: Bearer $KANAGU_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"call_operation","arguments":{"operation":"efw2.validate","input":{"destination":"SSA","text":"RA"}}}}'
Request body
{
  "destination": "SSA",
  "text": "RA"
}

Request body

application/json

destination"SSA" | "MD" | "PA"
textstring (max 2100000 chars)required

Response

200 · application/json

status"pass" | "invalid" | "needs_review"required
findingsarray of objectrequired
findings[].severity"error" | "needs_review"required
findings[].destination"SSA" | "MD" | "PA"required
findings[].rulestringrequired
findings[].lineinteger (≤ 9007199254740991)
findings[].columninteger (≤ 9007199254740991)
findings[].inputstring
findings[].fieldstringrequired
findings[].expectedstringrequired
findings[].actualstringrequired
findings[].sourcestring (uri)required
billableEmployeeStatesinteger (0 to 9007199254740991)required
verificationobjectrequired
verification.method"published_specification"required
verification.agencyPortal"not_run"required
verification.standardsarray of objectrequired
verification.standards[].namestringrequired
verification.standards[].versionstringrequired
verification.standards[].datestring (date)required
verification.standards[].urlstring (uri)required
recordCountinteger (0 to 9007199254740991)required
employerCountinteger (0 to 9007199254740991)required
employeeCountinteger (0 to 9007199254740991)required
stateRecordCountinteger (0 to 9007199254740991)required
omittedFindingsinteger (0 to 9007199254740991)required

Try it

efw2.validate

$0.15/employee-state

 

Response

Run the request to see the live response here.

Errors

Errors are JSON {"error":{"code","message"}}. An operation may add its own 400 codes; the message says what to fix.

StatusCode and meaning
400invalid_input

The body does not match the request schema. The message names each field.

400invalid_json

The body is missing or is not valid JSON.

400invalid_idempotency_key

Idempotency-Key must be 1–128 visible ASCII characters.

401invalid_api_key

The Bearer key is missing, malformed, invalid or inactive.

402free_allowance_exhausted

This month's free usage is used up and the account has no subscription. Subscribe from the dashboard, or wait for the next UTC month; Retry-After gives the seconds left.

404not_found

No operation at this path.

409idempotency_conflict

The Idempotency-Key was already used with a different body.

413payload_too_large

JSON bodies may be at most 64 KiB.

500internal_error

The call failed on our side. It is not billed; retry with the same Idempotency-Key.

JSON Schema

Request schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "destination": {
      "default": "SSA",
      "type": "string",
      "enum": [
        "SSA",
        "MD",
        "PA"
      ]
    },
    "text": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2100000
    }
  },
  "required": [
    "text"
  ],
  "additionalProperties": false,
  "examples": [
    {
      "destination": "SSA",
      "text": "RA"
    }
  ]
}
Response schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "enum": [
        "pass",
        "invalid",
        "needs_review"
      ]
    },
    "findings": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "severity": {
            "type": "string",
            "enum": [
              "error",
              "needs_review"
            ]
          },
          "destination": {
            "type": "string",
            "enum": [
              "SSA",
              "MD",
              "PA"
            ]
          },
          "rule": {
            "type": "string"
          },
          "line": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "column": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "input": {
            "type": "string"
          },
          "field": {
            "type": "string"
          },
          "expected": {
            "type": "string"
          },
          "actual": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "severity",
          "destination",
          "rule",
          "field",
          "expected",
          "actual",
          "source"
        ],
        "additionalProperties": false
      }
    },
    "billableEmployeeStates": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "verification": {
      "type": "object",
      "properties": {
        "method": {
          "type": "string",
          "const": "published_specification"
        },
        "agencyPortal": {
          "type": "string",
          "const": "not_run"
        },
        "standards": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              },
              "date": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
              },
              "url": {
                "type": "string",
                "format": "uri"
              }
            },
            "required": [
              "name",
              "version",
              "date",
              "url"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "method",
        "agencyPortal",
        "standards"
      ],
      "additionalProperties": false
    },
    "recordCount": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "employerCount": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "employeeCount": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "stateRecordCount": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "omittedFindings": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    }
  },
  "required": [
    "status",
    "findings",
    "billableEmployeeStates",
    "verification",
    "recordCount",
    "employerCount",
    "employeeCount",
    "stateRecordCount",
    "omittedFindings"
  ],
  "additionalProperties": false
}