Much of China's claims on the South China Sea (as well as other areas) seem to be based on certain ancient "documents", Ive heard about how dubious they are or about how pseudo historical context is used to push geopolitical goals, but I wanted to know from experts, is there any truth to the claims? If so on what basis can a sovereign nation claim certain territory based on something hundreds of years ago.
Much of China's claim is not base on ancient "documents", there is more to it. Notably the events in 1930s, Chinese goods and graves on the islands, accounts of Chinese fishermen inhabit the islands by British, Japanese, and French.
I suggest this book on the dispute written by Chief of the Spatial, Environmental and Boundary Analysis Division of the United States' Department of State:
Read 4.1 and 4.2
Since you ask for China's claim. Here is a small summary of the parts that dealt with China in each section.
4.1 talks about the China and Vietnam claim before 20th centruy.
The author mentions Han map used by the governments(ROC, PRC) as the bias for the claim, but makes no comment about it's accuracy. The author believes that Chinese "undoubtedly were among the first" to reach the Spartly islands due to China's history of ocean trade in the region. There are Chinese goods and grave sites on the islands, however, the author does not believe it is a suffice prove for Chinese governance as Chinese traders were very active in the region and the goods could end up in other people hands due to trading. Another author (Samuels) suggests that first distinct Chinese reference to Spartly islands is in 1730. Independent reference to allegedly Chinese activity on the island was by the British survey ship in 1867. According to Chinese sources German suspended survey work due to request from Qing Government in 1883.
4.2 talks about the events the happened during the 20th century up until the WW2.
In 1902, Qing send navel force and reportedly put down markers and flags, unclear whether the navel fleet reached Spartly islands. In 1911, the newly founded ROC put Paracel island as a county under Hainan, but Spartly Islands were not mentioned. In 1918, Japanese survey team met Chinese fishermen in Southwest Cay of the Spartly islands. In 1928 ROC said Paracel Island is the Southmost part of China. In 1930, the French claim Spartly islands. In 1933, French publish their claim. In the same year, Chinese government objects the claim, citing the French describes the islands as inhabited by Chinese fishermen. The Chinese government issues multiple protests to the French government in the same year.
If you are interested about the others countries, this book describes each countries claims to the islands.