A free API for the sky above

The sky,
in your API.

From the first light to the next full moon. Get sunrise, sunset, moon phases and planetary positions in one simple JSON API.

Free to useNo API keyNo sign-up

Chase the daylight

Sunrise, sunset, twilight and golden hour.
For any coordinates on Earth.

Follow the moon

Moonrise, moonset and lunar phases.
Your next night out, better timed.

Explore the planets

Sidereal and tropical zodiac positions.
Including nakshatras, Rahu and Ketu.

Good to know

A few earthly questions.

Is the sun and moon API free?

Yes. The API is free to use and does not require an account or API key. Send a GET request with your coordinates to retrieve sunrise, sunset, moonrise, moonset and moon phase data.

Can I use this for an astrology app?

The astronomy API provides tropical and sidereal zodiac signs, planetary longitudes, retrograde motion and mean Rahu/Ketu nodes. Sidereal results include nakshatras and padas using an approximate Lahiri ayanamsa. Use /astronomy or /astrology. Birth charts, ascendants, houses and predictions are not included.

Where does the astronomy data come from?

Sun and moon event times use Astral. Planetary positions use Skyfield with the bundled NASA/JPL DE421 ephemeris. Astronomy timestamps must fall between 1900 and 2052. See the astronomy parameters and calculation conventions.

Can I call the API from my website?

Yes. Cross-origin GET requests are supported without credentials. Use your site's JavaScript fetch function with the full API URL. For astronomy timestamps, use URLSearchParams to encode timezone offsets correctly, or supply a UTC timestamp ending in Z.

Why is a sunrise or moonrise time missing?

Some events do not occur on every day or at every latitude. Polar day and polar night can affect solar events, and a moonrise or moonset can fall on the following day. Check for null values and error fields before displaying event times.