A New York City law that required food delivery platforms including DoorDash Inc. to share customer data with restaurants at their request was ruled unconstitutional Wednesday by a federal appeals court.

The law violates the First Amendment rights of the delivery platforms by compelling the disclosure of their customers’ information, the US Court of Appeals for the Second Circuit said in a ruling affirming a lower court’s judgment.

The US District Court for the Southern District of New York in 2024 permanently enjoined the law after granting summary judgment to DoorDash, Grubhub Inc., and Portier LLC, which does business …