Updated at 5:57 P.M. PST with comment from Coinbase

SAN FRANCISCO — A federal magistrate judge has ordered Coinbase to comply with a summons from the Internal Revenue Service that seeks personal information on more than 14,000 account holders on the cryptocurrency exchange.

U.S. Magistrate Judge Jacqueline Corley of the Northern District of California in an order dated Tuesday ruled that the IRS had successfully shown that the information it is seeking is relevant to its investigation of whether U.S. taxpayers are significantly underreporting gains from trading bitcoin and other cryptocurrencies.

“That only 800 to 900 taxpayers reported gains related to bitcoin in each of the relevant years and that more than 14,000 Coinbase users have either bought, sold, sent or received at least $20,000 worth of bitcoin in a given year suggests that many Coinbase users may not be reporting their bitcoin gains,” Corley wrote.

According to her judgment, which was entered Wednesday afternoon, Coinbase must turn over the taxpayer ID number, name, birthdate, address, account records and invoices for any account “with at least the equivalent of $20,000 in any one transaction type (buy, sell, send, or receive)” during an annual period between 2013 and 2015.

Coinbase has said in the litigation that those parameters would capture some 14,355 account holders. Corley noted in her order it would not include those who simply bought and held bitcoin during that period of time.

Although the result is a win for the IRS, Corley denied the agency’s demands for a broader swath of records—including copies of passports or driver’s licenses, wallet addresses, and public keys for cryptocurrency wallets.

She wrote that the IRS would only need such information if there is potentially a taxable gain, and if there is some doubt as to the taxpayer’s identity. “If there is not, these additional records will not shed any light on a legitimate investigation,” the judge wrote.

“Courts must ensure that the government is not collecting thousands and thousands of personal records unnecessarily,” she added.

“We are pleased to say Coinbase won a partial victory in court today,” David Farmer, director of communications at Coinbase, said in a blog post Wednesday. “Although the court did not completely quash the government summons compelling disclosure of certain customers’ records … we were proud to accomplish two important victories for our customers.”

In addition to shielding that additional customer information, Farmer said that as a result of Coinbase pushing back against the original summons from the IRS, more than 480,000 of the company’s customers’ records “were preserved from disclosure.” He added that the company is still in the process of reviewing the judge’s order. The lead lawyer for the exchange in the case, Steven Ellis of Goodwin Procter, deferred a request for comment to the company.

The IRS did not immediately respond to a request for comment Wednesday afternoon. It had sought an even broader swath of information on account holders at Coinbase, which claims to have over 5 million users. The case has been seen as one of the first tests of tax authorities’ ability to unmask the identities of holders of cryptocurrency.

Legal challenges are shaping new technologies. And emerging tech, like digital currency, AI and facial recognition, are challenging existing legal frameworks. Peer around the corner with What’s Next, a new briefing on the legal frontiers of technology. Sign up now for a free trial.