### GET /api/horizons.api (SPK File Retrieval) Source: https://ssd-api.jpl.nasa.gov/doc/horizons This section details how to retrieve SPK files using the Horizons API, providing both command-line and programmatic examples. ```APIDOC ## GET /api/horizons.api ### Description This endpoint allows users to retrieve ephemeris data, specifically SPK files, from the JPL Horizons system. It supports various parameters to define the object, time range, and output format. ### Method GET ### Endpoint `https://ssd.jpl.nasa.gov/api/horizons.api` ### Parameters #### Query Parameters - **format** (string) - Required - Specifies the output format. Use `text` for raw text or `json` for JSON output. - **COMMAND** (string) - Required - Specifies the astronomical object and query details. Special characters like `=` and `;` must be URL-encoded (e.g., `%3D`, `%3B`). Example: `'DES%3D2000001%3B'` for object 2000001. - **EPHEM_TYPE** (string) - Required - Specifies the type of ephemeris data to retrieve. Use `SPK` for SPK files. - **START_TIME** (string) - Required - The start date for the ephemeris data (e.g., 'YYYY-MM-DD'). - **STOP_TIME** (string) - Required - The stop date for the ephemeris data (e.g., 'YYYY-MM-DD'). - **OBJ_DATA** (string) - Optional - Set to `NO` to exclude object data from the response when requesting SPK files. ### Request Example (cURL for text format) ```bash curl -s "https://ssd.jpl.nasa.gov/api/horizons.api?format=text&COMMAND='1%3B'&EPHEM_TYPE=SPK&START_TIME='2020-01-01'&STOP_TIME='2030-12-31'&OBJ_DATA=NO" | awk '/REFGL1NQ/,0' | base64 --decode > 2000001.bsp ``` ### Request Example (JSON response structure) ```json { "signature" : { "source" : "NASA/JPL Horizons API", "version" : "0.2" }, "result" : "\nID= '2000001'\n\n", "spk_file_id" : "2000001", "spk" : "REFGL1NQSyACAAAABgAAAFNNQl9TUEtfRklMRSAgICAgICAgICAgICAgICAgICAgICAgICAgICAg\nICAgICAgICAgICAgICAgICAgID4AAAA+AAA ... AAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAA==\n" } ``` ### Response #### Success Response (200) - **signature** (object) - API signature information. - **result** (string) - General result message or status. - **spk_file_id** (string) - Suggested filename base for the SPK file. - **spk** (string) - Base64 encoded binary SPK file content (when `format=json` and `EPHEM_TYPE=SPK`). #### Error Response (400) - **message** (string) - Detailed error message. ### Sample Scripts #### Perl This script generates an SPK file for a specified small-body SPK-ID. ```perl use strict; use LWP::UserAgent; use JSON; use MIME::Base64; # Define API URL and SPK filename: my $url = "https://ssd.jpl.nasa.gov/api/horizons.api"; my $spk_filename = 'spk_file.bsp'; # Define the time span: my $start_time = '2030-01-01'; my $stop_time = '2031-01-01'; # Get the requested SPK-ID from the command-line: my $spkid = shift; unless ( defined $spkid ) { die "please specify SPK-ID on the command-line"; } # Build the appropriate URL for this API request: # IMPORTANT: You must encode the "=" as "%3D" and the ";" as "%3B" in the # Horizons COMMAND parameter specification. $url .= "?format=json&EPHEM_TYPE=SPK&OBJ_DATA=NO"; $url .= "&COMMAND='DES%3D$spkid%3B'&START_TIME='$start_time'&STOP_TIME='$stop_time'"; # Build and submit the API request and decode the JSON-response: my $ua = LWP::UserAgent->new; my $response = $ua->get($url); my $data = decode_json($response->content); # If the request was valid... if ( $response->code eq '200' ) { # # If the SPK file was generated, decode it and write it to the output file: if ( defined $data->{spk} ) { # # If a suggested SPK file basename was provided, use it: if ( defined $data->{spk_file_id} ) { $spk_filename = "$data->{spk_file_id}.bsp"; } open (my $fh, ">", $spk_filename) or die "unable to open $spk_filename: $!\n"; # # Decode and write the binary SPK file content: print $fh decode_base64($data->{spk}); close $fh; print "wrote SPK content to $spk_filename\n"; exit; } # # Otherwise, the SPK file was not generated so output an error: print "ERROR: SPK file not generated\n"; if ( defined $data->{result} ) { print $data->{result}; } else { print $response->content; } exit 1; } # If the request was invalid, extract error content and display it: if ( $response->code eq '400' ) { print "ERROR in API call: HTTPS response: ", $response->status_line, "\n"; if ( defined $data->{message} ) { print $data->{message}, "\n"; } else { print $response->content; } exit 1; } # Otherwise, some other error occurred: print "ERROR in API call: HTTPS response: ", $response->status_line, "\n"; exit 1; ``` #### Python This script generates an SPK file for a specified small-body SPK-ID. ```python import sys import json import base64 import requests # Define API URL and SPK filename: url = 'https://ssd.jpl.nasa.gov/api/horizons.api' spk_filename = 'spk_file.bsp' # Define the time span: start_time = '2030-01-01' stop_time = '2031-01-01' # Get the requested SPK-ID from the command-line: if (len(sys.argv)) == 1: print("please specify SPK-ID on the command-line"); sys.exit(2) spkid = sys.argv[1] # Build the appropriate URL for this API request: # IMPORTANT: You must encode the "=" as "%3D" and the ";" as "%3B" in the # Horizons COMMAND parameter specification. command = f"'DES%3D{spkid}%3B'" api_url = f"{url}?format=json&EPHEM_TYPE=SPK&OBJ_DATA=NO&COMMAND={command}&START_TIME='{start_time}'&STOP_TIME='{stop_time}'" # Submit the API request: try: response = requests.get(api_url) response.raise_for_status() # Raise an exception for bad status codes except requests.exceptions.RequestException as e: print(f"Error during API request: {e}") sys.exit(1) data = response.json() # If the request was valid... if response.status_code == 200: # # If the SPK file was generated, decode it and write it to the output file: if 'spk' in data: # # If a suggested SPK file basename was provided, use it: if 'spk_file_id' in data: spk_filename = f"{data['spk_file_id']}.bsp" try: with open(spk_filename, 'wb') as f: f.write(base64.b64decode(data['spk'])) print(f"wrote SPK content to {spk_filename}") sys.exit(0) except IOError as e: print(f"Error writing SPK file {spk_filename}: {e}") sys.exit(1) # # Otherwise, the SPK file was not generated so output an error: else: print("ERROR: SPK file not generated") if 'result' in data: print(data['result']) else: print(response.text) sys.exit(1) # If the request was invalid, extract error content and display it: elif response.status_code == 400: print(f"ERROR in API call: HTTPS response: {response.status_line}") if 'message' in data: print(data['message']) else: print(response.text) sys.exit(1) # Otherwise, some other error occurred: else: print(f"ERROR in API call: HTTPS response: {response.status_line}") sys.exit(1) ``` ``` -------------------------------- ### SBDB API HTTP GET Request Example Source: https://ssd-api.jpl.nasa.gov/doc/cad Demonstrates how to construct an HTTP GET request to the SBDB Close-Approach Data API. This example shows how to retrieve all close-approach data for a specific asteroid within a given distance and date range. ```HTTP GET https://ssd-api.jpl.nasa.gov/cad.api?des=433&date-min=1900-01-01&date-max=2100-01-01&dist-max=0.2 ``` -------------------------------- ### API JSON Response Example - Earth-Moon System Source: https://ssd-api.jpl.nasa.gov/doc/periodic_orbits This snippet shows an example JSON response from the SSD API for the Earth-Moon system, illustrating the structure of system details, libration points, filtering limits, and a sample of periodic orbit data. ```json { "signature" : {"source" : "NASA/JPL Three-Body Periodic Orbits API","version" : "1.0"}, "system" : { "name" : "Earth-Moon", "mass_ratio" : "1.215058560962404e-02", "radius_secondary" : "1737.1", "L1" : ["0.8369151257723572","0.0","0.0"], "L2" : ["1.155682165444884","0.0","0.0"] "L3" : ["-1.005062645810278","0.0","0.0"], "L4" : ["0.4878494143903759","0.8660254037844386","0.0"], "L5" : ["0.4878494143903759","-0.8660254037844386","0.0"], "lunit" : "389703.2648292776", "tunit" : "382981.2891290545" }, "family" : "halo", "libration_point" : "1", "branch" : "N", "limits" : { "jacobi" : ["0.19516273085815472","3.1743435193301153"], "period" : [" 1.8036720655626510E+00"," 3.1233143922761588E+00"], "stability" : ["1","1180.4065333857613"] }, "count" : "5731", "fields" : ["x","y","z","vx","vy","vz","jacobi","period","stability"], "data" : [ ["-4.1456184803140111E-01","0.0000000000000000E+00","9.0753120433295065E-01","-1.1555581216266303E-12","1.4076145460136695E+00","3.9979936124406781E-13","1.9516273085815472E-01","3.1233143922761588E+00","2.4340572681337468E+02"], ["-4.1421982661362478E-01","0.0000000000000000E+00","9.0768629637651521E-01","-1.1474877439509793E-12","1.4072700950580586E+00","3.9684610255625016E-13","1.9584418854987273E-01","3.1233112610554632E+00","2.4352872940755927E+02"], ["-4.1387776145545296E-01","0.0000000000000000E+00","9.0784124892510798E-01","-1.2473183104559711E-12","1.4069256037546980E+00","4.3182616480665382E-13","1.9652572760226936E-01","3.1233081181627282E+00","2.4365166172846071E+02"], ... ] } ``` -------------------------------- ### Horizons Input File Example Source: https://ssd-api.jpl.nasa.gov/doc/horizons_file Example of an input file for the Horizons File API, specifying ephemeris request parameters such as celestial body, observation time, and desired output quantities. This file is sent as part of the POST request. ```plaintext !$$SOF COMMAND='499' OBJ_DATA='YES' MAKE_EPHEM='YES' TABLE_TYPE='OBSERVER' CENTER='500@399' START_TIME='2006-01-01' STOP_TIME='2006-01-20' STEP_SIZE='1 d' QUANTITIES='1,9,20,23,24,29' ``` -------------------------------- ### Horizons API Input File for Small-Body SPK Generation Source: https://ssd-api.jpl.nasa.gov/doc/horizons_file Provides an example of an input file for the Horizons API to request an SPK file for a small body. This example specifies the object (1 Ceres) and the desired time range (2020-01-01 to 2030-12-31 TDB) using the 'S' ephemeris type. ```text !$$SOF COMMAND='1;' EPHEM_TYPE='S' START_TIME='2020-01-01' STOP_TIME='2030-12-31' OBJ_DATA='NO' ``` -------------------------------- ### Sample Data Output: Satellite Orbit and Physical Parameters Source: https://ssd-api.jpl.nasa.gov/doc/sb_sat This JSON output demonstrates sample data for a small-body satellite, including its orbital elements and physical parameters. It details information such as semi-major axis, eccentricity, inclination, and physical properties like density and diameter, along with references for the data. ```json { "signature" : {"source" : "NASA/JPL Small-Body Satellites API", "version" : "1.0"}, "count" : "1", "data" : [ "sat" : { "class" : "APO", "iau_name" : null, "iau_num" : null, "kind" : "an", "notes" : null, "pdes" : "185851", "prefix" : null, "prov_num" : "1", "prov_year" : "2000", "ref" : "Margot et al. (2002), Science, 296", "sat_fullname" : "S/2000 (185851) 1" }, { "orbit" : { "a" : "2659", "a_D" : null, "dn_dt" : null, "e" : "0.019", "epoch" : null, "equinox" : "J2000", "frame" : "EC", "i" : "12", "ma" : null, "n" : null, "notes" : null, "oid" : "0", "om" : "24", "per" : "42.1344", "q" : null, "ref" : "Naidu et al. 2015", "tp" : null, "w" : null }, "phys_par" : { "GM" : { "notes" : null, "ref" : "Naidu et al. 2015", "sigma" : "0.14e-9", "value" : "1.2e-9" }, "density" : { "notes" : null, "ref" : "Naidu et al. 2015", "sigma" : "0.230", "value" : "1.047" }, "diameter" : { "notes" : null, "ref" : "Naidu et al. 2015", "sigma" : "0.019", "value" : "0.316" }, "extent" : { "notes" : null, "ref" : "Naidu et al. 2015", "sigma" : "0.023 x 0.019 x 0.016", "value" : "0.377 x 0.314 x 0.268" }, "rot_per" : { "notes" : null, "ref" : "Naidu et al. 2015", "sigma" : "0.48", "value" : "42.48" } } } ] } ``` -------------------------------- ### API JSON Response Example - Saturn-Titan System Snippet Source: https://ssd-api.jpl.nasa.gov/doc/periodic_orbits This snippet displays the beginning of a JSON response for the Saturn-Titan system, highlighting the 'system' object and indicating that the response continues with further details. ```json { "signature" : {"source" : "NASA/JPL Three-Body Periodic Orbits API","version" : "1.0"}, "system" : { "name" : "Saturn-Titan", "mass_ratio" : "2.366393158331484e-04", ``` -------------------------------- ### Example API Queries for JPL Fireball Data Source: https://ssd-api.jpl.nasa.gov/doc/fireball Demonstrates how to construct GET requests to the Fireball Data API to retrieve specific datasets. These examples showcase filtering by date, limiting results, and requesting specific data fields. ```http GET https://ssd-api.jpl.nasa.gov/fireball.api GET https://ssd-api.jpl.nasa.gov/fireball.api?limit=20 GET https://ssd-api.jpl.nasa.gov/fireball.api?date-min=2014-01-01&req-alt=true ``` -------------------------------- ### SBDB API HTTP GET Request for NEOs Source: https://ssd-api.jpl.nasa.gov/doc/cad Shows an example HTTP GET request to the SBDB Close-Approach Data API for querying Earth close-approach data for NEOs. This query filters by distance in lunar distances and sorts results by distance. ```HTTP GET https://ssd-api.jpl.nasa.gov/cad.api?dist-max=10LD&date-min=2018-01-01&sort=dist ``` -------------------------------- ### Query Mode 'Q' JSON Payload Example Source: https://ssd-api.jpl.nasa.gov/doc/mdesign This JSON payload illustrates the data structure returned in query mode 'Q'. It includes signature details, information about the celestial object being queried, the fields defining the pre-computed mission data, and a 'selectedMissions' array. Each element in 'selectedMissions' is an array representing a trajectory, with values corresponding to the defined fields. ```json { "signature" : {"version":"1.1","source":"NASA/JPL Small-Body Mission Design API"}, "object" : { "des" : "1", "fullname" : "1 Ceres", "spkid" : "2000001", "orbit_class" : "MBA", "condition_code" : "0", "data_arc" : "24437", "orbit_id" : "34", "md_orbit_id" : "34", "computed_on" : "2019-02-13" }, "fields": ["MJD0","MJDf","vinf_dep","vinf_arr","phase_ang","earth_dist","elong_arr","decl_dep","approach_ang"], "selectedMissions": [[61745,62125,11.3777,6.3766,52.45,3.8475,4.58,5.98,137.61], [62265,62565,11.26,9.9863,26.18,3.9258,12.22,-69.43,116.36], [65535,65820,11.177,10.6303,25.75,3.8817,20.29,-69.69,112.90], [62580,64015,10.9125,6.7504,58.75,3.9083,15.97,-55.14,135.37], [58070,58320,10.8491,9.6527,33.45,3.2371,41.76,69.94,120.41], [66465,66705,10.8218,10.6407,29.94,3.1188,48.58,70.36,117.04] ] } ``` -------------------------------- ### GET /scout.api - Ephemeris Queries Source: https://ssd-api.jpl.nasa.gov/doc/scout These endpoints retrieve ephemeris data for a specific NEOCP object at different times. Users can specify start, stop, and step times. ```APIDOC ## GET /scout.api ### Description Retrieves ephemeris data for a specific NEOCP object at specified times. ### Method GET ### Endpoint `https://ssd-api.jpl.nasa.gov/scout.api?tdes=P10vY9r&eph-start` ### Parameters #### Query Parameters - **tdes** (string) - Required - NEOCP object designation (e.g., "P10vY9r") - **eph-start** (string) - Required - Ephemeris start time (e.g., "now", "2016-09-24T12:00:00") - **eph-stop** (string) - Optional - Ephemeris stop time (e.g., "2016-09-26T06:00:00") - **eph-step** (string) - Optional - Ephemeris time step (e.g., "2h") ### Request Example ```json { "example": "get ephemeris data for a specific NEOCP object" } ``` ### Response #### Success Response (200) - **data** (array) - Ephemeris data for the requested object. #### Response Example ```json { "example": "response data" } ``` ``` -------------------------------- ### Request Small-Body SPK File (JPL Database) Source: https://ssd-api.jpl.nasa.gov/doc/horizons Example HTTP GET request to the JPL Horizons API to obtain an SPK file for a small body already present in the JPL database. This request specifies the object ID, desired ephemeris type, and time range. ```http https://ssd.jpl.nasa.gov/api/horizons.api?COMMAND='1%3B'&EPHEM_TYPE=SPK&START_TIME='2020-01-01'&STOP_TIME='2030-12-31'&OBJ_DATA=NO ``` -------------------------------- ### Extract SPK from Text Output (Linux Command Line) Source: https://ssd-api.jpl.nasa.gov/doc/horizons This command-line example demonstrates how to extract binary SPK file content from a successful text-format API response. It uses `curl` to fetch data and `awk` to isolate the SPK content, then `base64` to decode it into a file. Note that this method may not easily catch API errors. ```bash curl -s "https://ssd.jpl.nasa.gov/api/horizons.api?format=text&COMMAND='1%3B'&EPHEM_TYPE=SPK&START_TIME='2020-01-01'&STOP_TIME='2030-12-31'&OBJ_DATA=NO" | awk '/REFGL1NQ/,0' | base64 --decode > 2000001.bsp ``` -------------------------------- ### Example API Signature Object Source: https://ssd-api.jpl.nasa.gov/doc/sbwobs Illustrates the structure of the 'signature' object found in the JSON payload, emphasizing the importance of checking the 'version' field to ensure compatibility with the API documentation. ```json { "signature": { "version": "1.0", "source": "NASA/JPL ... API" } } ``` -------------------------------- ### Request Small-Body SPK File (User-Defined Elements) Source: https://ssd-api.jpl.nasa.gov/doc/horizons Example HTTP GET request to the JPL Horizons API to generate an SPK file for a small body defined by user-supplied osculating elements and non-gravitational parameters. This request includes object identification, ephemeris type, time range, and detailed orbital parameters. ```http https://ssd.jpl.nasa.gov/api/horizons.api?COMMAND='%3B'&MAKE_EPHEM=YES&EPHEM_TYPE=SPK&OBJ_DATA=NO&START_TIME='2030-Jan-1'&STOP_TIME='2031-Jan-1'&OBJECT='User%20Apophis'&EPOCH=2459311.5&ECLIP=J2000&EC=0.1915350975906659&QR=0.7458351838564465&TP=2459424.5839352785&OM=203.9782743995174&W=126.6377455281965&IN=3.33973556589891&A1='3.869431020576E-13'&A2='-2.898628963521E-14'&R0=1.&ALN=1.&NM=2.&NN=5.093&NK=0. ``` -------------------------------- ### Text Output Sample for Singular Match Source: https://ssd-api.jpl.nasa.gov/doc/horizons_lookup This is an example of plain-text output for a query that matches a single object. It includes API version and source information, followed by key-value pairs detailing the object's name, type, SPKID, primary designation, and aliases. Records are delimited by a blank line. ```text API VERSION: 1.0 API SOURCE: NASA/JPL Horizons Lookup API Object name = 99942 Apophis Type = asteroid (integrated barycenter) Primary SPKID = 20099942 Primary designation= 2004 MN4 Aliases = 3264226, 2099942, K04M04N ``` -------------------------------- ### Mode S Data Example Source: https://ssd-api.jpl.nasa.gov/doc/sentry Provides an example of the data structure for Mode S, which includes details about potential asteroid impacts. ```APIDOC ## Mode S Data Structure ### Description This section details the fields available in the Mode S data, which describes potential asteroid impacts. Each field is a character string except for the integer value for the number of impactors (n_imp). Several values are mean-values weighted by impact probability. ### Request Example ```json { "signature" : {"version":"2.0","source":"NASA/JPL Sentry Data API"}, "count" : 3, "data" : [ { "des" : "1979 XB", "diameter" : "0.66", "fullname" : "(1979 XB)", "h" : "18.56", "id" : "bJ79X00B", "ip" : "8.89646e-07", "last_obs" : "1979-12-15", "last_obs_jd" : "2444222.5", "n_imp" : "5", "ps_cum" : "-2.75", "ps_max" : "-3.12", "range" : "2056-2113", "ts_max" : "0", "v_inf" : "23.7204343975019" }, { "des" : "1994 GK", "diameter" : "0.048", "fullname" : "(1994 GK)", "h" : "24.24", "id" : "bJ94G00K", "ip" : "6.9957638e-05", "last_obs" : "1994-04-10", "last_obs_jd" : "2449452.5", "n_imp" : "8", "ps_cum" : "-3.61", "ps_max" : "-3.62", "range" : "2050-2067", "ts_max" : "0", "v_inf" : "14.8709547057606" }, { "des" : "2000 SB45", "diameter" : "0.046", "fullname" : "(2000 SB45)", "h" : "24.34", "id" : "bK00S45B", "ip" : "0.00015927734411", "last_obs" : "2000-09-29", "last_obs_jd" : "2451816.5", "n_imp" : "227", "ps_cum" : "-3.75", "ps_max" : "-4.22", "range" : "2068-2118", "ts_max" : "0", "v_inf" : "7.53074757034446" } ] } ``` ### Response #### Success Response (200) - **signature** (object) - API signature information. - **count** (integer) - The number of impactor records returned. - **data** (array) - An array of impactor objects. - **des** (string) - Designation of the asteroid. - **diameter** (string) - Estimated diameter of the asteroid in kilometers. - **fullname** (string) - Full name of the asteroid, including parentheses. - **h** (string) - Absolute magnitude (H) of the asteroid. - **id** (string) - Unique identifier for the asteroid. - **ip** (string) - Impact probability. - **last_obs** (string) - Date of the last observation in `YYYY-MM-DD` format. - **last_obs_jd** (string) - Julian date of the last observation. - **n_imp** (string) - Number of impactors. - **ps_cum** (string) - Cumulative Palermo Scale rating. - **ps_max** (string) - Maximum Palermo Scale rating. - **range** (string) - The range of years for which impacts are predicted. - **ts_max** (string) - Maximum Torino Scale rating. - **v_inf** (string) - Heliocentric velocity at infinity. ``` -------------------------------- ### JSON Zero-Count Result Example Source: https://ssd-api.jpl.nasa.gov/doc/cad This example illustrates the JSON payload structure for a query that results in zero close-approach records. It signifies that the search criteria were too restrictive. ```json { "signature":{"version":"1.5","source":"NASA/JPL SBDB Close Approach Data API"}, "count" : 0 } ``` -------------------------------- ### Small-Body SPK File Generation Source: https://ssd-api.jpl.nasa.gov/doc/horizons Details on how to generate and retrieve binary SPK files for small bodies, including base-64 encoding and decoding instructions. ```APIDOC ## Small-Body SPK File Generation ### Description This section describes the process of generating and retrieving binary SPK files from the Horizons API. The SPK file content is returned base-64 encoded after an API header. ### Method GET ### Endpoint /api/horizons.api ### Parameters #### Query Parameters - **COMMAND** (string) - Required - Specifies the object for which to generate the SPK file. For small bodies in the JPL database, use the ID (e.g., `'1;'` for Ceres). For bodies not in the database, use `';'` and provide object details. - **EPHEM_TYPE** (string) - Required - Set to `SPK` to request an SPK file. - **START_TIME** (string) - Required - The start time for the ephemeris. - **STOP_TIME** (string) - Required - The stop time for the ephemeris. - **OBJ_DATA** (string) - Optional - Set to `NO` to exclude object data from the response header. - **MAKE_EPHEM** (string) - Optional - Set to `YES` when providing user-supplied elements. - **OBJECT** (string) - Optional - Name of the user-supplied object. - **EPOCH** (string) - Optional - Epoch of the user-supplied elements. - **ECLIP** (string) - Optional - Ecliptic used for the user-supplied elements. - **EC** (string) - Optional - Eccentricity of the orbit. - **QR** (string) - Optional - Perihelion distance. - **TP** (string) - Optional - Time of perihelion passage. - **OM** (string) - Optional - Argument of perihelion. - **W** (string) - Optional - Longitude of the ascending node. - **IN** (string) - Optional - Inclination. - **A1** (string) - Optional - Coefficient 1 for non-gravitational parameters. - **A2** (string) - Optional - Coefficient 2 for non-gravitational parameters. - **R0** (string) - Optional - Parameter R0 for non-gravitational parameters. - **ALN** (string) - Optional - Parameter ALN for non-gravitational parameters. - **NM** (string) - Optional - Mean motion. - **NN** (string) - Optional - Mean anomaly. - **NK** (string) - Optional - Keplerian element. ### Request Example (Small-Body in JPL Database) ``` https://ssd.jpl.nasa.gov/api/horizons.api?COMMAND='1%3B'&EPHEM_TYPE=SPK&START_TIME='2020-01-01'&STOP_TIME='2030-12-31'&OBJ_DATA=NO ``` ### Request Example (Small-Body not in JPL Database) ``` https://ssd.jpl.nasa.gov/api/horizons.api?COMMAND='%3B'&MAKE_EPHEM=YES&EPHEM_TYPE=SPK&OBJ_DATA=NO&START_TIME='2030-Jan-1'&STOP_TIME='2031-Jan-1'&OBJECT='User%20Apophis'&EPOCH=2459311.5&ECLIP=J2000&EC=0.1915350975906659&QR=0.7458351838564465&TP=2459424.5839352785&OM=203.9782743995174&W=126.6377455281965&IN=3.33973556589891&A1='3.869431020576E-13'&A2='-2.898628963521E-14'&R0=1.&ALN=1.&NM=2.&NN=5.093&NK=0. ``` ### Response #### Success Response (200) Returns an API header followed by the base-64 encoded binary SPK data. #### Response Example (SPK Binary Data) ```text API VERSION: 1.0 API SOURCE: NASA/JPL Horizons API ID= '2000001' SPK Binary Data Follows -- base64 encoded: REFGL1NQSyACAAAABgAAAFNNQl9TUEtfRklMRSAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgID4AAAA+AAAAMLcAAExUTC1JRUVFAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ... AAAAAAAAAAAAAAAAAAAAAAAAAA== ``` ### Notes - To convert the base-64 encoded content to a usable binary SPK file, extract the encoded portion to a file and use a base-64 decoder (e.g., `base64 --decode {extracted_file_content}`). ``` -------------------------------- ### Text Output Sample for No Matching Objects Source: https://ssd-api.jpl.nasa.gov/doc/horizons_lookup This plain-text output indicates that a query did not find any matching objects. It includes the API version and source, followed by a clear notice stating that no matches were found. This format is distinct from successful queries that return object data. ```text API VERSION: 1.0 API SOURCE: NASA/JPL Horizons Lookup API NOTICE: no matches found ``` -------------------------------- ### GET /scout.api - Summary Query Source: https://ssd-api.jpl.nasa.gov/doc/scout This endpoint retrieves summary data from the CNEOS Scout system. It provides a base query to get all available summary data. ```APIDOC ## GET /scout.api ### Description Retrieves summary data for all available objects in the CNEOS Scout system. ### Method GET ### Endpoint `https://ssd-api.jpl.nasa.gov/scout.api` ### Parameters #### Query Parameters - **tdes** (string) - Optional - Specific NEOCP object designation (e.g., "P10vY9r") - **plot** (string) - Optional - Plot files to retrieve (e.g., "el", "ca:el") - **orbits** (integer) - Optional - Sampled orbits and related parameters (e.g., "1") - **eph-start** (string) - Optional - Ephemeris start time (e.g., "now", "2016-09-24T12:00:00") - **eph-stop** (string) - Optional - Ephemeris stop time (e.g., "2016-09-26T06:00:00") - **eph-step** (string) - Optional - Ephemeris time step (e.g., "2h") - **fov-diam** (string) - Optional - Field-of-view diameter (e.g., "5") - **fov-vmag** (string) - Optional - Limiting V-magnitude (e.g., "23.1") ### Request Example ```json { "example": "get all available summary data" } ``` ### Response #### Success Response (200) - **data** (array) - Summary data for the requested objects. #### Response Example ```json { "example": "response data" } ``` ``` -------------------------------- ### JSON Output Sample for Multiple Matches Source: https://ssd-api.jpl.nasa.gov/doc/horizons_lookup This JSON output illustrates results when a query matches multiple objects. It contains the 'signature' object for version checking, a 'count' greater than one, and a 'result' array populated with multiple JSON objects, each detailing a matched item. Always compare the 'version' in 'signature' with the documented version. ```json { "signature" : { "source" : "NASA/JPL Horizons Lookup API", "version" : "1.0" }, "count" : 3, "result" : [ { "name" : "Juno (spacecraft)", "pdes" : null, "spkid" : "-61", "type" : "spacecraft", "alias" : [] }, { "name" : "Juno Centaur Stage (spacecraft)", "pdes" : null, "spkid" : "-610", "type" : "spacecraft", "alias" : [] }, { "name" : "3 Juno", "pdes" : "A804 RA", "spkid" : "20000003", "type" : "asteroid (integrated barycenter)", "alias" : [ "I04R00A" ] } ] } ``` -------------------------------- ### Scout API: Get All Summary Data Source: https://ssd-api.jpl.nasa.gov/doc/scout Retrieves all available summary data from the Scout API. This is a basic GET request to the API endpoint without any specific query parameters. ```HTTP GET https://ssd-api.jpl.nasa.gov/scout.api ```