An X-ray absorption spectroscopy method for the detection of heavy metals at the K-absorption edges is implemented using the designed Si-PIN detector. The limits of detection of heavy metals and uncertainty of measurement are estimated by the results of measurements of the thickness of gold and lead foil.