Skip to content

Sun

Access Restriction

This API is a premium service available only to enterprise tier developers. Please contact Caiyun Sales to purchase.

Provides sunrise/sunset times and hourly altitude/azimuth data.

Sunrise/Sunset

Request

http
GET https://singer.caiyunhub.com/v3/astro/sun

Query Parameters

NameRequiredDefaultRangeDescription
tokenYesAPI token; see Authentication
longitudeNo0.0Longitude
latitudeNo0.0Latitude
dailystartNo0-1, 0Day offset; -1 starts from yesterday
daysNo31~15Number of days

Request Example

bash
curl "https://singer.caiyunhub.com/v3/astro/sun?longitude=116&latitude=39&dailystart=-1&days=3&token={token}"

Response Example

json
{
  "data": [
    {
      "date": "2026-01-27",
      "rise": "07:21",
      "set": "17:26",
      "astronomical_dawn_start": "05:30",
      "astronomical_dusk_end": "19:17",
      "civil_dawn_start": "06:52",
      "civil_dusk_end": "17:55",
      "nautical_dawn_start": "06:12",
      "nautical_dusk_end": "18:35",
      "solar_midnight": "00:23",
      "solar_noon": "12:23"
    }
    // ...
  ]
}

Response Fields

JSONPathTypeDescription
$.data[].datestringDate
$.data[].risestringSunrise time, - if not applicable
$.data[].setstringSunset time, - if not applicable
$.data[].astronomical_dawn_startstringAstronomical dawn start, - if not applicable
$.data[].astronomical_dusk_endstringAstronomical dusk end, - if not applicable
$.data[].civil_dawn_startstringCivil dawn start, - if not applicable
$.data[].civil_dusk_endstringCivil dusk end, - if not applicable
$.data[].nautical_dawn_startstringNautical dawn start, - if not applicable
$.data[].nautical_dusk_endstringNautical dusk end, - if not applicable
$.data[].solar_midnightstringSolar midnight, - if not applicable
$.data[].solar_noonstringSolar noon, - if not applicable

Sun Altitude/Azimuth

Provides hourly sun altitude and azimuth data.

Request

http
GET https://singer.caiyunhub.com/v3/astro/sun/location/

Query Parameters

NameRequiredDefaultRangeDescription
tokenYesAPI token; see Authentication
longitudeNo0.0Longitude
latitudeNo0.0Latitude
daysNo11~2Number of days

Request Example

bash
curl "https://singer.caiyunhub.com/v3/astro/sun/location/?longitude=116&latitude=39&days=2&token={token}"

Response Example

json
{
  "data": [
    { "timestamp": 1671638400, "altitude": -74.1515, "azimuth": 348.0473 },
    // ...
    { "timestamp": 1671721200, "altitude": -67.8016, "azimuth": 309.0398 }
  ]
}

Response Fields

JSONPathTypeDescription
$.data[].timestampnumberTimestamp
$.data[].altitudenumberAltitude angle
$.data[].azimuthnumberAzimuth angle