BYTETOOLS

JPL Horizons API

Free NASA JPL Horizons API with no key: compute high-precision ephemerides, positions, velocities and physical data for planets, moons, asteroids, comets and spacecraft.

No API key requiredHTTPSFree tier

Endpoint tested and returned HTTP 200 on 2026-08-21

What is the JPL Horizons API?

The JPL Horizons API is a free, key-free interface to NASA's Horizons ephemeris system. It computes positions, velocities, observer-centred coordinates and physical data for solar system bodies and spacecraft, at any epoch from 9999 BC to 9999 AD, for any observing location.

Horizons is the system professional astronomers use to point telescopes and plan missions, and it has been running since the early 1990s. The API added an HTTP front end to the same engine, which explains its unusual shape: parameters are passed as quoted strings and the result arrives as one large pre-formatted text block inside a JSON `result` field, not as structured data. That is not laziness — it is the original fixed-width report format, which downstream tools have parsed for thirty years.

Because of that, plan on parsing text. The example asks for physical data only (`MAKE_EPHEM='NO'`) and gets Mars's radius, mass, density, rotation period and escape velocity as a formatted table. Request an actual ephemeris and the block contains a header, a `$$SOE`/`$$EOE` delimited data section, and a footer of column definitions — split on those markers and the rest is straightforward. The quoting matters too: Horizons expects single quotes around most argument values, URL-encoded as `%27`, and silently misinterprets requests that omit them.

Quick facts

Base URL
https://ssd.jpl.nasa.gov/api/horizons.api
Authentication
No API key or account. NASA JPL data is US government work, not subject to copyright in the United States.
Rate limit
No published limit. Horizons computations are expensive, so JPL asks that you request long ephemeris spans in one call rather than looping over single epochs.
Pricing
Free, with no registration.
CORS
Not enabled — call it from your server
Official docs
Read the docs

How to use the JPL Horizons API

Every request below was executed against the live API on 2026-08-21, and the response shown is the real body it returned — not an illustration.

1. Fetch physical data for Mars without generating an ephemeris

GET https://ssd.jpl.nasa.gov/api/horizons.api?format=json&COMMAND=%27499%27&OBJ_DATA=%27YES%27&MAKE_EPHEM=%27NO%27

curl
curl 'https://ssd.jpl.nasa.gov/api/horizons.api?format=json&COMMAND=%27499%27&OBJ_DATA=%27YES%27&MAKE_EPHEM=%27NO%27'
JavaScript (fetch)
const res = await fetch("https://ssd.jpl.nasa.gov/api/horizons.api?format=json&COMMAND=%27499%27&OBJ_DATA=%27YES%27&MAKE_EPHEM=%27NO%27");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);
Python (requests)
import requests

res = requests.get("https://ssd.jpl.nasa.gov/api/horizons.api?format=json&COMMAND=%27499%27&OBJ_DATA=%27YES%27&MAKE_EPHEM=%27NO%27", timeout=20)
res.raise_for_status()
print(res.json())
Response — HTTP 200 (truncated)
{
  "signature": {
    "source": "NASA/JPL Horizons API",
    "version": "1.2"
  },
  "result": "*******************************************************************************\n Revised: June 02, 2025                 Mars                            499 / 4\n \n PHYSICAL DATA (updated 2025-Jun-02):\n  Vol. mean radius (km) = 3389.92+-0.04   Density (g/cm^3)      =  3.933(5+-4)\n  Mass x10^23 (kg)      =    6.4171       Flattening, f         =  1/169.779\n  Volume (x10^10 km^3)  =   16.318        Equatorial radius (km)=  3396.19\n  Sidereal rot. period  =   24.622962 hr  Sid. rot. rate, rad/s =  0.0000708822 \n  Mean solar day (sol)  =   88775.24415 s Polar gravity m/s^2   =  3.758\n  Core radius (km)      = ~1700           Equ. gravity  m/s^2   =  3.71\n  Geometric Albedo      =    0.150                                              \n\n  GM (km^3/s^2)         = 42828.375662    Mass ratio (Sun/Mars) = 3098703.59\n  GM 1-sigma (km^3/s^2) = +- 0.00028      Mass of atmosphere, kg= ~ 2.5 x 10^16\n  Mean temperature (K)  =  210            Atmos. pressure (bar) =    0.0056 \n  Obliquity to orbit    =   25.19 deg     Max. angular diam.    =  17.9\"\n  Mean sidereal orb per =    1.88081578 y Visual mag. V(1,0)    =  -1.52\n  Mean sidereal orb per =  686.98 d       Orbital speed,  km/s  =  24.13\n  Hill's sphere rad. Rp =  319.8          Escape speed, km/s    =   5.027\n                                 Perihelion  Aphelion    Mean\n  Solar Constant (W/m^2)         717         493         589\n  Maximum Planetary IR (W/m^2)   470         315         390\n  Minimum Planetary IR (W/m^2)

Parameters

ParameterTypeRequiredDescription
formatqueryOptional`json` or `text`. JSON wraps the same report in a `result` string. json
COMMANDqueryRequiredTarget body, single-quoted. Numeric ids follow the Horizons scheme: 499 is Mars, 301 the Moon, `'DES=C/2017 K2'` a comet. '499'
OBJ_DATAqueryOptional`'YES'` to include the physical and dynamical data block. 'YES'
MAKE_EPHEMqueryOptional`'NO'` to skip ephemeris generation and return only object data. 'NO'
EPHEM_TYPEqueryOptional`'OBSERVER'`, `'VECTORS'` or `'ELEMENTS'` — the three kinds of output Horizons produces. 'OBSERVER'
CENTERqueryOptionalObserving location code. `'500@399'` is Earth geocentre; `'@sun'` is heliocentric. '500@399'
START_TIME / STOP_TIME / STEP_SIZEqueryOptionalEphemeris span and cadence, all single-quoted. '2026-08-21'

Response fields

signature.source / versionstring
Confirms the request reached Horizons and which API version answered.
resultstring
The entire Horizons report as pre-formatted text. This is the payload — everything else is envelope.
result (data section)text
For ephemeris requests, the rows between the `$$SOE` and `$$EOE` markers. Split on those before parsing.
errorstring
Present instead of `result` when Horizons rejects the request, usually with the reason in plain English.

What you can build with the JPL Horizons API

  • Compute where a planet or comet will be from a specific observing site
  • Generate state vectors for orbital mechanics calculations
  • Look up authoritative physical constants for a solar system body
  • Plan observations by producing an altitude and azimuth table
  • Cross-check a simulation against JPL's reference ephemeris

Common errors and how to fix them

Ambiguous target

The `COMMAND` string matched several bodies.

Fix: Horizons returns a candidate list in `result`. Re-query with the exact numeric id, and remember the trailing `%3B` (semicolon) form pins a match.

400

Unquoted or badly encoded arguments.

Fix: Almost every Horizons argument needs single quotes, URL-encoded as `%27`. This is the single most common failure.

`result` contains an error message but HTTP is 200

Horizons reports computation errors inside the report body.

Fix: Scan `result` for `Cannot interpret` or `No matches found` before parsing; the status code will not tell you.

CORS error in the browser

No Access-Control-Allow-Origin header is sent.

Fix: Proxy through your own server. All JPL SSD endpoints behave this way.

JPL Horizons API — frequently asked questions

Is the JPL Horizons API free?

Yes, free with no key or registration, and as US government work the output is not subject to copyright in the United States.

Why does the response contain a big block of text rather than JSON fields?

Horizons predates the API by decades and produces a fixed-width report that generations of tools already parse. The JSON wrapper carries that report verbatim in the `result` field; split it on the `$$SOE` and `$$EOE` markers to reach the data rows.

How do I specify which body I want?

Through the `COMMAND` parameter using Horizons' numbering: major planets are 199 through 999 by hundreds, moons take three digits, and asteroids and comets use `DES=` designations. The documentation lists the full scheme, and an ambiguous string returns a candidate list.

What is the difference between Horizons and the Small-Body Database API?

SBDB returns stored catalogue records — the current best-fit orbit and published physical parameters. Horizons runs an integration to compute where an object actually is at a specific time from a specific place. Use SBDB for facts about an object and Horizons for positions.

Tools that pair with this API

JPL Horizons is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 2026-08-21; always check the official documentation before relying on this API in production, as terms and limits can change.