Legumes possess several bioactive nutrients, including flavonoids, and the study of the flavonoid profile of legumes is of great significance to human health. Using widely targeted metabolomics, we revealed the flavonoid profiles of five popular fresh legumes: cowpea, soybean, pea, fava bean, and kidney bean. A total of 259 flavonoids were identified, and the flavonoid accumulation patterns of the five legumes were remarkably different. In addition to analyzing common and species-specific flavonoids in the five legumes, we also generalized representative flavonoids of various subclasses. We related these to the health-promoting effects of legumes. Furthermore, legumes' total flavonoid content and antioxidant system activity were also detected. Intriguingly, sakuranetin, the sole flavonoid phytoalexin that can be induced by UV radiation, was detected only in the peas by metabolomics. Meanwhile, we found that UV treatment could significantly increase the sakuranetin content and the postharvest Botrytis cinerea resistance of pea pods. This study provides clues for the target diet, industrial development of legumes, and a new idea for the postharvest preservation of peas.