How to programmatically get free agents for a league?

You can just download the player universe, which is pretty regularly updated, and if a player is not on an active roster in your league, they are a free agent.