Certificate of occupancy

A certificate of occupancy is a document issued by a local government agency or building department certifying a building's compliance with applicable building codes and other laws, and indicating it to be in a condition suitable for occupancy. 
The procedure and requirements for the certificate vary widely from jurisdiction to jurisdiction and on the type of structure. In the United States, obtaining a certificate is generally required whenever:
The purpose of obtaining a certificate of occupancy is to prove that, according to the law, the house or building is in liveable condition. Generally, such a certificate is necessary to be able to occupy the structure for everyday use, as well as to be able to sign a contract to sell the space and close on a mortgage for the space.
A certificate of occupancy is evidence that the building complies substantially with the plans and specifications that have been submitted to, and approved by, the local authority. It complements a building permit—a document that must be filed by the applicant with the local authority before construction to indicate that the proposed construction will adhere to ordinances, codes, and laws.
Temporary certificate of occupancy (TCO).
A "temporary" certificate of occupancy grants residents and building owners all of the same rights as a certificate of occupancy, however it is only for a temporary period of time. In New York City, TCOs are usually active for 90 days from the date of issue, after which they expire. It is perfectly legal, and not uncommon in the given situation, for a building owner to re-apply for a TCO, following all the steps and inspections required originally, in order to hypothetically extend their TCO for another period of time.
Temporary certificates of occupancy are generally sought after and acquired when a building is still under minor construction, but there is a certain section or number of floors that are deemed to be habitable, and, upon issuance of TCO, can legally be occupied or sold.
New York City.
In New York City, for a building to obtain a certificate of occupancy (CO), the structure must pass a series of inspections, as well as a walk-through from the Department of Buildings. In most cases, the inspections include, but are not limited to, plumbing inspections, fire sprinkler system inspections, fire alarm system inspections, electrical inspections, fire pump pressure tests, architectural inspections (where inspector checks if building was built in accordance with an architect's stamped and approved drawings), elevator inspections, completion of lobby, and an inspection to see if the building complies with the proper number of entrances required for its size. After all inspections are passed, the last step is generally to have a walk-through by a member of the Department of Buildings, who sees that there is no major construction remaining on the job site, that there are no obstructions to the entrances, that there are no safety hazards in the building, and that everything in the building was built according to plan. If the inspector approves his walk-through, a certificate of occupancy is usually granted.