Sunrise & Sunset Times API

Sunrise, sunset, solar noon, day length, twilights, golden hour and moon phase for any Vietnamese province or coordinates, for up to 31 days.

GEThttps://apibox.io.vn/v1/sun-times

The sun times API computes, for a date, the sunrise and sunset, solar noon and the sun’s elevation at noon, the day length, civil, nautical and astronomical twilight, and the golden hour (sun between −4° and +6°, the soft light photographers look for), plus the moon phase in Vietnamese and English, its illumination and the next new and full moon.

Give a province (province=hn, a name such as Đà Nẵng, a 2-digit code, or in the path /v1/sun-times/hcm) or any lat and lon. Times are local, UTC+7 by default (tz changes it), and days (up to 31) returns a series starting at date (default: today in Vietnam).

Everything is calculated with the NOAA solar equations, accurate to about a minute, without any external service, so answers are instant. Near the poles the sunrise is null when the sun does not rise.

Parameters

NameInTypeRequiredDefault
provincepath|querystringnoProvince code or name (hn, hcm, Đà Nẵng, 48), as ?province= or in the path. Required unless lat / lon.
latquerynumbernoLatitude (with lon).
lonquerynumbernoLongitude.
datequerystringnoYYYY-MM-DD (default: today in Vietnam).
daysquerynumberno1Number of days (1–31); more than 1 returns a days array.
tzquerynumberno7UTC offset of the returned times, in hours.

Example

curl "https://apibox.io.vn/v1/sun-times?province=Hà Nội&date=2026-11-11" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response

{
  "location": {
    "lat": 21.0285,
    "lon": 105.8542,
    "province_code": "01",
    "province": "Thành phố Hà Nội",
    "location": "Hà Nội"
  },
  "timezone_offset": 7,
  "date": "2026-11-11",
  "sunrise": "06:04",
  "sunset": "17:17",
  "solar_noon": "11:40",
  "day_length": "11h13",
  "day_length_hours": 11.21,
  "solar_noon_elevation": 51.7,
  "civil_twilight": {
    "dawn": "05:41",
    "dusk": "17:40"
  },
  "nautical_twilight": {
    "dawn": "05:14",
    "dusk": "18:07"
  },
  "astronomical_twilight": {
    "dawn": "04:48",
    "dusk": "18:33"
  },
  "golden_hour": {
    "morning": [
      "05:50",
      "06:35"
    ],
    "evening": [
      "16:46",
      "17:31"
    ]
  },
  "moon": {
    "phase_vi": "Trăng mới (sóc)",
    "phase_en": "New moon",
    "age_days": 1.5,
    "illumination": 0.024,
    "next_new_moon": "2026-12-09",
    "next_full_moon": "2026-11-24"
  },
  "note": "Times in local time (UTC+7 by default), accurate to about one minute; golden hour = sun between −4° and +6°."
}

Use cases

  • Plan photo and video shoots at golden hour
  • Smart lighting and solar schedules
  • Prayer, festival and outdoor event planning
  • Show sunrise and sunset in weather and travel apps

FAQ

How accurate is it?

About one minute; local relief (mountains, buildings) is not taken into account.

Which point of a province is used?

The province’s administrative centre; send lat and lon for an exact place.

Can I get a whole month?

Yes, days=31 returns 31 days starting at date.

Related APIs

Start with 1,000 free requests every month. Get free API key →