Free Sunrise, Sunset and Moon API for Developers

Free JSON API for sunrise, sunset, golden and blue hour, twilight, sun position and moon times for any place and date. No key needed – just link back.

  • Sunrise, sunset, golden and blue hour, twilight, sun height and moon times for any place and day – as JSON, free, without a key.
  • GET /api/v2/sun?city=berlin
  • GET /api/v2/sun?lat=52.52&lon=13.405&tz=Europe/Berlin&date=2027-06-21
  • GET /api/v2/cities?q=berl

Parameters

  • city – City slug as in our URLs (sunnytracker.com/berlin → berlin). Find it with /api/v2/cities?q=…
  • lat, lon – Latitude and longitude in degrees, when you don't use city
  • tz – IANA time zone for lat/lon (default UTC), e.g. Europe/Berlin
  • date – Day as YYYY-MM-DD, default today in the place's time zone

Terms

  • Free for websites, apps and research – commercial use included.
  • Show a visible link "Sun data: SunnyTracker" to https://www.sunnytracker.com wherever the data appears.
  • Cache answers (they change once a day) and stay below about 10 requests per second; heavy use: write to us.
  • Times are calculated (NOAA, Meeus), for a flat horizon at sea level. No warranty.

For AI assistants: MCP server

  • Claude, ChatGPT, Cursor and other assistants that speak the Model Context Protocol can use SunnyTracker directly: add the server below and ask for sunrise, golden hour, twilight, moon, clock changes or eclipses anywhere. Every answer carries the page to cite.
  • https://www.sunnytracker.com/mcp
  • search_places: find a city or landmark and its slug
  • sun_and_moon: sun and moon times for a place and date, or a table of up to 31 days
  • clock_changes: the daylight saving time changes of a time zone
  • solar_eclipses: the next solar eclipses seen from a place, with coverage and local times