Sunrise and sunset API

Give a date and coordinates; get sunrise, solar noon, sunset, day length and the three twilights, in local time with the UTC offset that applied that day (historical time zones and daylight saving are resolved from the coordinates), plus the UTC instant and a unix timestamp.

Get a free key Try it in the playground API reference

What you get

Example

curl -X POST https://astro-agent.dev/v1/astronomy/rise-set -H 'Content-Type: application/json' \
  -H "X-Credits-Token: $ASTRO_AGENTS_KEY" -d '{"date":"2026-12-21","latitude":59.3293,"longitude":18.0686}'

A real answer to this request (excerpt). The same request always returns the same result_sha256, which POST https://astro-agent.dev/v1/verify recomputes for free:

{
  "endpoint": "astronomy/rise-set",
  "result": {
    "subject": {
      "timezone": "Europe/Stockholm"
    },
    "sun": {
      "civil_dawn": "2026-12-21T07:47:43+01:00",
      "sunrise": "2026-12-21T08:43:24+01:00",
      "solar_noon": "2026-12-21T11:45:46+01:00",
      "sunset": "2026-12-21T14:48:08+01:00",
      "civil_dusk": "2026-12-21T15:43:48+01:00",
      "day_length_minutes": 364.7
    }
  },
  "meta": {
    "result_sha256": "450ffd67fe6f6e96f7a580ce2490f8d19af50ac58e7cf21f5b5fee6dd013227f"
  }
}

Routes and prices

RouteNamePrice per callWhat it returns
POST /v1/astronomy/rise-setRise, set and twilight times for a place$0.01Rise, transit and set of the Sun, Moon and planets for a place and local day, with civil, nautical and astronomical twilight, day length, golden hour and blue hour.
POST /v1/astronomy/dayAstronomical summary of the day for a place$0.02One call for a day at a place: sunrise, sunset, twilight, day length, golden and blue hour; the Moon's phase, illumination, rise and set; the planets observable that night; the next lunations, planetary stations and eclipse.

The same routes are MCP tools on https://astro-agent.dev/mcp.

Limits

Alternatives

sunrise-sunset.org is free with no key (it asks for a visible attribution link) and sunrisesunset.io is free too. If you only need today's sunrise for a weather widget, they are the simpler choice.

Checked on the providers' own pages on 2026-11-20. Their terms may have changed since.

When Astro Agents fits

Get a free key Try it in the playground API reference