In 1846 American troops signalled the occupation of San Francisco by raising an American flag above the former Mexican customhouse. The port, then known as Yuerba Beuna, fell into American control. The military retained jurisdiction over tariff collection and other civic affairs until California's interim government was established in 1849. The administration of dues and the regulation of maritime traffic for the port was eventually transferred to the United States Customs Service, a federal agency established in 1789 as a subordinate body of the Treasury Department.
Through the middle of the 19th century, San Francisco was California's principal commercial port. Customs officials were charged with the regulation of international maritime commerce and were responsible for administering United States customs laws. Responsibilities included collecting duties on imported goods, enforcing export control laws, registering and licensing vessels, and documenting the entry and clearance of merchandise, sailors and passengers.
In June of 1850 the United States Customs Service leased a property in San Francisco from a local merchant. The city-wide fire in May 1851 consumed the building. Shipping records detailing tonnage, merchandise and passenger movements for 1849, 1850, and the first half of 1851 were reported destroyed. Records and goods which survived the fire were temporarily moved to another building until construction of the "Custom-House Block" was complete. In November 1853 Custom House operations relocated to the new structure at the south-east corner of Sansome and Sacramento Streets, where customs officials shared space with the naval department and the United States Post Office. An earthquake on October 17, 1865, caused massive damage to the "Block".
The current U.S. Customs House at 555 Battery Street was constructed after a design competition in 1905. Excavation was completed before the San Francisco earthquake and fire in April 1906 but a shortage of labor and materials delayed completion until 1911.
From the guide to the San Francisco Custom House records, 1850-1861, (Beinecke Rare Book and Manuscript Library)