Generally speaking, there are two types of loans available to you in a 401k. They are called general purpose loans and principal residence loans.
As the name suggests, general purpose 401K loans can be used for any old reason whatsoever; there are no limitations for its use. If you need it to pay for hospital bills that you can’t afford, you can do it. If you need it to pay for your plane tickets to Hawaii, you can do that, too (though we do advise against this).
Principal residence 401K loans, on the other hand, can only be used toward the down payments and closing costs on a primary residence. You cannot use this loan type for remodeling your current home, nor can you use it to purchase a second home or vacation home.
In the case of a principal residence loan it is not uncommon to have to provide proof to either your benefits office or your 401k provider that you are using the money to purchase a primary residence. If you do have to provide proof, you will probably need to provide them a copy of the sales agreement and/or mortgage contract. A good faith estimate signed by both the buyer and seller is also acceptable documentation, though not by itself. It should be accompanied by a sales agreement. Check with your employer since acceptable documentation will vary by plan.
As you can see, with two types of loans available in your 401k, there isn’t much to research. Your best bet is to keep all loans outstanding for as little time as possible if you absolutely must take one.
There are plans that do allow 401k loans for very specific reasons; most likely hardship reasons. Hardship reasons, per the IRS, include: Purchase of primary residence (which would be covered under a principal residence loan if available), prevention of eviction or foreclosure from primary residence, expenses related to post-secondary education (tuition and books, but generally not room and board), and medical expenses NOT covered by insurance. Some plans may also allow additional types that cover expenses related to the damage of a primary residence from natural disasters (created in response to Hurricane Katrina), and funeral expenses.