I had some files that I want to recover from windows, but I formatted the ssd drive to macos (apfs)? Is there a tool or method to recover those files?
From the Disk Utility User Guide, Erase and reformat a storage device in Disk Utility on Mac:
Note: With a solid-state drive (SSD), secure erase options are not available in Disk Utility. For more security, consider turning on FileVault encryption when you start using your SSD drive.
This gives you some chances to recover some files, if the drive wasn't formerly encrypted with e.g. BitLocker. Most likely the files are not in any directory structure, they are possibly lacking original file names, and they can be corrupted, too. The less you use the drive the higher the chances you still have.
This again emphasizes the meaning of proper backups, which always provides a more reliable and easier path, and also enables full recovery. Have you learned this lesson now?
SE isn't for product recommendations, but there are many tools and some are free. Googling for
ssd file recovery gives plenty of alternatives.