Astronomy Data
get_astronomyRetrieve sunrise, sunset, moonrise, moonset, and sun/moon position for any location or IP address on a specific date.
Instructions
Read-only single-date astronomy lookup via GET /v3/astronomy. Works on free and paid plans. Cost: 1 credit. Use for one date or real-time sun/moon position; use get_astronomy_time_series for daily sunrise, moon, and twilight data across a date range.
Returns { location, astronomy } plus ip for IP/caller lookups. astronomy includes date/current_time, sunrise/sunset, moonrise/moonset, twilight blocks, day_length, sun/moon position, distance, status, moon_phase, moon_illumination_percentage, and moon_angle.
Selector priority is lat/long, location, ip, then caller IP when no selector is provided. lat and long must be provided together; date must be YYYY-MM-DD; elevation must be 0-10000 meters. time_zone changes timestamp formatting to include full dates. lang only changes location fields; non-English lang is paid-only and returns 401 on free plans.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ip | No | IPv4 or IPv6 address to get astronomy data for that IP's location. | |
| lat | No | Latitude coordinate. Highest priority. Must be used with long. | |
| date | No | Date in YYYY-MM-DD format. Defaults to today. | |
| lang | No | Response language for location fields in IP-based lookups (en, de, ru, ja, fr, cn, es, cs, it, ko, fa, pt). Paid plans only. Free plan returns 401 for non-English language values. | |
| long | No | Longitude coordinate. Must be used with lat. | |
| location | No | City or address string (e.g. San Francisco, CA). | |
| elevation | No | Elevation in meters above sea level (0-10000). Affects sunrise/sunset calculations for higher accuracy. | |
| time_zone | No | IANA timezone name to express times in (e.g. America/New_York). If set, time fields include full date instead of just time. |