Sunset and sunrise times API

We offer a free API that provides sunset and sunrise times for a given latitude and longitude.

Please note that attribution is required if you use our API. Check "Usage limits and attribution" section below for more information.

API documentation

Ours is a very simple REST api, you only have to do a GET request to


Sample requests

These are three sample requests for getting sunset and sunrise information from our API for a given location:


The result data is formatted using JSON. An example:

NOTE: All times are in UTC and summer time adjustments are not included in the returned data.

        "sunrise":"7:27:02 AM",
        "sunset":"5:05:55 PM",
        "solar_noon":"12:16:28 PM",
        "civil_twilight_begin":"6:58:14 AM",
        "civil_twilight_end":"5:34:43 PM",
        "nautical_twilight_begin":"6:25:47 AM",
        "nautical_twilight_end":"6:07:10 PM",
        "astronomical_twilight_begin":"5:54:14 AM",
        "astronomical_twilight_end":"6:38:43 PM"

Response without date formatting:


Status codes

The "status" field within the API response object contains the status of the request. The "status" field may contain the following values:

How to use the API from an AJAX request?

Use the parameter callback to receive a JSONP response and avoid cross domain boundaries:

Usage limits and attribution

The sunrise and sunset API can be used free of charge. You may not use this API in a manner that exceeds reasonable request volume, constitutes excessive or abusive usage. We require that you show attribution to us with a link to our site.


Subscribe to our API newsletter to keep up to date with changes and announcements about the service:



Please contact us for all your API questions.