Sunset API
Get the sunset time and quality for any city from your own projects. The API returns the sunset time, the quality score and the sky data.
The widget and the API are part of the Pro plan, which is not on sale yet. This page explains how they will work when it arrives.
The API comes with the Pro plan and an access key. See pricing to get started. Your account can make up to 500 requests a day, across all your keys.
Your key
Create your key under My account, API. We show it only once, so keep it somewhere safe. Send it with every request in the Authorization: Bearer your-key header. If a key leaks, revoke it and create a new one.
The request
GET https://atardecer-dehoy.com/api/v1/pronostico/{slug}/A city's slug is the last part of its page address: for New York it is nueva-york-estados-unidos. Slugs are the same in every language.
| Parameter | What it sets |
|---|---|
evento | atardecer (sunset) or amanecer (sunrise). Without it, sunset. |
dias | How many days to include in dias, from 1 to 14, today included. Without it, today only. |
idioma | es, pt or en: the language of the text in the response (the band, the place and its country, error messages). Field names never change. Without it, Spanish. |
curl -H "Authorization: Bearer your-key" \
"https://atardecer-dehoy.com/api/v1/pronostico/nueva-york-estados-unidos/?evento=atardecer&dias=3&idioma=en"The response
This is a real response, from today, for New York, with idioma=en. Times are in UTC, in ISO 8601 format; calidad is the quality score from 0 to 100, banda its band, and estimacion is true when there is no live forecast yet and the figure comes from what is usual for that time of year. The sky fields (cielo) are clouds, humidity, wind, visibility and the chance of rain.
{
"ciudad": {
"slug": "nueva-york-estados-unidos",
"nombre": "New York",
"pais": "United States",
"zonaHoraria": "America/New_York",
"latitud": 40.7143,
"longitud": -74.006
},
"evento": "atardecer",
"hoy": {
"fecha": "2026-10-31",
"hora": "2026-10-31T21:53:00.000Z",
"calidad": 58,
"banda": "Good",
"confianza": "alta",
"estimacion": false,
"cielo": {
"nubesPorcentaje": 0,
"nubesBajasPorcentaje": 0,
"nubesAltasPorcentaje": 0,
"humedadPorcentaje": 39,
"vientoKmh": 7.5,
"visibilidadMetros": 50100,
"probabilidadLluviaPorcentaje": 0
}
},
"dias": [
{
"fecha": "2026-10-31",
"hora": "2026-10-31T21:53:00.000Z",
"calidad": 58,
"banda": "Good",
"estimacion": false
},
{
"fecha": "2026-11-01",
"hora": "2026-11-01T21:52:00.000Z",
"calidad": 58,
"banda": "Good",
"estimacion": false
},
{
"fecha": "2026-11-02",
"hora": "2026-11-02T21:51:00.000Z",
"calidad": 64,
"banda": "Good",
"estimacion": false
}
],
"atribucion": "Atardecer de Hoy, https://atardecer-dehoy.com/en/data-sources/"
}Errors
| Status | Code | What happened |
|---|---|---|
| 401 | missing_key | The key is missing. Send it in the header Authorization: Bearer <key>. |
| 401 | invalid_key | The key is not valid or was revoked. |
| 403 | plan_without_api | The account for this key does not have a plan with API access. |
| 404 | city_not_found | There is no city with that slug. |
| 429 | daily_limit | Your account's daily request limit, across all your keys, was reached. |
Attribution
If you show this data on your site, link to our data sources, as the atribucion field says: the sky data has a license that requires it.