Sunrise/Sunset Times

About This Endpoint

This API endpoint will give you the sunrise/sunset times, length of day, and comparison to the current day for the following time frames:

  • day 0 (today)
  • day 1 (tomorrow)
  • day 7 (one week from now)
  • day 30 (one month from now)
  • day 60 (two months from now)

Using the Query Builder

Sun Query Builder

With the Query Builder, you can click, drag, and zoom a map to select your location and select the output format you wish to receive from the API URL. As you move the map, your URL to use will update automatically. Click the Copy button next to the URL to copy it to your clipboard, and paste it into your script to download the results. The generated URL will automatically include your account's API key.

  • Tip: To get to your desired location faster, click the locate control below the zoom buttons on the map to automatically select your browser's approximate location. You can then zoom and drag the map to get the marker to the location you want.

Do It Yourself

The /astro/sun endpoint accepts the following query parameters:

  • lat
    • (Required) Latitude of the location to get sunrise/sunset times.
  • lon
    • (Required) Longitude of the location to get sunrise/sunset times.
  • format
    • (Optional) Receive results in this format. Defaults to json. WSI Max users will need to use csv.
  • apikey
    • (Required) Your account's API key.