Sophora tonkinensis is an important medicinal plant native to China and Vietnam, growing in stony mountains and calcareous or sandstone hill slopes. Cadmium negatively affects the quality of S. tonkinensis, indirectly threatening human health. To elucidate the physiological and metabolic mechanism of S. tonkinensis in response to Cd stress, we conducted a hydroponic greenhouse experiment and measured the growth parameters of S. tonkinensis treated with 0, 20, 40, 60, and 80 µmol L− 1 Cd. Furthermore, metabolite changes in S. tonkinensis roots were investigated using liquid chromatography–tandem mass spectrometry. We identified 380 differential metabolites, and significant differences were detected in the varieties and quantities of amino acids, organic acids, fatty acids, and ketones, which have significant impact on S. tonkinensis stress response to Cd, under different Cd concentrations. S. tonkinensis resisted the stress induced by 40 µmol L− 1 Cd by upregulating lysine, arginine, histidine, glycine, sarcosine, tryptophan, D-proline, DL-serine, cellobiose, linoleic, indole, cytosine, and genistein contents and downregulating betaine, leucine, citrate, oleic, trehalose, and daidzein contents. Linoleic, palmitic, citrate, maackiain, isomaltose, and cinnavalininate contents were upregulated, and L-phenylalanine, sarcosine, indole acetate, and cytosine were downregulated in response to 80 µmol L− 1 Cd stress. KEGG pathway enrichment analysis showed that the isoflavonoid biosynthesis pathway was significantly enriched, indicating its important role in the Cd resistance of S. tonkinensis. This study provides important information for understanding the tolerance and accumulation mechanisms of S. tonkinensis in response to Cd stress, which will contribute to the breeding of medicinal plant.