Documentation for LightDelay
What is LightDelay?
LightDelay is a service that uses orbital elements and ephemerides from a variety of sources to provide accurate distance calculations between a wide range of solar bodies.
Who is LightDelay?
I'm just a hacker who knows how to use Python and who decided to read a lot of documentation on astrometrics libraries. This service is independent and non-profit. The code is available on GitHub (link at the top of every page) and pull requests are welcomed and greatly appreciated!
Why is LightDelay?
During the InSight Mars mission landing, I was watching the stream and wondering how significant the communications delay was, how long ago the events we were watching had actually occurred. While it's easy to find average speed-of-light delays, I couldn't find anywhere that listed the current communications delay to Mars without pulling out an astrometrics package and calculating it myself. So I decided to put this together.
API Format
The LightDelay API is very simple. Issue a GET request to a URL of the form "https://lightdelay.space/location1/location2/time/". You can leave off any parameters you don't need, and you can list the parameters in any order. We will do our best to return the result you're looking for.
If you give a single location, we will return the distance from Earth to that solar system object. If you give two locations, we will return the distance between those two objects. If you give a time, we will calculate the distance as of that time. If you don't, we'll use the current time. See? Pretty straightforward.
JSON API v1 (new)
We now provide stable JSON endpoints for integrations and tooling:
/api/v1/resolve/?query=Mars&epoch=2026-05-23T00:00:00Z/api/v1/delay/?from=Earth&to=Mars&epoch=2026-05-23T00:00:00Z&mode=geometric/api/v1/suggest/?q=ma
API delay responses now include source metadata, frame, epoch, and solver details to support transparent validation and reproducibility.
Times
You can input a time in any format that Python's dateutil.parser understands. Advertised as supporting "most known formats", you should find this parser to be pretty flexible and very DWIMmy. Here are a few examples:
- https://lightdelay.space/2000/: A year alone is fine. You'll get the current month and day, in that year.
- https://lightdelay.space/2000-07/: As is a year and a month. Again, the current day of the month will be used to fill the missing data.
- https://lightdelay.space/2000-07-04/: Or a year, month, and day.
- https://lightdelay.space/01-02-2000/: This is interpreted as Month - Day - Year if possible, sorry non-Americans.
- https://lightdelay.space/28-02-2000/: No such month as "28", so this one is Day - Month - Year.
- https://lightdelay.space/2000-01-01 10:00/: If you don't give a time zone, we will assume UTC.
- https://lightdelay.space/2000-01-01 10:00 UTC-4/: If you want to give a time zone, do so in UTC offset format.
Locations
You can select a location by name. Currently support is limited to only a few categories of object, but I'm working on adding more.
Planets
Planets, the Sun, and Earth's Moon are calculated using the solar system ephemerides built in to the AstroPy library. Data should be accurate for the range from 1950 to 2050, and may still be relatively accurate outside that window. Examples:
Minor Planets
Anything classified as an asteroid by the Minor Planet Center is available as well. This includes dwarf planets as well as asteroids of all sizes, including:
Comets
Comets are also available from the Minor Planet Center database, however, they aren't yet fully supported here. One issue is that comets are named using names like "9P/Tempel", but the / character is also the HTML
path separator. "Tempel" doesn't work because that's also an asteroid, and "Tempel 1" doesn't work because the MPC API doesn't support it. "9P" alone does work
in a pinch, though!
- https://lightdelay.space/1995_O1/: Using part of the official designation of
C/1995 O1, better known as Comet Hale-Bopp. - https://lightdelay.space/1P_Halley/: If you replace the
/in1P/Halleywith an underscore, you'll get the correct page. For example try typing1P/Halleyin the search box.
Other Moons
Earth-Orbiting Satellites
Locations on Earth
Accuracy
There are some important caveats. I'm a coder, not an astrometrist, so I'm not an expert on the accuracy of these data sources or the validity of this data either into the past or into the future. I have it on good authority that orbital dynamics are actually rather complicated. Here's what should work:
- Planets: Positions should be accurate between the years 1950 and 2050.
- Minor planets and moons: Positions should be accurate from when they were first observed until the present day, however, predictions into the future may not be accurate. Accuracy will generally be best at the present time, and uncertainty will gradually increase over time.
Source Transparency
Every modern API response identifies what provider and frame were used so results can be interpreted correctly and compared across runs. Provider fallback behavior is tracked in a resolution trace when multiple data sources are attempted.