Sunrise and Sunset

Get the sunrise and sunset times for the next 60 days at any location worldwide.

Endpoint#

GET /v7/astronomy/sun

Parameters#

Query parameters

  • location (required) The location to be queried, support LocationID or comma-separated longitude and latitude (decimal, up to 2 decimal places), LocationID can be obtained by GeoAPI. Example: location=101010100 or location=116.41,39.92
  • date (required) Set the date, up to 60 days in the future (including today). The date format is yyyyMMdd. Example: date=20200531

Request example#

curl -X GET --compressed \
-H 'Authorization: Bearer your_token' \
'https://your-api-host/v7/astronomy/sun?location=116.41%2C39.92&date=20200531'

Replace your_token and your_api_host with your JWT Authentication and API Host

Try it

Response#

{
  "code": "200",
  "updateTime": "2021-02-17T11:00+08:00",
  "fxLink": "https://www.qweather.com",
  "sunrise": "2021-02-20T06:58+08:00",
  "sunset": "2021-02-20T17:57+08:00",
  "refer": {
    "sources": [
      "https://developer.qweather.com/attribution.html"
    ],
    "license": [
      "QWeather Developers License"
    ]
  }
}
  • code string Status code
  • updateTime date-time API latest update time
  • fxLink uri Responsive web page of this data, for embedded in website or APP
  • sunrise string Sunrise time. Maybe null in high latitude area
  • sunset string Sunset time. Maybe null in high latitude area
  • refer object Data sources and licensing information
    • sources array Data source and other statements, may be null
    • license array Data license, may be null