Many government agencies now allow individuals and the immigration lawyers that represent them to file a request under the Freedom of Information Act (FOIA) online. This Act states that any person has a right to obtain access to federal agency records (except when protected under one of the 9 exemptions or a law enforcement exclusion).
A FOIA request is used in many different situations when a person wants to view a copy of their records with a particular agency. For example, a person might have been stopped from entering the U.S. border by CBP a few years ago, but doesn’t know if they were issued a removal order. A deportation lawyer would often file a request with CBP (and possibly USCIS and DOS), to obtain a complete copy of the file. This way an immigration attorney and the client knows what the government knows. Or someone might have applied for a visitor visa or an E-2 investor visa at a consulate and gotten denied. Filing a FOIA with the Department of State, might help determine the cause for the denial (did they suspect fraud, did they not think the person had temporary intent, or whatever else the reason might have been).
There are currently 111 separate FOIA offices (across various governmental agencies and departments), that offer the ability to file an online request. Here is the link to the FOIA request form for various agencies.