A certificate of occupancy, or a CO, is document issued by the local municipality. It states that a property can be legally used for the purpose in which it is zoned. For example, a single family home would be certified to be inhabited for living, or a commercial retail store would be certified that it is allowed to be used to sell products to the public (assuming any other licenses needed were in place). A CO is issued to new properties and a CCO is issued for properties when they change hands, as in sold or rented. Every local government has its way of handling CO's. In some areas, an inspector will have to visit to verify that the property is in appropriate condition. In other areas, homeowners can self certify.
The reality is if you're buying, selling or renting an apartment in NYC you'll never have to think about a CCO. This is because in NYC CO's are issued to a building, not an individual unit within a building. It's when you get to single family homes that this changes for the most part. Best practice is to check with your local municipality for requirements. As a general rule buildings hold the CO not the unit.
In areas where single family or multi family homes are being sold the story can be very different. In some cases, the local government will require an official to come and inspect the property. These inspectors will look for working smoke detectors, carbon monoxide detectors, safe handrails at stair cases and even require a fire extinguisher to be mounted near the kitchen.
As the population density increases the likelihood for an in person inspection decreases. Some areas will require a homeowner to self certify the conditions of the home before selling it. This may seem like a simple task, in these cases the buyer should beware that there is nothing dangerously wrong with the property.
Typically the CO or CCO is the responsibility of the seller to convey with the property that it is ready for use. If a bank is involved, by lending to the buyer, it is likely going to be a requirement of the bank that the CCO be in place before a closing. The property location will determine if this should be an item on your checklist or if the responsibility is on the overall building.
The bottom line is that CO's were originally designed to make sure a property is safe and being used how it is intended to be used. Over the years, as major accidents happen the codes that govern CO's become stricter.