Mayor Bill de Blasio dealt a blow to home-sharing giant Airbnb on Monday, signing a bill that requires substantial and routine reporting from the $31 billion enterprise.

The law, which will take effect in six months, presents one the biggest challenges yet for the short-term rental company — monthly reports to an office that has been penalizing it with increased fervor in one of its most lucrative markets.

The bill was drafted and passed in consultation with the politically powerful Hotel Trades Council, which spent more than $100,000 helping elect City Council members last year and was instrumental in Corey Johnson’s ascension to speaker of the body.

“We are disappointed Mayor de Blasio chose to sign this hotel industry-backed bill instead of defending the needs of middle-class New Yorkers who rely on sharing their home to get by,” Josh Meltzer, regional head of public policy for Airbnb, said in a statement. “While the mayor himself has said regular New Yorkers should not be the target of enforcement, many responsible homeowners are currently facing aggressive, unchecked policing, and are fearful of what will happen under this new legislation.”

The company is considering a lawsuit on the grounds the bill violates internet privacy laws.

The bill was signed two days before the Council is expected to target another modern technology industry. The measures would cap the growth of Uber, Lyft and other for-hire vehicles in New York City.

Under the bill signed on Monday, Airbnb and similar home-sharing enterprises will have to turn over information on their bookings each month to the Mayor’s Office of Special Enforcement, which fines illegal hotels.

The reports would include addresses for each listing and its host, and would indicate whether it is a primary or secondary residence. The information would help enforcement officers identify property owners who are not abiding by city and state laws related to short-term rentals.

The state bars rentals for fewer than 30 days in most apartment buildings, unless the host is present, but exempts one- and two-family homes.

The de Blasio administration has also been targeting single-family homeowners, since the city’s illegal conversion law does not omit them.

Airbnb has cited that enforcement to highlight struggling homeowners, almost all of whom are not white, in ads accusing the City Council and de Blasio administration of robbing them of a way to make ends meet.

At a recent town hall on Staten Island, de Blasio said, “Airbnb has been a challenge around this city but the real culprits are not everyday small homeowners; the real culprits have been some people who have taken advantage of that to try and create hotels … like de facto hotels.”

For each undisclosed listing, Airbnb would be fined up to either $1,500 or the profit on the property — a steep drop from the $25,000 maximum fine in the original bill.

“Maybe we call it the cost of doing business. I think that in terms of those people that continue to violate the law, they will add up and I think it will make a difference,” bill sponsor Carlina Rivera said after the ceremonial bill signing in City Hall.

Rivera has said the bill will protect the city’s rent-stabilized housing stock from being used for tourists — the prevalence of which is difficult to measure because Airbnb has not been required to release any data until now.

“Bad actors continue to choke our affordable housing stock with illegal hotels and our Council has unanimously said release the data and let the city do its job,” she said during the bill signing. “We are going to go after the most egregious operators.”