An apartment (also called a flat or a unit) was a type of dwelling that only occupies a portion of a building. This building was commonly called an apartment building or an apartment block. They are similar to condominiums but the units are not individually owned, unlike condominiums.
In 1930, Dubinski was the landlord of the apartment block where Edith Keeler lived, and in January of that year, rented out an apartment for James T. Kirk and Spock for two dollars a week. (TOS - Crucible novel: The Fire and the Rose)
811 East 68th Street, Apartment 12-B, New York City, New York, USA was the location of Gary Seven's headquarters on Earth in the year 1968. This is where the Beta 5 computer was located until Khan Noonien Singh broke into the apartment in 1989 and destroyed the computer. (TOS episode: "Assignment: Earth", TOS novel: The Rise and Fall of Khan Noonien Singh, Volume 1)
Roberta Lincoln had an apartment in the New York City suburb of East Village. She noted that the quarters on a Constitution-class starship were bigger and cleaner than her apartment in 1969. In her apartment she had to worry about cockroaches. (TOS novel: Assignment: Eternity)
In the 2250s, Thomas and Dana Mitchell were residing in an apartment building on 53rd Street. During his friendship with Gary Mitchell, James T. Kirk visited the apartment numerous times with his friend, and he had happy memories of sharing an ale together and gazing upon the oil paintings of various cities from across Earth, such as Paris, London and Rome. In late 2265, Kirk visited the apartment to speak to the Mitchell's following Gary's death on Delta Vega. (TOS - My Brother's Keeper novel: Enterprise)
James T. Kirk had an apartment in San Francisco that he used in the late 23rd century. He kept his antique collection at this location and often entertained his former crew mates from the USS Enterprise. (TOS movie, novelization & comic adaptations: The Wrath of Khan, The Search for Spock, TOS comic: "The Return!") This apartment was located in the Russian Hill Tower (TOS - Crucible novel: The Fire and the Rose) and was previously occupied by Kirk's Starfleet Academy classmate and friend Rear admiral Quince Waverleigh. (TOS novel: The Lost Years)
After they married Jack and Beverly Crusher moved in to an apartment near Starfleet Headquarters while Beverly attended Starfleet Medical Academy. At first Beverly felt living in the shadow of headquarters was oppressive, but later came to appreciate being so close to headquarters while Jack was away serving on the USS Stargazer. (TNG novel: Reunion)