DoorDash is suing New York City over a new law that requires delivery companies to share customer data with restaurants.

The lawsuit filed Wednesday is the latest in a string of legal tussles between delivery companies and local governments, reflecting unease over the phenomenal growth of delivery and its impact on restaurants.

Last week, DoorDash, Grubhub and Uber Eats sued New York over a separate bill that caps fees delivery companies can charge to restaurants. DoorDash and Grubhub are also suing San Francisco over fee caps adopted there.

In its new lawsuit, DoorDash says an ordinance passed by the New York City Council in late July is unconstitutional and violates customer privacy. Under the law, delivery companies must share data collected on customers — including names, addresses, phone numbers and order contents — with any restaurant that requests that information. Customers can opt out and keep their information private, but only on an order-by-order basis.

“In an era of heightened concerns about data privacy and identity theft, this compelled disclosure is a shocking and invasive intrusion of consumers’ privacy,” the San Francisco company said in its court filing. The company noted that in-person diners would never be asked to share the same information with restaurants.

But many restaurants — fed up with delivery fees and lack of transparency — supported the bill. The NYC Hospitality Alliance, which represents 25,000 bars and restaurants in New York, says the bill ensures that restaurants can market directly to their customers. The law also makes it easier for restaurants to leave delivery platforms without losing access to their customers.

“DoorDash spends millions of dollars to take restaurants’ customers and withhold their information so they can control the market and extract more fees from small businesses," said Andrew Rigie, the executive director of the alliance.

Delivery companies saw big sales gains over the last year as pandemic lockdowns closed restaurant dining rooms and more people ate at home. DoorDash booked a record 345 million orders in its most-recent quarter, and its sales jumped 83% from the prior year to $1.24 billion.

Delivery companies say they help restaurants by connecting them to diners and handling tricky logistics. But their commission fees, which can be as high as 30% per order, have cut into the already thin margins of restaurant owners in an unprecedented era. The National Restaurant Association estimates 90,000 U.S. restaurants have closed permanently or long-term because of the pandemic.

That relationship between delivery companies got more scrutiny from local lawmakers as the pandemic wore on. Dozens of cities passed temporary fee caps. In July, Massachusetts sued Grubhub, claiming it charged restaurants illegally high fees during the pandemic. And last month, Chicago sued DoorDash and Grubhub, accusing them of deceptive business practices, including delivering from restaurants without their consent. Both companies denied those claims.