A masked SSN in API responses shows only the last four digits, such as XXX-XX-1234, so the full number never reaches your logs, database or downstream tools. You can still use those four digits, together with a name, a form type and a tax year, to match a form to the right person in your records.
Why do APIs return a masked SSN instead of the full number?
APIs return a masked SSN so that the full Social Security number does not spread into every system that touches the response. A JSON body gets logged, cached, copied into a database, exported to a spreadsheet and sent to an analytics tool. Each copy of a full SSN is a copy someone could steal.
Think about where a response goes after your code receives it. Request logs often store bodies for debugging. Error trackers capture payloads when something fails. A data warehouse pulls nightly copies. Support staff open records to answer tickets. If the number is masked at the source, none of those places ever holds the full value, and none of them needs special protection for it.
Masking also matches what many tax forms already do on paper. The IRS General Instructions for Certain Information Returns let filers truncate a payee's TIN on most payee statements by replacing the first five digits with asterisks or Xs. The IRS General Instructions for Forms W-2 and W-3 say employers may truncate the employee's SSN on employee copies of Form W-2. A form the user uploads may arrive already masked.
The same IRS rules set a limit. Truncation is not allowed on copies filed with the IRS, and the W-2 instructions say not to truncate the SSN on Copy A. Masking is a choice for statements and data that people handle, not a substitute for the full number where the law requires it.
Schema Tax masks SSNs and TINs to the last four digits before anything is written to storage, as its security section states. The policy reasons behind that kind of choice are covered in the post on SSN masking in documents.
What formats does a masked SSN in API responses use?
A masked SSN in API responses usually takes one of three forms: a string that keeps the dashes with Xs or asterisks in front, such as XXX-XX-1234, a separate field that holds only the last four digits, or both. Employer and payer numbers follow their own pattern and are often left whole.
The full patterns come from the IRS. The IRS Instructions for Forms 1099-MISC and 1099-NEC say SSNs, ITINs and ATINs use the XXX-XX-XXXX format and EINs use XX-XXXXXXX. Those same instructions say a payer's TIN may not be truncated on any form, so the payer or employer number on a 1099 or W-2 usually appears in full.
A string that keeps the original shape is easy to display and tells a reader at once that the value is masked. A separate last-four field is easier to match on, because your code does not have to strip characters first. Some APIs also return a type, such as SSN, ITIN or EIN, so you know which pattern applies.
Masking formats and what each allows
The values below are examples, not real numbers. The response shapes are illustrative; Schema Tax has no published API reference, so read them as patterns a service might use.
| Format | Example value | What it allows you to match |
|---|---|---|
| Masked string with Xs | XXX-XX-1234 | Display; last four after stripping |
| Masked string with asterisks | ***-**-1234 | Display; last four after stripping |
| Last-four field | "ssn_last4": "1234" | Direct match on last four with other keys |
| Masked string plus type | "tin": "XXX-XX-1234", "tin_type": "SSN" | Last four, and whether it is an SSN, ITIN or EIN |
| Full EIN for a payer | XX-XXXXXXX, all nine digits shown | Exact match to a known employer or payer |
| Full SSN | XXX-XX-XXXX, all nine digits shown | Exact match; also full exposure in every copy |
Store whichever format arrives exactly as received. Do not try to reconstruct missing digits from other sources and merge them in, because that recreates the full number the masking was meant to keep out.
Matching records with a masked SSN in API responses
Matching records with a masked SSN in API responses means pairing the last four digits with other keys, because four digits alone are not unique. Among your users, two people can share the same last four. Add the name, the form type, the tax year and the payer or employer TIN, and a match becomes reliable.
Four digits give 10,000 possible values. In any group of a few hundred people, a repeat is likely, and in a larger user base it is certain. A match on last four alone will, sooner or later, attach one person's W-2 to another person's account.
Build the match key from several fields. A good set for tax forms is the last four digits, the recipient's name, the form type, the tax year and the full employer or payer TIN. Two people with the same last four rarely share a name and an employer in the same year.
Here is a fictional example. An app has two users whose SSNs end in 1234: Dana Example and Jordan Sample. An uploaded W-2 comes back with XXX-XX-1234, the name "Dana Example" and the full EIN of Lumen Works LLC, a fictional employer already on Dana's record. Last four matches both users; name and employer match only Dana. The form goes to Dana's record.
Context helps too. If the upload happened inside a signed-in session, the account is already known, and the masked digits become a check rather than a search. A mismatch, such as last four of 5678 on a form uploaded by a user whose records end in 1234, is a reason to ask the user before saving.
When no combination gives one clear match, send the record to a person. A wrong match is worse than a delay.
When a masked SSN in API responses is not enough
A masked SSN in API responses falls short when a process truly needs the full number: filing a return, sending a form to the IRS, or verifying identity with an agency. In those cases, collect the full number through a separate, narrow path, keep it apart from the extraction data, and limit who can read it.
The IRS rules above show the line. Copies filed with the IRS carry the full TIN, and Copy A of a W-2 carries the full SSN. If your product files forms, it needs the full value somewhere.
Keep that path separate. Ask the user to enter the full number in a dedicated field, or get it from a system built to hold it, and store it in its own encrypted store with tight access. Your extraction results, logs and analytics keep the masked value. Only the service that files or verifies reads the full one.
Do not route full numbers through a pipeline designed for masked ones. If you add a full SSN to the same JSON record, it flows into every log and copy the masking was protecting.
For most uses, such as showing a user their own form, matching documents to accounts or building a spreadsheet of amounts, the last four digits are enough. Masked identifiers also sit beside other review signals in a response; the post on confidence scores in document extraction covers the flags on uncertain values, and the post on what a tax form extraction API returns shows a full response.