Not really an answer to your question, but you may still find some of these resources helpful/interesting:
How to find the numerical positions of (moons, planets, stars and artificial satellites) in the sky?
The positions and velocities of moons and planets os first calculated by a big program that uses numerical integration to solve the n-body problem using an n-body simulation for thousands of years into the past and into the future.
The positions and velocities at lots of points in time are stored as a giant table in a computer file called an ephemeris. The most commonly used ones now are the Jet Propulsion Laboratory (JPL) Development Ephemerides
Star positions and distances, and their proper motions are stored in a variety of star catalogs the most famous of which is recently the GAIA catalogs.
Artificial satellites of Earth are constantly tracked by radar and optical observations by government agencies and short-term ephemerides are generated by Two Line Element Sets (TLEs) that are regularly updated1 because the orbits of artificial satellites of Earth are constantly changing primarily due to atmospheric drag, Earth's lumpy gravity field, and propulsive maneuvers that they might be commanded to do to adjust their orbits. (same goes for the larger pieces of space junk)
TLEs and more info can be found at Celestrak.org (open access) and Space-Track.org which requires (free) registration and a working email address.
TLEs are most useful for a few days to a few weeks - maybe longer for those that are higher up and away from atmospheric drag, but they are never super-accurate - a few kilometers at best, usually tens of kilometers off after several days.
1generally by the US government, but see also
...is there an API that can be interacted in JavaScript or Python?
For Python for almost all of these the best one-stop shopping solution is Skyfield.
There are Skyfield tagged questions in:
The "main place" to go is JPL's Horizions which is based on the JPL Development Ephemerides and also has calculated trajectories for deep space missions from some Apollo missions all the way to an occasional projected (planned) trajectory for a future mission.
There are API interfaces for Horizons as well, both from NASA (I think) and some home-grown ones discussed here in Astronomy SE and in Space Exploration SE.