Most election data comes from the Associated Press, but I don’t see a place to purchase API access, may only be available to news orgs.
https://developer.ap.org/ap-elections-api/
A reddit poster had some JSONs from New York Times four years ago for 2020 but I’m not sure if you can make them work for 2024.
https://old.reddit.com/r/rstats/comments/jo1yuw/us_election_results_api/gmnxfz3/
Do like the BBC and spin up your own mastodon instance, Guardian.