Histórico

HG BrasilWeather
Acesse dados passados de previsão do tempo, essenciais para análises de tendências e comparações de desempenho ao longo do tempo.

Você pode obter dados históricos de previsão do tempo utilizando parâmetros que filtram por data.

Esse método necessita de um plano que tenha suporte à dados históricos.

Requisição

As requisições tem como base o seguinte endpoint:

GET
https://api.hgbrasil.com/weather/historical?key=suachave

Você pode obter dados históricos de previsão do tempo para uma localizadade através de um dos seguintes métodos:

Para definir o intervalo de dados a serem consultados, você pode utilizar um dos seguintes métodos:

Por intervalo de datas

start_date
string
Data de inicio no formato yyyy-mm-dd.
end_date
string
Data de término no formato yyyy-mm-dd.

Por uma data específica

date
string
Data no formato yyyy-mm-dd.

Por número de dias atrás

days_ago
number
Número de dias atrás.

Modos

Juntamente com uma das datas, é possível definir o modo de retorno dos dados:

mode
string
As opções são all, hourly (apenas os registros por hora) ou summary (apenas o resumo).

Exemplo

Logo, você provavelmente irá utilizar um endpoint como o seguinte:

GET
https://api.hgbrasil.com/weather/historical?woeid=455903&days_ago=3&mode=all&key=suachave
curl -X GET "https://api.hgbrasil.com/weather/historical?woeid=455903&days_ago=3&mode=all&key=suachave"

Resposta

{
  "by": "days_ago",
  "mode": "all",
  "valid_key": true,
  "city_woeid": 455903,
  "results": {
    "2026-08-20": {
      "city": "Ribeirão Preto, SP",
      "sunrise": "06:30 am",
      "sunset": "05:58 pm",
      "temp": {
        "max": 35,
        "min": 15,
        "avg": 25
      },
      "humidity": {
        "max": 82,
        "min": 13,
        "avg": 42.3
      },
      "cloudiness": {
        "max": 12,
        "min": 0,
        "avg": 0.8
      },
      "rain": {
        "max": 0,
        "min": 0,
        "avg": 0
      },
      "wind_speedy": {
        "max": 5.1,
        "min": 0,
        "avg": 2.4
      },
      "hourly": {
        "00:01": {
          "temp": 20,
          "humidity": 56,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "1.03 km/h",
          "wind_direction": 50,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "01:01": {
          "temp": 20,
          "humidity": 56,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "0 km/h",
          "wind_direction": 0,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "02:01": {
          "temp": 19,
          "humidity": 59,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "1.03 km/h",
          "wind_direction": 110,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "03:01": {
          "temp": 19,
          "humidity": 63,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "2.57 km/h",
          "wind_direction": 100,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "04:01": {
          "temp": 18,
          "humidity": 63,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "2.57 km/h",
          "wind_direction": 160,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "05:01": {
          "temp": 16,
          "humidity": 72,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "0 km/h",
          "wind_direction": 0,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "06:01": {
          "temp": 18,
          "humidity": 63,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "3.09 km/h",
          "wind_direction": 120,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "07:01": {
          "temp": 15,
          "humidity": 77,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "1.03 km/h",
          "wind_direction": 40,
          "condition_code": "27",
          "condition_slug": "clear_day"
        },
        "08:01": {
          "temp": 15,
          "humidity": 82,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "2.06 km/h",
          "wind_direction": 80,
          "condition_code": "27",
          "condition_slug": "clear_day"
        },
        "09:01": {
          "temp": 19,
          "humidity": 63,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "3.6 km/h",
          "wind_direction": 130,
          "condition_code": "27",
          "condition_slug": "clear_day"
        },
        "10:01": {
          "temp": 23,
          "humidity": 49,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "3.09 km/h",
          "wind_direction": 120,
          "condition_code": "27",
          "condition_slug": "clear_day"
        },
        "11:01": {
          "temp": 27,
          "humidity": 39,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "3.6 km/h",
          "wind_direction": 110,
          "condition_code": "27",
          "condition_slug": "clear_day"
        },
        "12:01": {
          "temp": 31,
          "humidity": 29,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "1.54 km/h",
          "wind_direction": 50,
          "condition_code": "27",
          "condition_slug": "clear_day"
        },
        "13:01": {
          "temp": 33,
          "humidity": 16,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "4.63 km/h",
          "wind_direction": 30,
          "condition_code": "27",
          "condition_slug": "clear_day"
        },
        "14:01": {
          "temp": 34,
          "humidity": 14,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "3.09 km/h",
          "wind_direction": 330,
          "condition_code": "27",
          "condition_slug": "clear_day"
        },
        "15:01": {
          "temp": 35,
          "humidity": 13,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "4.12 km/h",
          "wind_direction": 320,
          "condition_code": "27",
          "condition_slug": "clear_day"
        },
        "16:01": {
          "temp": 35,
          "humidity": 13,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "5.14 km/h",
          "wind_direction": 320,
          "condition_code": "27",
          "condition_slug": "clear_day"
        },
        "17:01": {
          "temp": 34,
          "humidity": 13,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "4.12 km/h",
          "wind_direction": 280,
          "condition_code": "27",
          "condition_slug": "clear_day"
        },
        "18:01": {
          "temp": 34,
          "humidity": 13,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "4.12 km/h",
          "wind_direction": 280,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "19:01": {
          "temp": 32,
          "humidity": 18,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "2.57 km/h",
          "wind_direction": 270,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "20:01": {
          "temp": 30,
          "humidity": 23,
          "cloudiness": 1,
          "rain": 0,
          "wind_speedy": "2.06 km/h",
          "wind_direction": 240,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "21:01": {
          "temp": 27,
          "humidity": 34,
          "cloudiness": 1,
          "rain": 0,
          "wind_speedy": "1.03 km/h",
          "wind_direction": 130,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "22:01": {
          "temp": 24,
          "humidity": 41,
          "cloudiness": 12,
          "rain": 0,
          "wind_speedy": "1.03 km/h",
          "wind_direction": 50,
          "condition_code": "29",
          "condition_slug": "cloudly_night"
        },
        "23:01": {
          "temp": 23,
          "humidity": 46,
          "cloudiness": 6,
          "rain": 0,
          "wind_speedy": "1.03 km/h",
          "wind_direction": 10,
          "condition_code": "27",
          "condition_slug": "clear_night"
        }
      }
    },
    "2026-08-19": {
      "city": "Ribeirão Preto, SP",
      "sunrise": "06:31 am",
      "sunset": "05:58 pm",
      "temp": {
        "max": 34,
        "min": 15,
        "avg": 24.5
      },
      "humidity": {
        "max": 82,
        "min": 17,
        "avg": 45.9
      },
      "cloudiness": {
        "max": 17,
        "min": 0,
        "avg": 2.7
      },
      "rain": {
        "max": 0,
        "min": 0,
        "avg": 0
      },
      "wind_speedy": {
        "max": 4.6,
        "min": 0,
        "avg": 2.1
      },
      "hourly": {
        "00:01": {
          "temp": 21,
          "humidity": 56,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "2.06 km/h",
          "wind_direction": 110,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "01:01": {
          "temp": 18,
          "humidity": 68,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "1.54 km/h",
          "wind_direction": 40,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "02:01": {
          "temp": 21,
          "humidity": 42,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "1.35 km/h",
          "wind_direction": 89,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "03:01": {
          "temp": 17,
          "humidity": 72,
          "cloudiness": 2,
          "rain": 0,
          "wind_speedy": "0 km/h",
          "wind_direction": 0,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "04:01": {
          "temp": 17,
          "humidity": 72,
          "cloudiness": 5,
          "rain": 0,
          "wind_speedy": "0 km/h",
          "wind_direction": 0,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "05:01": {
          "temp": 15,
          "humidity": 82,
          "cloudiness": 2,
          "rain": 0,
          "wind_speedy": "0 km/h",
          "wind_direction": 0,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "06:01": {
          "temp": 17,
          "humidity": 72,
          "cloudiness": 2,
          "rain": 0,
          "wind_speedy": "2.57 km/h",
          "wind_direction": 110,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "07:01": {
          "temp": 17,
          "humidity": 72,
          "cloudiness": 17,
          "rain": 0,
          "wind_speedy": "2.57 km/h",
          "wind_direction": 110,
          "condition_code": "29",
          "condition_slug": "cloudly_day"
        },
        "08:01": {
          "temp": 16,
          "humidity": 77,
          "cloudiness": 15,
          "rain": 0,
          "wind_speedy": "0 km/h",
          "wind_direction": 0,
          "condition_code": "29",
          "condition_slug": "cloudly_day"
        },
        "09:01": {
          "temp": 23,
          "humidity": 56,
          "cloudiness": 13,
          "rain": 0,
          "wind_speedy": "3.09 km/h",
          "wind_direction": 120,
          "condition_code": "29",
          "condition_slug": "cloudly_day"
        },
        "10:01": {
          "temp": 23,
          "humidity": 56,
          "cloudiness": 3,
          "rain": 0,
          "wind_speedy": "3.09 km/h",
          "wind_direction": 120,
          "condition_code": "27",
          "condition_slug": "clear_day"
        },
        "11:01": {
          "temp": 26,
          "humidity": 47,
          "cloudiness": 1,
          "rain": 0,
          "wind_speedy": "2.06 km/h",
          "wind_direction": 110,
          "condition_code": "27",
          "condition_slug": "clear_day"
        },
        "12:01": {
          "temp": 29,
          "humidity": 37,
          "cloudiness": 1,
          "rain": 0,
          "wind_speedy": "2.06 km/h",
          "wind_direction": 100,
          "condition_code": "27",
          "condition_slug": "clear_day"
        },
        "13:01": {
          "temp": 31,
          "humidity": 29,
          "cloudiness": 1,
          "rain": 0,
          "wind_speedy": "1.54 km/h",
          "wind_direction": 230,
          "condition_code": "27",
          "condition_slug": "clear_day"
        },
        "14:01": {
          "temp": 33,
          "humidity": 22,
          "cloudiness": 1,
          "rain": 0,
          "wind_speedy": "3.09 km/h",
          "wind_direction": 40,
          "condition_code": "27",
          "condition_slug": "clear_day"
        },
        "15:01": {
          "temp": 33,
          "humidity": 19,
          "cloudiness": 1,
          "rain": 0,
          "wind_speedy": "4.63 km/h",
          "wind_direction": 80,
          "condition_code": "27",
          "condition_slug": "clear_day"
        },
        "16:01": {
          "temp": 34,
          "humidity": 17,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "2.57 km/h",
          "wind_direction": 80,
          "condition_code": "27",
          "condition_slug": "clear_day"
        },
        "17:01": {
          "temp": 33,
          "humidity": 17,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "3.6 km/h",
          "wind_direction": 60,
          "condition_code": "27",
          "condition_slug": "clear_day"
        },
        "18:01": {
          "temp": 33,
          "humidity": 17,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "3.09 km/h",
          "wind_direction": 100,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "19:01": {
          "temp": 31,
          "humidity": 20,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "1.54 km/h",
          "wind_direction": 50,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "20:01": {
          "temp": 29,
          "humidity": 26,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "2.06 km/h",
          "wind_direction": 110,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "21:01": {
          "temp": 26,
          "humidity": 31,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "2.06 km/h",
          "wind_direction": 120,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "22:01": {
          "temp": 22,
          "humidity": 49,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "2.06 km/h",
          "wind_direction": 50,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "23:01": {
          "temp": 23,
          "humidity": 46,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "3.09 km/h",
          "wind_direction": 100,
          "condition_code": "27",
          "condition_slug": "clear_night"
        }
      }
    },
    "2026-08-18": {
      "city": "Ribeirão Preto, SP",
      "sunrise": "06:32 am",
      "sunset": "05:58 pm",
      "temp": {
        "max": 32,
        "min": 17,
        "avg": 24.8
      },
      "humidity": {
        "max": 82,
        "min": 20,
        "avg": 47.5
      },
      "cloudiness": {
        "max": 4,
        "min": 0,
        "avg": 0.6
      },
      "rain": {
        "max": 0,
        "min": 0,
        "avg": 0
      },
      "wind_speedy": {
        "max": 4.1,
        "min": 1,
        "avg": 2.1
      },
      "hourly": {
        "00:01": {
          "temp": 23,
          "humidity": 53,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "1.03 km/h",
          "wind_direction": 0,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "01:01": {
          "temp": 21,
          "humidity": 60,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "3.6 km/h",
          "wind_direction": 150,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "02:01": {
          "temp": 21,
          "humidity": 60,
          "cloudiness": 1,
          "rain": 0,
          "wind_speedy": "2.06 km/h",
          "wind_direction": 170,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "03:01": {
          "temp": 21,
          "humidity": 60,
          "cloudiness": 2,
          "rain": 0,
          "wind_speedy": "3.6 km/h",
          "wind_direction": 140,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "04:01": {
          "temp": 21,
          "humidity": 64,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "4.12 km/h",
          "wind_direction": 130,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "05:01": {
          "temp": 20,
          "humidity": 68,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "3.09 km/h",
          "wind_direction": 120,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "06:01": {
          "temp": 19,
          "humidity": 72,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "2.06 km/h",
          "wind_direction": 100,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "07:01": {
          "temp": 17,
          "humidity": 82,
          "cloudiness": 1,
          "rain": 0,
          "wind_speedy": "1.03 km/h",
          "wind_direction": 50,
          "condition_code": "27",
          "condition_slug": "clear_day"
        },
        "08:01": {
          "temp": 18,
          "humidity": 72,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "2.06 km/h",
          "wind_direction": 130,
          "condition_code": "27",
          "condition_slug": "clear_day"
        },
        "09:01": {
          "temp": 21,
          "humidity": 60,
          "cloudiness": 1,
          "rain": 0,
          "wind_speedy": "1.54 km/h",
          "wind_direction": 120,
          "condition_code": "27",
          "condition_slug": "clear_day"
        },
        "10:01": {
          "temp": 23,
          "humidity": 53,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "1.54 km/h",
          "wind_direction": 200,
          "condition_code": "27",
          "condition_slug": "clear_day"
        },
        "11:01": {
          "temp": 26,
          "humidity": 47,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "1.54 km/h",
          "wind_direction": 60,
          "condition_code": "27",
          "condition_slug": "clear_day"
        },
        "12:01": {
          "temp": 27,
          "humidity": 44,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "2.57 km/h",
          "wind_direction": 90,
          "condition_code": "27",
          "condition_slug": "clear_day"
        },
        "13:01": {
          "temp": 30,
          "humidity": 35,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "1.54 km/h",
          "wind_direction": 280,
          "condition_code": "27",
          "condition_slug": "clear_day"
        },
        "14:01": {
          "temp": 30,
          "humidity": 30,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "2.57 km/h",
          "wind_direction": 330,
          "condition_code": "27",
          "condition_slug": "clear_day"
        },
        "15:01": {
          "temp": 31,
          "humidity": 27,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "2.06 km/h",
          "wind_direction": 90,
          "condition_code": "27",
          "condition_slug": "clear_day"
        },
        "16:01": {
          "temp": 32,
          "humidity": 25,
          "cloudiness": 4,
          "rain": 0,
          "wind_speedy": "2.57 km/h",
          "wind_direction": 100,
          "condition_code": "27",
          "condition_slug": "clear_day"
        },
        "17:01": {
          "temp": 32,
          "humidity": 20,
          "cloudiness": 2,
          "rain": 0,
          "wind_speedy": "2.06 km/h",
          "wind_direction": 0,
          "condition_code": "27",
          "condition_slug": "clear_day"
        },
        "18:01": {
          "temp": 31,
          "humidity": 23,
          "cloudiness": 1,
          "rain": 0,
          "wind_speedy": "1.54 km/h",
          "wind_direction": 0,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "19:01": {
          "temp": 30,
          "humidity": 26,
          "cloudiness": 1,
          "rain": 0,
          "wind_speedy": "2.06 km/h",
          "wind_direction": 100,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "20:01": {
          "temp": 28,
          "humidity": 32,
          "cloudiness": 1,
          "rain": 0,
          "wind_speedy": "1.54 km/h",
          "wind_direction": 110,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "21:01": {
          "temp": 26,
          "humidity": 36,
          "cloudiness": 1,
          "rain": 0,
          "wind_speedy": "2.57 km/h",
          "wind_direction": 90,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "22:01": {
          "temp": 24,
          "humidity": 46,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "1.54 km/h",
          "wind_direction": 90,
          "condition_code": "27",
          "condition_slug": "clear_night"
        },
        "23:01": {
          "temp": 23,
          "humidity": 46,
          "cloudiness": 0,
          "rain": 0,
          "wind_speedy": "1.54 km/h",
          "wind_direction": 120,
          "condition_code": "27",
          "condition_slug": "clear_night"
        }
      }
    }
  },
  "execution_time": 2.84,
  "from_cache": false
}