Whether or not an in-law apartment is allowed depends on exactly what type of structure you want to construct and what the zoning rules are for the area where you live. If the in-law apartment is considered to be a separate residence, which is usually defined as one with a kitchen or one which could be rented out, then adding one may be considered the conversion of your one family home into a two-family home. Whether or not this conversion is allowed will depend on whether your area is or is not zoned for two family homes.
How can zoning rules affect my construction decisions?
Zoning rules are set on a local level, so every different area may have slightly different zoning rules regarding whether an in-law apartment is or is not allowed. If you are just adding a few rooms to your existing house by finishing the basement and installing a kitchen, then you should face fewer zoning restrictions that you would if you wanted to turn your existing house into a duplex or if you wanted to build a separate small cottage in the backyard.
It’s a good idea to check the zoning rules before you begin working on the in-law apartment so you don't find yourself in violation of the regulations. If the zoning rules in your area would prohibit an in-law apartment from being built, you may be able to get an exception (often referred to as a "special use permit") through a petition to the zoning board and/or with the approval of your neighbors. Alternatively, you can change the scope of your project if the type of in-law apartment you intend to construct isn’t permitted.
The best resource for information about the zoning laws is a real estate attorney in your local area. Your lawyer can also help you if you need to get a special use permit or ask the zoning board to make an exception and allow you to build your in-law home.