Sunrise, sunset, solar noon, moonrise, moonset and moon phase

Sunrise, sunset, solar noon, moonrise, moonset and moon phase for a date.

Request

GEThttps://weather.p.apihiver.com/v1/sun-moon?city=Delhi
String. City name, e.g. Mumbai. Give city or coords.
String. ISO country code to pick the right city, e.g. IN.
String. Latitude,longitude, e.g. 19.07,72.87. Give city or coords.
String. YYYY-MM-DD (default today, local)
Language
Client
1curl --request GET \
2  --url 'https://weather.p.apihiver.com/v1/sun-moon?city=Delhi&country=%7Bcountry%7D&coords=%7Bcoords%7D&date=%7Bdate%7D' \
3  --header 'Accept: application/json' \
4  --header 'X-API-Key: YOUR_API_KEY'

Sunrise, sunset, solar noon, moonrise, moonset and moon phase: Weather API reference

Sunrise, sunset, solar noon, moonrise, moonset and moon phase for a date. This endpoint is part of the Weather API: Current weather, 9-day forecasts, hourly forecasts, and sunrise/sunset/moon phase for any city or coordinates worldwide.

Example response (200, application/json)

Success.

1{
2  "date": "2026-09-26",
3  "source": "MET Norway",
4  "sunset": "2026-09-26T18:13+05:30",
5  "moonset": "2026-09-26T05:36+05:30",
6  "sunrise": "2026-09-26T06:11+05:30",
7  "location": {
8    "lat": 28.65195,
9    "lon": 77.23149,
10    "name": "Delhi",
11    "country": "India",
12    "timezone": "Asia/Kolkata",
13    "population": 11034555,
14    "country_code": "IN"
15  },
16  "moonrise": "2026-09-26T17:53+05:30",
17  "moon_phase": "full moon",
18  "solar_noon": "2026-09-26T12:12+05:30",
19  "moon_phase_degrees": 168.63
20}

Errors

  • 400 — A required parameter is missing or a value has the wrong format.
    1{
    2  "error": {
    3    "code": "INVALID_INPUT",
    4    "message": "Pass 'city' (e.g. Mumbai) or 'coords' (lat,lon)."
    5  }
    6}

Gateway errors (missing key, no subscription, rate limits) are listed in Error codes.