While Trump's tweets are viewable to the public, the company also holds non-public information on accounts like direct messages, drafts of tweets, location data and the type of device used to send tweets.
The opinion said the warrant was related to Smith's investigation into the events surrounding the Jan. 6, 2021, siege on the U.S. Capitol by supporters of Trump while he was still president.
Trump last week pleaded not guilty to an indictment that charged him with plotting to overturn his November 2020 election loss to Democrat Joe Biden. He is the front-runner for the Republican 2024 presidential nomination.