() was a Buddhist temple located in the Tomari neighborhood of the city of Naha, Okinawa Prefecture, Japan. It belonged to the Rinzai school sect of Japanese Zen. The temple's full name is (). It was the Royal ancestral shrine of the kings of Second Shà  dynasty of the Ryà «kyà « Kingdom. The site of the temple was designated a National Historic Site of Japan in 2025.
The founding date of Sà Âgen-ji| is said to be either during the Xuande era (1426-1435) or the Chenghua era (1465-1487), however, based on the inscription on the "Sogenji Dismount Monument" located in front of the temple gate it was completed in 1527, the 6th year of the Jiajing era. Based on the inscription on the stone monument located in front of the temple gate, the temple was founded in 1527, shortly after King Shà  Sei ascended to the throne. Prior to the investiture ceremony for the new king held at Shuri Castle, Chinese envoys held the "San'o Yusai" ceremony to console the spirit of the former king. The temple was complex of Chinese-style buildings, centered around the main temple. Anyone entering the temple grounds, including the king himself, had to dismount and enter the temple on foot out of respect for the prior sovereigns. The temple grounds were expanded at this time as well, with the construction of the massive stone gates and walls which remain today. The spirit tablets of the successive kings of the Ryà «kyà « Kingdom from Shunten to King Shà  Tai were installed in the temple, establishing it as a royal ancestral shrine. Although the spirit tablets were installed at Sà Âgen-ji, the temple was not a royal mausoleum, as the graves of the kings was located at the a short distance from Shuri Castle. In 1699, Shà  Shoku and Shà  Kyà «'s spirit tablet were moved to Tennà Â-ji, Shà  I's was moved to Tenkai-ji.
The main temple and stone gate were formerly designated National Treasures, but were destroyed and burned during the 1945 Battle of Okinawa. After the war, only the stone gate was restored with donations from the U.S. military and local residents, and the site of the temple became Sogenji Park. As a historic structure, the stone gate was designated a Special Important Cultural Property by the Government of the Ryukyu Islands in 1955, and was designated an Important Cultural Property in 1972 after Okinawa's return to mainland Japan. Plans have been floated by Naha City to either reconstruct the temple or to erect a museum on the site.