St. Louis was laid down on 12 February 1827 at the Washington Navy Yard; launched on 18 August 1828; and commissioned on 20 December 1828, Master Commandant John D. Sloat in command.
On the day of her commissioning, St. Louis got underway and proceeded to Norfolk, Virginia, for final outfitting. She departed Hampton Roads on 14 February 1829 and headed for Havana, Cuba. Thence, she proceeded, via Rio de Janeiro and Cape Horn, to Callao, Peru. Arriving there on 20 June, the sloop of war joined the Pacific Squadron under Commodore Jacob Jones; and, until 8 September 1831, she cruised the coasts of the Americas to protect the trade and interests of the United States. On that day, she sailed for Cape Horn and the east coast; and arrived off Sandy Hook, New Jersey, on 9 December. She was laid up in ordinary at New York City on the 25th.
Recommissioned on 19 September 1832, St. Louis departed New York on 12 October to base at Pensacola, Florida, as a unit of the West Indies Squadron. She spent the following six years, largely as flagship for the squadron, cruising the Caribbean. On 28 May 1838, she sailed from Havana for New York where she again was placed in ordinary on 1 July and laid up until 5 April 1839.
St. Louis sailed on 30 June to join the Pacific Squadron at Monterey, California. En route, she put in at San Francisco, California where her commanding officer interceded with the government of California for imprisoned foreign residents. She had the distinction of being the first American man-of-war to carry the flag into that port. Following operations off the coast of Peru, she returned to Norfolk on 15 September 1842 and was laid up in ordinary there the following day.
St. Louis was recommissioned on 27 February 1843 and soon joined the East India Squadron as flagship. She was at Singapore early in 1844 while the first commercial treaty with China was being negotiated. She returned to Norfolk in September 1845 after participating in the evacuation of British colonists during the Battle of Kororareka, New Zealand in March. At Norfolk the ship underwent conversion to lengthen her hull by 13 feet. Departing from Norfolk on 11 August 1848, she sailed to Rio de Janeiro, where she served on the South America Station until returning in July 1851.St. Louis next departed from Norfolk on 24 August 1852 to cruise the Mediterranean. On 2 July 1853, while she was at Smyrna, Turkey, her commanding officer, Captain Duncan Ingraham, demanded that the commander of the Austrian frigate, Hussar, release Hungarian refugee Martin Koszta. The revolutionary leader had emigrated to the United States and announced his intentions of becoming an American citizen. Subsequently, while in Smyrna on business, he had been arrested by Austrian officials. Mediation by the French Consul effected Koszta's release.
St. Louis returned to New York on 8 May 1855 and sailed again in November to help suppress the slave trade along the western coast of Africa, returning to New York on 9 February 1858. In September of that year, she joined the Home Squadron based at Pensacola, Florida.
In January 1861, while serving with the Home Squadron off Vera Cruz, Mexico, St. Louis was ordered to return to Pensacola to stand guard during the turmoil which preceded the outbreak of the American Civil War. In April, she aided in the reinforcement of Fort Pickens; then joined in the massive blockade of southern ports. On 5 September, she assisted in the capture of blockade-running Confederate brig, Macao, at the mouth of the Mississippi River.
After being rearmed during a brief period in the Philadelphia Navy Yard, now armed with four 8inches shell guns, twelve 32-pounder guns, two 20-pounder Parrott rifles, and one 12-pounder smoothbore, she sailed on 24 February 1862 for Cadiz, Spain. For the next two years, she criss-crossed the Atlantic, cruised the African coast, and patrolled the areas in and around the Canary Islands and the Azores in search of Confederate commerce raiders. Cadiz and Lisbon were her primary bases for such operations. She returned to Port Royal, South Carolina, on 26 November 1864 for service in the South Atlantic Blockading Squadron.
Three days later, sailors and marines from St. Louis went ashore at Boyd's Landing to participate in the combined Army-Navy thrust up the Broad River. Under the command of Comdr. George H. Preble, the expedition was designed to assist General William Tecumseh Sherman as he approached Savannah, Georgia at the end of his march across Georgia. This operation was completed on 29 December. St. Louis then briefly returned to blockade duty before finally sailing to the Philadelphia Navy Yard where she was decommissioned on 12 May 1865.
St. Louis spent the remainder of her career at Philadelphia. After being laid up in 1866 and declared unserviceable, she became a receiving ship at League Island and continued this duty until 1894 when she was loaned as a training vessel to the Naval Militia of the State of Pennsylvania.
On 30 November 1904, while she was engaged in this service, her name was changed to Keystone State. She was finally struck from the Navy list on 9 August 1906 and sold for scrapping, on 5 June 1907, to Joseph G. Hitner of Philadelphia.