Sun Position API — sunrise, sunset & golden hour times
Pricing
from $0.35 / 1,000 sun data rows
Sun Position API — sunrise, sunset & golden hour times
Compute sunrise, sunset, golden hour and twilight times plus the sun's elevation and azimuth for any locations and dates, in each location's local time zone. One row per location and date, or per location and time.
Pricing
from $0.35 / 1,000 sun data rows
Rating
0.0
(0)
Developer
AI Mojo
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
3 days ago
Last modified
Categories
Share
Sun position API — sunrise, sunset, golden hour and twilight times
Sun Position API computes sunrise, sunset, solar noon, day length, golden hour, blue hour and civil, nautical and astronomical twilight times, plus the sun's elevation and azimuth, for any list of locations and dates. Every time is given in each location's local time zone, which is looked up from its coordinates. You get one row per location and date, or one row per location and time when you set a step in minutes. It is built for photographers planning golden hour and blue hour shoots, solar engineers and architects studying sun angles and shading, agriculture teams tracking day length, and app developers who need sun times in bulk without running their own calculations. To try it, press Start: the prefilled Greenwich Observatory example returns its result in seconds.
How to get sunrise, sunset and golden hour times
- Add your places to Locations as a JSON list. Each location needs a latitude and a longitude, and can have a name.
- Set Start date, and optionally End date to compute a range of local calendar dates.
- Optionally set Step (minutes) to get the sun elevation and sun azimuth through each day, for example every 15 minutes.
- Optionally set Time zone to use one IANA time zone for every location instead of each location's own local time zone.
- Press Start and wait for the run to finish.
- Open the Output tab to view the rows, then download them as JSON, CSV, Excel, XML or HTML.
- To automate it, call the actor through the Apify API, or connect it to Make, Zapier, Google Sheets or a webhook with Apify integrations.
Input
| Field | Type | Default | Description |
|---|---|---|---|
locations | array of objects | none (required) | The places to compute sun times and sun positions for. Each has a latitude (-90 to 90), a longitude (-180 to 180, east positive) and an optional name. Up to 1,000 locations. |
startDate | string | none (required) | The first local calendar date to compute, as YYYY-MM-DD. |
endDate | string | the start date | The last local calendar date to compute, as YYYY-MM-DD, at most 366 days after the start date counting both. |
stepMinutes | integer | none | When set (1 to 1440), returns one row per location for every step through each local day, with the sun's elevation and azimuth at that time. Leave empty for one row per location per date. |
timeZone | string | looked up per location | An IANA time zone name such as Europe/London, used for every location instead of the zone looked up from its coordinates. |
Example input (the prefilled values):
{"locations": [{ "name": "Greenwich Observatory", "latitude": 51.4769, "longitude": -0.0005 }],"startDate": "2026-06-21"}
Output
Each dataset item is one location and local date (a once-per-day row), or one location and time when Step (minutes) is set. A sun event that does not happen on the date is null.
Example row for the prefilled input. On the June solstice the sun never sinks 18° below the horizon at Greenwich, so astronomical twilight is null:
{"id": "51.4769,-0.0005,2026-06-21","name": "Greenwich Observatory","latitude": 51.4769,"longitude": -0.0005,"timeZone": "Europe/London","date": "2026-06-21","time": null,"elevation": null,"azimuth": null,"polar": null,"sunrise": "2026-06-21T04:43:59+01:00","sunset": "2026-06-21T21:22:01+01:00","solarNoon": "2026-06-21T13:03:00+01:00","dayLengthMinutes": 998.03,"civilDawn": "2026-06-21T03:56:17+01:00","civilDusk": "2026-06-21T22:09:43+01:00","nauticalDawn": "2026-06-21T02:41:50+01:00","nauticalDusk": "2026-06-21T23:24:10+01:00","astronomicalDawn": null,"astronomicalDusk": null,"goldenHourMorningStart": "2026-06-21T04:15:45+01:00","goldenHourMorningEnd": "2026-06-21T05:38:11+01:00","goldenHourEveningStart": "2026-06-21T20:27:49+01:00","goldenHourEveningEnd": "2026-06-21T21:50:14+01:00","blueHourMorningStart": "2026-06-21T03:56:17+01:00","blueHourMorningEnd": "2026-06-21T04:15:45+01:00","blueHourEveningStart": "2026-06-21T21:50:14+01:00","blueHourEveningEnd": "2026-06-21T22:09:43+01:00"}
All times are local time in the location's time zone, as ISO 8601 with that zone's offset.
| Field | Type | Description |
|---|---|---|
id | string | Stable row ID: <latitude>,<longitude>,<date>, plus ,<UTC instant> for a row at a specific time. It stays the same across runs. |
name | string or null | The location's name as given in the input. |
latitude | number | The location's latitude in decimal degrees (north positive). |
longitude | number | The location's longitude in decimal degrees (east positive). |
timeZone | string | The location's IANA time zone, for example Europe/London. |
date | string | The local calendar date, YYYY-MM-DD. All sun events in the row happen on this date. |
time | string or null | The instant the sun elevation and sun azimuth are computed for. Null for a once-per-day row. |
elevation | number or null | Sun elevation above the horizon in degrees (negative below it), geometric, without atmospheric refraction. Null when time is null. |
azimuth | number or null | Sun azimuth in degrees clockwise from true north (0 to 360). Null when time is null. |
polar | string or null | Polar day or night: day when the sun never sets on the date, night when it never rises, otherwise null. |
sunrise | string or null | When the sun's upper edge rises above the horizon. |
sunset | string or null | When the sun's upper edge sets below the horizon. |
solarNoon | string or null | When the sun is highest in the sky. |
dayLengthMinutes | number | Minutes from sunrise to sunset; 1440 in polar day and 0 in polar night. |
civilDawn | string or null | Civil twilight begins: the sun's center rises to 6° below the horizon. |
civilDusk | string or null | Civil twilight ends: the sun's center sets to 6° below the horizon. |
nauticalDawn | string or null | Nautical twilight begins: the sun rises to 12° below the horizon. |
nauticalDusk | string or null | Nautical twilight ends: the sun sets to 12° below the horizon. |
astronomicalDawn | string or null | Astronomical twilight begins: the sun rises to 18° below the horizon. |
astronomicalDusk | string or null | Astronomical twilight ends: the sun sets to 18° below the horizon. |
goldenHourMorningStart | string or null | Morning golden hour starts: the sun rises to 4° below the horizon. |
goldenHourMorningEnd | string or null | Morning golden hour ends: the sun rises to 6° above the horizon. |
goldenHourEveningStart | string or null | Evening golden hour starts: the sun sets to 6° above the horizon. |
goldenHourEveningEnd | string or null | Evening golden hour ends: the sun sets to 4° below the horizon. |
blueHourMorningStart | string or null | Morning blue hour starts: the sun rises to 6° below the horizon. |
blueHourMorningEnd | string or null | Morning blue hour ends: the sun rises to 4° below the horizon. |
blueHourEveningStart | string or null | Evening blue hour starts: the sun sets to 4° below the horizon. |
blueHourEveningEnd | string or null | Evening blue hour ends: the sun sets to 6° below the horizon. |
The run also saves a short summary in the Run summary output.
Pricing
This actor uses pay-per-event pricing: you pay for each sun data row delivered to your dataset, and nothing for pages or requests.
How much does it cost to get 1,000 results?
$0.50 per 1,000 sun data rows ($0.0005 per row), lower on paid Apify plans.
- You're charged only for rows delivered to your dataset.
- The run stops when it reaches your maximum charge per run setting, so you never pay more than you set.
- Apify adds a small fee for each run start.
For example, one location for a full year of dates is 365 rows, about $0.18. One location every 15 minutes for a typical 24-hour day is 96 rows, about $0.05.
Limits & accuracy
- Up to 1,000 locations, 366 days and 1,000,000 rows per run. A larger input is rejected before any row is computed.
- Sun elevation and sun azimuth are within about half a degree of NOAA's solar calculator when the sun is more than 5° above the horizon.
- Sun elevation is geometric: no atmospheric refraction is applied, so near the horizon it reads a little lower than what you see.
- In polar day or polar night,
polarisdayornightandsunriseandsunsetare null.
Compliance & licences
- All results are computed. No website or API is contacted at run time, and no personal data is collected.
- Sun times and positions use the suncalc library, BSD-2-Clause licence, Copyright (c) 2014, Vladimir Agafonkin.
- Time zones are looked up offline with the tz-lookup library, released under CC0 1.0 by The Dark Sky Company, LLC. This licence covers the library itself.
- The time zone boundary data inside tz-lookup is sourced from Evan Siroky's timezone-boundary-builder, which is built from OpenStreetMap. That upstream project's own README ("Licenses" section) states that its output data is licensed under the Open Data Commons Open Database License (ODbL). Time zone boundary data © OpenStreetMap contributors.
FAQ
Is it legal to use this sun data?
The actor collects nothing from any website: every sunrise, sunset and sun position is calculated from astronomy formulas, and no personal data is involved. You are still responsible for how you use the data; if you are unsure, ask a lawyer about your use case.
Which time zone are the times in?
Each location's local time zone, looked up from its coordinates. A point at sea gets a fixed-offset zone such as Etc/GMT+3. Set Time zone to use one zone for every location.
Why are some golden hour or twilight times null?
Near the poles, or near midsummer at high latitudes, the sun may never reach that angle on the date. The field is then null rather than a guess.
Where can I report an issue or request a feature?
Open the Issues tab on this actor's page and describe the input and what you expected.