Skip to content

Astronomy

All endpoints are prefixed with /v1/astronomy/. All calculations are computed by Pxie in real time — no external API calls.

Coverage: Global — pure computation, any lat/lon on Earth.

Update frequency: Real-time — computed per request with no caching. Results reflect the exact timestamp provided (or current time).

Param Type Required Description
lat float yes Latitude (-90 to 90)
lon float yes Longitude (-180 to 180)
ts int no Unix timestamp (default: now; 0 also means now)

Credits: 1 | Tier: All

Moon phase, illumination, position, and rise/set times.

Terminal window
curl -H "X-API-Key: YOUR_KEY" \
"https://api.pxie.ai/v1/astronomy/moon?lat=45.5&lon=-75.5"
{
"time_utc": 1710187200,
"phase_name": "Waxing Gibbous",
"illumination_pct": 78.3,
"age_days": 10.45,
"stage": "waxing",
"altitude_deg": 42.15,
"azimuth_deg": 195.8,
"rise": 1710165600,
"set": 1710208800,
"visibility_factor": 0.72
}
Field Description
phase_name One of: New Moon, Waxing Crescent, First Quarter, Waxing Gibbous, Full Moon, Waning Gibbous, Last Quarter, Waning Crescent
illumination_pct Percent illuminated (0–100)
age_days Days since last new moon (0–29.53)
stage waxing or waning
altitude_deg Degrees above horizon (negative = below)
azimuth_deg Degrees from north (0=N, 90=E, 180=S, 270=W)
rise / set Unix timestamps for moonrise/moonset during the UTC calendar day of ts (null if no event that day)
visibility_factor 0.5–1.0 factor for stargazing scoring (1.0 = moon below horizon)

Source: Pxie


Credits: 1 | Tier: All

Sun position, rise/set times, and twilight stage. rise and set are for the UTC calendar day of ts, not the local day, so near midnight UTC they can belong to a neighbouring local date.

Terminal window
curl -H "X-API-Key: YOUR_KEY" \
"https://api.pxie.ai/v1/astronomy/sun?lat=45.5&lon=-75.5"
{
"time_utc": 1710187200,
"altitude_deg": -12.5,
"azimuth_deg": 310.2,
"twilight_stage": "nautical",
"rise": 1710158400,
"set": 1710198000
}
Stage Sun Altitude
day Above -0.833°
civil -0.833° to -6°
nautical -6° to -12°
astronomical -12° to -18°
night Below -18°

Source: Pxie


Credits: 1 | Tier: All

Darkness factor for a given location and time.

Terminal window
curl -H "X-API-Key: YOUR_KEY" \
"https://api.pxie.ai/v1/astronomy/darkness?lat=45.5&lon=-75.5"
{
"time_utc": 1710187200,
"darkness": 0.8523,
"twilight_stage": "astronomical",
"sun_altitude_deg": -15.2
}
Value Meaning
0.0 Full daylight (sun above horizon)
0.5 Mid-twilight
1.0 Full astronomical darkness (sun below -18°)

Source: Pxie


Credits: 1 | Tier: Builder+

Geomagnetic coordinates and Magnetic Local Time (MLT). MLT indicates the observer’s position relative to the subsolar point in geomagnetic coordinates — critical for aurora probability and radiation-belt modelling.

Terminal window
curl -H "X-API-Key: YOUR_KEY" \
"https://api.pxie.ai/v1/astronomy/geomagnetic-time?lat=62.0&lon=-75.5"
{
"time_utc": 1710187200,
"geographic_lat": 62.0,
"geographic_lon": -75.5,
"geomagnetic_lat_deg": 72.14,
"geomagnetic_lon_deg": -12.83,
"mlt_hours": 21.45,
"magnetic_time_factor": 0.97,
"mlt_sector": "midnight"
}
Field Description
geomagnetic_lat_deg Geomagnetic latitude in degrees
geomagnetic_lon_deg Geomagnetic longitude in degrees
mlt_hours Magnetic Local Time (0–24 hours)
magnetic_time_factor 0–1 factor for aurora probability (peaks near midnight MLT)
mlt_sector One of: dawn, noon, dusk, midnight
Sector MLT Range Aurora Relevance
midnight 21:00–03:00 Highest aurora probability
dawn 03:00–09:00 Substorm recovery arcs
noon 09:00–15:00 Dayside cusp aurora
dusk 15:00–21:00 Moderate probability

Source: Pxie