If you’re lucky enough to be living in one of America’s tourist destinations, you may also be saddled with an astronomical rent or mortgage. No wonder so many residents of places like New York and San Francisco are looking at their abode as a source of income.

Residents looking for extra cash often turn to such short-term rental (STR) platforms as Airbnb, Vrbo, Homeaway and Flipkey. But if you’re considering renting out a spare bedroom, your whole place or just a part of it, here’s what you need to know about keeping your rental legal — and safe.

Related: Landlords: 4 Rental Scams to Avoid

Mistake #1: Violating your lease

Does your lease allow you to sublet or rent out rooms? Read it closely. Even if you’re a model tenant who is also a model Airbnb host, your landlord may not look kindly on you turning his property into a mini-hotel.

Many leases expressly prohibit short-term rentals and/or tenants renting out rooms to anyone who is not on the lease. If you do, landlords can legally boot you and your guests out.

A 62-year-old Airbnb host on Manhattan’s Upper West Side, for example, recently got an eviction notice from her landlord for renting out three of her four bedrooms on Airbnb, which the landlord says violates the terms of her lease. She is now fighting an eviction lawsuit.

Mistake #2: Violating city rental codes

New York City, for example, has a law against renting out rooms to anyone for less than 30 days. In a recent “sting” operation, a New York City council member Linda Rosenthal recently posed as someone looking to rent on Airbnb, as reported on Mashable.

Rosenthal even caught hosts on video warning her not to mention Airbnb to anyone else in the building, management companies posting as tenants, and entire rental buildings being run as illegal short-term hotels,” reported Brick Underground: The Insiders’ Guide to NYC Real Estate. “In other words, her findings confirmed everyone's worst fears about Airbnb's potential adverse affects on the city's rental market.”

In addition, if hosts for Airbnb or another short-term rental platform are caught, cities can levy a heavy fine. In San Francisco, short-term rentals are limited to 90 days per year when the owner is not present. Exceeding that limit results in a $416-a-day fine for the first offense. Thereafter, the fine rises to $1,000 a day. In New York City, officials can fine you up to $5,000 for the first offense.

Related: 7 Costly Money Mistakes and How to Avoid Them

Mistake #3: Not reporting your rental income

It’s not hard for the IRS to figure out that you’re making money on your rental, especially since your property is advertised on a website.

If you rent your home for fewer than 15 days during the year, you don’t need to report that to the IRS. But rent for 15 days or more, and yes, you do have to report and pay taxes on that income.

In addition, you may also need to pay state taxes. In California, you have to collect state taxes for each short-term rental unless your renter stays for more than 30 days.

Cities often levy their own taxes. New York City requires a 5.875 percent hotel tax, and both San Francisco and Santa Monica collect a whopping 14 percent hotel tax on every stay under 30 days.

Mistake #4: Pushing out long-term tenants to do short-term rentals

In places like San Francisco, where housing is tight and up to 25 percent of available rental units have been swallowed up by Airbnb and other short-term rentals, city officials are active against landlords who push out long-term tenants in favor of short-term rentals.

The city of San Francisco recently levied a penalty of $276,000 in the settlement of a lawsuit it filed against two landlords for evicting rent-controlled tenants and using their apartments for guests from Vrbo, HomeAway and Airbnb.

Mistake #5: Not fixing safety hazards

If you do decide it’s legal for you to rent your place (or you decide to take a chance anyway), don’t forget to address any safety hazards in the midst of all that de-cluttering, cleaning and buying nice linens and towels.

Start by walking around with a critical eye to accidents in the making. All the stairs, inside and out, should have railings. Fix any exposed wires or broken outlets, and make sure your climate control buttons work. Eliminate any trip and fall risks. Remember when one of your friends tripped on a raised brick in the walkway leading to your side door, the very door the travelers will use? Get on that now or risk legal problems later. 

Related: Ask the Expert: Home Inspections

Mistake #6: Ditching the protections of your short-term hosting contract 

One Airbnb host in Watsonville, Calif., learned this the hard way. Poonam Sandhu rented out the master bedroom in her house to two Airbnb guests for a short period of time but soon found herself in a rental nightmare, according to a story in the San Francisco Chronicle. The guests asked her if they could pay in cash to save on Airbnb fees after their reservation ran out, but soon afterwards they stopped paying rent and refused to leave. Because Sandhu was no longer covered by Airbnb insurance designed to cover homeowners in the event of such a travesty, she has moved out of her home while her attorney begins the lengthy process of evicting the “tenants.”

Ana Manley-Black, J.D., is a former immigration attorney and a freelance health and medical writer whose stories have appeared in Healthday, Consumer Health Interactive, and other media.