# Sunrise, Sunset, Golden Hour & Moon Phase Scraper (`scrapers_lat/sunrise-sunset-moon-phase-scraper`) Actor

Get sunrise, sunset, solar noon, day length, all twilight phases, golden and blue hour windows and moon phase for any city or coordinates and date. Local time plus UTC. Export to JSON, CSV or Excel.

- **URL**: https://apify.com/scrapers\_lat/sunrise-sunset-moon-phase-scraper.md
- **Developed by:** [Scrapers Lat](https://apify.com/scrapers_lat) (community)
- **Categories:** Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $7.56 / 1,000 sun and moon results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

[![Sunrise, Sunset, Golden Hour & Moon Phase Scraper](https://scrapers.lat/banners/sunrise-sunset-moon-phase-scraper.png)](https://console.apify.com/actors/HYFuT4LRAzmuj7mZZ/input)

## Sunrise, Sunset, Golden Hour & Moon Phase Scraper

Here is one real result, with every field the actor returns:

```json
{
  "input": "Nairobi, Kenya",
  "resolvedLocation": "Nairobi",
  "country": "Kenya",
  "admin1": "Nairobi County",
  "latitude": -1.28333,
  "longitude": 36.81667,
  "timezone": "Africa/Nairobi",
  "date": "2026-08-23",
  "sunrise": "2026-08-23T06:31:57+03:00",
  "sunriseUtc": "2026-08-23T03:31:57.000Z",
  "sunset": "2026-08-23T18:38:50+03:00",
  "sunsetUtc": "2026-08-23T15:38:50.000Z",
  "solarNoon": "2026-08-23T12:35:24+03:00",
  "solarNoonUtc": "2026-08-23T09:35:24.000Z",
  "dayLength": "12:06:53",
  "dayLengthHours": 12.1,
  "civilDawn": "2026-08-23T06:11:57+03:00",
  "civilDusk": "2026-08-23T18:58:51+03:00",
  "nauticalDawn": "2026-08-23T05:47:28+03:00",
  "nauticalDusk": "2026-08-23T19:23:19+03:00",
  "astronomicalDawn": "2026-08-23T05:22:58+03:00",
  "astronomicalDusk": "2026-08-23T19:47:49+03:00",
  "morningGoldenHourStart": "2026-08-23T06:31:57+03:00",
  "morningGoldenHourEnd": "2026-08-23T07:31:57+03:00",
  "eveningGoldenHourStart": "2026-08-23T17:38:50+03:00",
  "eveningGoldenHourEnd": "2026-08-23T18:38:50+03:00",
  "morningBlueHourStart": "2026-08-23T06:11:57+03:00",
  "morningBlueHourEnd": "2026-08-23T06:31:57+03:00",
  "eveningBlueHourStart": "2026-08-23T18:38:50+03:00",
  "eveningBlueHourEnd": "2026-08-23T18:58:51+03:00",
  "moonPhaseName": "Waxing Gibbous",
  "moonIlluminationPct": 79.4,
  "moonAgeDays": 10.34,
  "nextFullMoon": "2026-08-27",
  "nextNewMoon": "2026-09-11",
  "weekAhead": null,
  "aiBestShootingWindow": null,
  "aiGoldenHourTips": null,
  "aiBlueHourTips": null,
  "aiMoonPhotographyTips": null,
  "aiOverallAdvice": null,
  "source": "sunrise-sunset.org + computed astronomy",
  "observedAt": "2026-08-23T12:38:45.405Z",
  "error": null
}
```

The most complete sun and moon scraper available. It returns sunrise, sunset, solar noon and day length, all three twilight phases, the morning and evening golden and blue hour windows, and full moon phase data with the next full and new moon, for any city name or coordinate pair and any date, in local time and UTC.

**📥 [Input](https://apify.com/scrapers_lat/sunrise-sunset-moon-phase-scraper/input-schema) · 📤 [Output](https://apify.com/scrapers_lat/sunrise-sunset-moon-phase-scraper/output-schema) · 💰 [Pricing](https://apify.com/scrapers_lat/sunrise-sunset-moon-phase-scraper/pricing) · ▶️ [Examples](https://apify.com/scrapers_lat/sunrise-sunset-moon-phase-scraper/examples)**

![Apify](https://img.shields.io/badge/Platform-Apify-1CE1CE?logo=apify\&logoColor=white)
![Coverage](https://img.shields.io/badge/Coverage-Worldwide-blue)
![Output](https://img.shields.io/badge/Output-JSON%20%7C%20CSV%20%7C%20Excel-orange)
![Billing](https://img.shields.io/badge/Billing-Pay%20per%20result-brightgreen)

### Table of contents

- [What it does](#what-it-does)
- [Why choose this](#why-choose-this)
- [How we compare](#how-we-compare)
- [Quickstart](#quickstart)
- [Use cases](#use-cases)
- [Input reference](#input-reference)
- [Output reference](#output-reference)
- [Example output record](#example-output-record)
- [Run via API and CLI](#run-via-api-and-cli)
- [Fetch results](#fetch-results)
- [Billing](#billing)
- [FAQ and troubleshooting](#faq-and-troubleshooting)

### What it does

Give it a list of locations and a date. For each location the actor resolves the place to coordinates (you can pass a city name like `Sydney, Australia` or a `latitude,longitude` pair), fetches the sun times, computes the golden and blue hour windows and the moon phase, and writes one record with every field above. Every time is returned twice, once in the location's own timezone with the correct offset and once in UTC, so you never have to convert.

Twilight phases that do not occur on a given day (for example astronomical twilight during the polar summer) are returned as `null` rather than a bogus value. Moon phase, illumination, moon age and the next full and new moon are computed deterministically from the date, so they are consistent worldwide for the same day.

### Why choose this

- **All twilight phases**: civil, nautical and astronomical dawn and dusk, not just sunrise and sunset.
- **Golden and blue hour windows**: morning and evening, with a start and end time each, ready for planning a shoot.
- **Full moon data**: phase name, illumination percent, moon age in days, plus the next full moon and next new moon dates.
- **City names or coordinates**: pass `Reykjavik, Iceland` or `-1.28,36.82`. Geocoding is built in and not charged.
- **Local time and UTC**: every timestamp in both, with the correct timezone offset per location.
- **One run, many locations**: loop over a whole list of cities in a single run.
- **Optional 7-day week ahead** and **optional AI photography tips** as opt-in add-ons.

### How we compare

| Capability | This actor | sunrise-sunset.org API | sunrisesunset.io | Typical Apify sun-times actor |
|---|---|---|---|---|
| Sunrise, sunset, solar noon | Yes | Yes | Yes | Yes |
| Civil, nautical, astronomical twilight | Yes (all three) | Yes | Partial | Yes |
| Golden hour window (start and end) | Yes (morning and evening) | No | Golden hour only | Sometimes |
| Blue hour window (start and end) | Yes (morning and evening) | No | No | Rarely |
| Moon phase name and illumination | Yes | No | Yes | Rarely |
| Next full moon and next new moon dates | Yes | No | No | No |
| City name input (geocoded) | Yes | No (coordinates only) | No (coordinates only) | Sometimes |
| Local time and UTC in one record | Yes | Single timezone | Single timezone | Varies |
| Many locations per run | Yes | One call per location | One call per location | Varies |
| AI photography tips add-on | Yes | No | No | No |

Most alternatives cover either the sun side or the moon side, in a single timezone, one location at a time. This actor unifies sun times, every twilight phase, both golden and blue hour windows, and full moon phase data with the next full and new moon, for a whole list of cities in one run, in local time and UTC.

### Quickstart

Open the actor, paste this into the input, and press Run. It returns today's sun and moon data for three cities.

```json
{
  "locations": ["Reykjavik, Iceland", "Nairobi, Kenya", "Sydney, Australia"],
  "date": "2026-08-23"
}
```

Leave `date` empty to use today (UTC). Every field except `locations` is optional.

### Use cases

- **Photographers**: plan a shoot around the exact golden and blue hour windows in local time for any city.
- **Outdoor, fishing and hunting**: line up sunrise, sunset, twilight and moon phase for a trip date.
- **Weather and religious apps**: feed daily sunrise, sunset, twilight and moon phase into an app for any location.
- **Astronomy and night photography**: use moon illumination and the next new moon to find the darkest nights.
- **Solar and energy planning**: use solar noon and day length across a set of sites.

### Input reference

| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| `locations` | array | yes | (none) | One or more locations. Each item is a place name like `Reykjavik, Iceland` or `Sydney` (auto-geocoded), or a `latitude,longitude` pair like `-33.87,151.21`. One record is returned per location. |
| `date` | string | no | today (UTC) | Calendar date as `YYYY-MM-DD`, for example `2026-08-23`. Past and future dates are supported. |
| `includeWeekAhead` | boolean | no | `false` | Add-on. Adds a 7-day table (sunrise, sunset, solar noon, day length, moon phase) for the next seven days per location. Billed only when returned. Paid Apify plans only. |
| `aiPhotographyTips` | boolean | no | `false` | Add-on. Adds AI-written photography guidance per location (best window, golden and blue hour tips, moon photography tips). Billed only when produced. Paid Apify plans only. |
| `maxResults` | integer | no | `10` | Maximum number of locations to return in one run. Free Apify plans are capped at 10. |

### Output reference

One dataset item per location. Times are ISO 8601 strings; fields are `null` when the value is absent (for example a twilight phase that does not occur that day).

| Field | Type | Description |
|---|---|---|
| `input` | string | The location string you passed in. |
| `resolvedLocation` | string | Resolved place name from geocoding. |
| `country` | string | Country of the resolved location. |
| `admin1` | string | State or region of the resolved location. |
| `latitude` | number | Latitude used for the query. |
| `longitude` | number | Longitude used for the query. |
| `timezone` | string | IANA timezone used for the local times. |
| `date` | string | Calendar date the record is for (`YYYY-MM-DD`). |
| `sunrise` / `sunriseUtc` | string | Sunrise in local time and in UTC. |
| `sunset` / `sunsetUtc` | string | Sunset in local time and in UTC. |
| `solarNoon` / `solarNoonUtc` | string | Solar noon (sun at its highest) in local time and UTC. |
| `dayLength` | string | Length of daylight as `HH:MM:SS`. |
| `dayLengthHours` | number | Length of daylight in decimal hours. |
| `civilDawn` / `civilDusk` | string | Civil twilight begin and end, local time (UTC variants also returned). |
| `nauticalDawn` / `nauticalDusk` | string | Nautical twilight begin and end, local time (UTC variants also returned). |
| `astronomicalDawn` / `astronomicalDusk` | string | Astronomical twilight begin and end, local time. `null` during polar day or night (UTC variants also returned). |
| `morningGoldenHourStart` / `morningGoldenHourEnd` | string | Morning golden hour window (UTC variants also returned). |
| `eveningGoldenHourStart` / `eveningGoldenHourEnd` | string | Evening golden hour window (UTC variants also returned). |
| `morningBlueHourStart` / `morningBlueHourEnd` | string | Morning blue hour window, the civil dawn to sunrise band (UTC variants also returned). |
| `eveningBlueHourStart` / `eveningBlueHourEnd` | string | Evening blue hour window, the sunset to civil dusk band (UTC variants also returned). |
| `moonPhaseName` | string | Moon phase (New Moon, Waxing Crescent, First Quarter, Waxing Gibbous, Full Moon, Waning Gibbous, Last Quarter, Waning Crescent). |
| `moonIlluminationPct` | number | Percent of the moon's disc illuminated (0 to 100). |
| `moonAgeDays` | number | Days since the last new moon (0 to about 29.5). |
| `nextFullMoon` | string | Date of the next full moon (`YYYY-MM-DD`). |
| `nextNewMoon` | string | Date of the next new moon (`YYYY-MM-DD`). |
| `weekAhead` | array | 7-day table of sunrise, sunset, solar noon, day length and moon phase (week-ahead add-on), else `null`. |
| `aiBestShootingWindow` | string | AI-suggested best shooting window (AI add-on), else `null`. |
| `aiGoldenHourTips` | string | AI golden hour shooting tips (AI add-on), else `null`. |
| `aiBlueHourTips` | string | AI blue hour shooting tips (AI add-on), else `null`. |
| `aiMoonPhotographyTips` | string | AI moon and night photography tips for the phase (AI add-on), else `null`. |
| `aiOverallAdvice` | string | AI overall photography advice (AI add-on), else `null`. |
| `source` | string | Data source. |
| `observedAt` | string | ISO 8601 timestamp of when the record was produced. |
| `error` | string | `null` on success. On a failed location, one item with a populated `error` is written instead. |

### Example output record

Real record from a live run, Sydney on 2026-08-23:

```json
{
  "input": "Sydney, Australia",
  "resolvedLocation": "Sydney",
  "country": "Australia",
  "admin1": "New South Wales",
  "latitude": -33.86785,
  "longitude": 151.20732,
  "timezone": "Australia/Sydney",
  "date": "2026-08-23",
  "sunrise": "2026-08-23T06:23:48+10:00",
  "sunset": "2026-08-23T17:32:01+10:00",
  "solarNoon": "2026-08-23T11:57:55+10:00",
  "dayLength": "11:08:13",
  "dayLengthHours": 11.1,
  "civilDawn": "2026-08-23T05:59:42+10:00",
  "civilDusk": "2026-08-23T17:56:08+10:00",
  "astronomicalDawn": "2026-08-23T05:01:32+10:00",
  "morningGoldenHourStart": "2026-08-23T06:23:48+10:00",
  "morningGoldenHourEnd": "2026-08-23T07:23:48+10:00",
  "eveningGoldenHourStart": "2026-08-23T16:32:01+10:00",
  "eveningGoldenHourEnd": "2026-08-23T17:32:01+10:00",
  "morningBlueHourStart": "2026-08-23T05:59:42+10:00",
  "morningBlueHourEnd": "2026-08-23T06:23:48+10:00",
  "moonPhaseName": "Waxing Gibbous",
  "moonIlluminationPct": 79.4,
  "moonAgeDays": 10.34,
  "nextFullMoon": "2026-08-27",
  "nextNewMoon": "2026-09-11",
  "source": "sunrise-sunset.org + computed astronomy",
  "error": null
}
```

### Run via API and CLI

Run synchronously and get dataset items in one call. Replace `<TOKEN>` with your Apify API token.

```bash
curl -X POST "https://api.apify.com/v2/acts/scrapers_lat~sunrise-sunset-moon-phase-scraper/run-sync-get-dataset-items?token=<TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"locations":["Reykjavik, Iceland","Nairobi, Kenya","Sydney, Australia"],"date":"2026-08-23"}'
```

Start a run asynchronously:

```bash
curl -X POST "https://api.apify.com/v2/acts/scrapers_lat~sunrise-sunset-moon-phase-scraper/runs?token=<TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"locations":["-33.87,151.21"],"date":"2026-12-21","includeWeekAhead":true}'
```

Apify CLI:

```bash
apify call scrapers_lat/sunrise-sunset-moon-phase-scraper \
  --input '{"locations":["Paris, France"],"aiPhotographyTips":true}'
```

### Fetch results

Every run writes to a dataset. Fetch items as JSON, CSV, or Excel by changing `format`:

```bash
## JSON
curl "https://api.apify.com/v2/datasets/<DATASET_ID>/items?token=<TOKEN>&clean=true&format=json"

## CSV
curl "https://api.apify.com/v2/datasets/<DATASET_ID>/items?token=<TOKEN>&clean=true&format=csv"
```

`<DATASET_ID>` is returned as `defaultDatasetId` in the run object.

### Billing

- **Pay per result.** You are charged per location returned (`result` event). See the [pricing tab](https://apify.com/scrapers_lat/sunrise-sunset-moon-phase-scraper/pricing) for the current price.
- **Opt-in add-ons.** The 7-day week ahead (`week_ahead`) and AI photography tips (`ai_photography_tips`) are charged only when they actually return data, and only on paid Apify plans.
- **No charge on failure.** A location that cannot be resolved is written as a single item with a populated `error` field and is not charged. Empty runs cost nothing.
- **Spend cap respected.** Set `maxTotalChargeUsd` on the run; once reached, the actor stops emitting and charging further results.
- **Free Apify plans** are capped at 10 locations per run, with add-ons disabled.

### FAQ and troubleshooting

**Can I pass a city name instead of coordinates?**
Yes. Pass `Reykjavik, Iceland` or just `Sydney`. The actor geocodes it, and geocoding is not charged. You can also pass a `latitude,longitude` pair.

**Why is `astronomicalDawn` null for some locations?**
At high latitudes in summer the sun never drops far enough below the horizon for astronomical twilight, so the phase does not occur that day. The actor returns `null` rather than inventing a time.

**Are times in local time or UTC?**
Both. Every timestamp is returned in the location's own timezone with the correct offset, and again as a `...Utc` field in UTC.

**How accurate is the moon phase?**
Moon phase, illumination and moon age are computed from a standard synodic-month model and are consistent worldwide for the same date. The next full and new moon dates are computed the same way.

**What is the difference between golden hour and blue hour here?**
Golden hour is the warm hour just after sunrise and just before sunset. Blue hour is the cooler band during civil twilight, from civil dawn to sunrise in the morning and from sunset to civil dusk in the evening.

**Is this an official tool?**
No. This actor is independent and has no affiliation with any data provider. It reads only publicly available data.

### Related scrapers

- [Air Quality, AQI, Pollen & UV Scraper](https://apify.com/scrapers_lat/air-quality-aqi-pollen-scraper): live air quality and UV for any city or coordinates.
- [Weather Forecast Scraper](https://apify.com/scrapers_lat/open-meteo-weather-scraper): hourly and daily weather forecast worldwide.
- [Earthquakes Scraper](https://apify.com/scrapers_lat/usgs-earthquakes-scraper): recent earthquakes with magnitude and location.
- [Countries Data Scraper](https://apify.com/scrapers_lat/rest-countries-scraper): population, languages and currencies by country.

### More scrapers at scrapers.lat

Built and maintained by [scrapers.lat](https://scrapers.lat), where we publish scrapers for public platforms: registries, government data, finance, e-commerce and more. Browse the catalog or request a custom scraper at [scrapers.lat](https://scrapers.lat).

***

> Independent tool, not affiliated with any data provider. Accesses only publicly available astronomical data.

# Actor input Schema

## `locations` (type: `array`):

One or more locations. Each item can be a place name like "Reykjavik, Iceland" or "Sydney" (auto-geocoded), OR a "latitude,longitude" pair like "-33.87,151.21". One record is returned per location.

## `date` (type: `string`):

Calendar date to compute for, as YYYY-MM-DD (for example 2026-08-23). Defaults to today (UTC). Past and future dates are supported.

## `includeWeekAhead` (type: `boolean`):

Add a 7-day table for each location: the next seven days of sunrise, sunset, solar noon, day length and moon phase. Opt-in add-on, billed per location only when the week-ahead data is returned. Available to paid Apify plans.

## `aiPhotographyTips` (type: `boolean`):

Add AI-written photography guidance per location: the best shooting window, golden and blue hour tips, and what the moon phase means for night photography that date. Opt-in add-on, billed per location only when usable tips are produced. Available to paid Apify plans.

## `maxResults` (type: `integer`):

Maximum number of locations to return in one run. Free Apify plans are capped at 10.

## Actor input object example

```json
{
  "locations": [
    "Reykjavik, Iceland",
    "Nairobi, Kenya",
    "Sydney, Australia"
  ],
  "includeWeekAhead": false,
  "aiPhotographyTips": false,
  "maxResults": 10
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "locations": [
        "Reykjavik, Iceland",
        "Nairobi, Kenya",
        "Sydney, Australia"
    ],
    "maxResults": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapers_lat/sunrise-sunset-moon-phase-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "locations": [
        "Reykjavik, Iceland",
        "Nairobi, Kenya",
        "Sydney, Australia",
    ],
    "maxResults": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("scrapers_lat/sunrise-sunset-moon-phase-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "locations": [
    "Reykjavik, Iceland",
    "Nairobi, Kenya",
    "Sydney, Australia"
  ],
  "maxResults": 10
}' |
apify call scrapers_lat/sunrise-sunset-moon-phase-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,scrapers_lat/sunrise-sunset-moon-phase-scraper"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/HYFuT4LRAzmuj7mZZ/builds/Iz1aat7APfbX4hkSs/openapi.json
