Weather Forecast API - Advanced Weather Prediction Data
Access hourly, daily, and minutely weather forecasts with APIFreaks’ Weather Forecast API - built to deliver precise and reliable weather prediction data for any location, coordinates, or IP address. Get complete insights including temperature, wind, humidity, precipitation, visibility, and astronomical data such as sunrise, sunset, and moon phases, all through a fast and simple API request.
You can fetch forecasts for a specific date range or up to 16 days ahead, making it easy to plan ahead and power anything from forecast apps and weather widgets to analytics dashboards and agricultural tools.
Built for developers, the Forecast Weather API is lightweight, globally accurate, and consistent - delivering one of the most accurate weather APIs for building smarter, data-driven applications.
Features
Forecasts up to 16 Days
Access future weather data for up to 16 days ahead. Provide a date range using “startDate” and “endDate” or use the “forecastDays” parameter for quick and flexible forecasting.
Multiple Precision Levels
Get forecasts by minutely, hourly, or daily precision, ideal for applications that need fine-grained weather prediction like logistics, travel, or IoT monitoring.
Weather by Location, IP or Coordinates
Get weather by city, coordinates (latitude & longitude), or IP address - making it easy to detect a user’s environment or serve localized experiences globally.
Astronomical Insights
Each response includes astronomical data such as sunrise, sunset, moonrise, and moon phase, alongside weather details - perfect for apps needing daylight tracking or environmental insights.
Rich Weather Parameters
From temperature, wind speed, humidity, and pressure to rainfall, snow forecasts, and wind forecasts, the API covers every detail you need to predict conditions accurately.
Detailed Location Context
Each response includes complete geographic context with continent, country, state/province, district, city, locality, postal code, precise coordinates, elevation data, and timezone information.
API Endpoint
The forecastDays parameter supports up to 16 days. If using startDate and endDate, the date range between them must not exceed 16 days.
How to Guides
Get Forecast by Location, IP, or Coordinates
The Forecast API allows you to get weather prediction data using a city name, geo-coordinates, or even the client’s IP address. This makes it flexible for apps that require either user-input forecasts or automatic location detection.
Example using Location
Use the location parameter to look up weather by any location - city name, address etc.
curl -X 'GET' 'https://api.apifreaks.com/weather/v1.0/historical?location=New York, USA&date=2024-10-15&precision=daily&apiKey=API-KEY
# Response
{
"location": {
"location_string": "Berlin,Germany",
"country_name": "Germany",
"state_prov": "",
"city": "Berlin",
"locality": "",
"latitude": "52.51086",
"longitude": "13.39894",
"elevation": "80",
"timezone": "Europe/Berlin",
"timezone_abbreviation": "GMT+1"
},
"forecast": {
"2025-11-06": {
"daily": {
"timestamp": "2025-11-06",
"weather_code": 3,
"temperature_2m_max": 14.5,
"temperature_2m_min": 6.1,
"apparent_temperature_max": 11.2,
"apparent_temperature_min": 3.4,
"temperature_2m_mean": 9.2,
"apparent_temperature_mean": 6.4,
"uv_index_max": 1.9,
"uv_index_clear_sky_max": 1.9,
"rain_sum": 0,
"showers_sum": 0,
"snowfall_sum": 0,
"precipitation_sum": 0,
Example using Coordinates
Use the lat and long parameters to retrieve current weather conditions for any point on Earth.
curl -X 'GET' 'https://api.apifreaks.com/v1.0/weather/forecast?lat=52.520008&long=13.40495&forecastDays=5&apiKey=API-KEY'
# Response
{
"location": {
"latitude": "52.52001",
"longitude": "13.40495",
"country_name": "Germany",
"state_prov": "Land Berlin",
"city": "Berlin",
"locality": "Mitte",
"elevation": "74",
"timezone": "Europe/Berlin",
"timezone_abbreviation": "GMT+1"
},
"forecast": {
"2025-11-06": {
"daily": {
"timestamp": "2025-11-06",
"weather_code": 3,
"temperature_2m_max": 14.5,
"temperature_2m_min": 6.1,
"apparent_temperature_max": 11.3,
"apparent_temperature_min": 3.5,
"temperature_2m_mean": 9.2,
"apparent_temperature_mean": 6.5,
"uv_index_max": 1.9,
"uv_index_clear_sky_max": 1.9,
"rain_sum": 0,
"showers_sum": 0,
"snowfall_sum": 0,
"precipitation_sum": 0,
"wind_speed_10m_max": 12.1,
Example using IP
Use the ip parameter to display relevant weather information at specific network locations.
curl -X 'GET' 'https://api.apifreaks.com/v1.0/weather/forecast?ip=111.111.111.111&forecastDays=5&apiKey=API-KEY'
# Response
{
"location": {
"continent_code": "AS",
"continent_name": "Asia",
"country_code2": "JP",
"country_code3": "JPN",
"country_name": "Japan",
"country_name_official": "Japan",
"is_eu": false,
"state_prov": "Tokyo",
"state_code": "JP-13",
"district": "Chiyoda",
"city": "Tokyo",
"zipcode": "102-0000",
"latitude": "35.69495",
"longitude": "139.75398",
"locality": "Chiyoda",
"elevation": "0",
"timezone": "Asia/Tokyo",
"timezone_abbreviation": "GMT+9"
},
"forecast": {
"2025-11-06": {
"daily": {
"timestamp": "2025-11-06",
"weather_code": 61,
"temperature_2m_max": 18,
"temperature_2m_min": 11.6,
"apparent_temperature_max": 17.1,
"apparent_temperature_min": 10.5,
Auto-detect requesting users' IP address
If you don’t provide any parameters, the API defaults to showing a 7-day daily forecast for the requester’s IP location.
curl -X 'GET' 'https://api.apifreaks.com/v1.0/weather/forecast?apiKey=API-KEY'
# Response
{
"location": {
"continent_code": "AS",
"continent_name": "Asia",
"country_code2": "PK",
"country_code3": "PAK",
"country_name": "Pakistan",
"country_name_official": "Islamic Republic of Pakistan",
"is_eu": false,
"state_prov": "Punjab",
"state_code": "PK-PB",
"district": "Lahore",
"city": "Lahore",
"zipcode": "54000",
"latitude": "31.52037",
"longitude": "74.35875",
"locality": "Gulberg",
"elevation": "",
"timezone": "Asia/Karachi",
"timezone_abbreviation": "GMT+5"
},
"forecast": {
"2025-11-06": {
"daily": {
"timestamp": "2025-11-06",
"weather_code": 0,
"temperature_2m_max": 26,
"temperature_2m_min": 14.4,
"apparent_temperature_max": 25.4,
"apparent_temperature_min": 13.8,
Weather Forecast by Date Range or Number of Days
The Weather Forecast API lets you retrieve accurate forecasts either for a specific number of upcoming days or for a custom date range. Use these parameters to get flexible, high-quality forecast data tailored to your needs.
- Forecast by Days: Use the forecastDays parameter to get weather data for a specific number of upcoming days (up to 16).
- Forecast by Date Range: Use the startDate and endDate parameters to retrieve weather data for a custom date window (maximum range: 16 days).
Example of Weather Forecast by Days
Use the forecastDays parameter to obtain a weather forecast for a specified number of upcoming days.
curl -s -X GET "https://api.apifreaks.com/v1.0/weather/forecast?location=Berlin,Germany&forecastDays=10&apiKey=API-KEY"'
# Response
{
"location": {
"location_string": "Berlin,Germany",
"country_name": "Germany",
"state_prov": "",
"city": "Berlin",
"locality": "",
"latitude": "52.51086",
"longitude": "13.39894",
"elevation": "80",
"timezone": "Europe/Berlin",
"timezone_abbreviation": "GMT+1"
},
"forecast": {
"2025-11-06": {
"daily": {
"timestamp": "2025-11-06",
"weather_code": 3,
"temperature_2m_max": 14.5,
"temperature_2m_min": 6.1,
"apparent_temperature_max": 11.2,
"apparent_temperature_min": 3.4,
"temperature_2m_mean": 9.2,
"apparent_temperature_mean": 6.4,
"uv_index_max": 1.9,
"uv_index_clear_sky_max": 1.9,
"rain_sum": 0,
"showers_sum": 0,
"snowfall_sum": 0,
"precipitation_sum": 0,
Example of Weather Forecast by Date Range
Get a weather forecast for a custom date range using the startDate and endDate parameters.
curl -s -X GET "https://api.apifreaks.com/v1.0/weather/forecast?location=Berlin,Germany&startDate=2025-11-06&endDate=2025-11-12&apiKey=API-KEY"
# Response
{
"location": {
"location_string": "Berlin,Germany",
"country_name": "Germany",
"state_prov": "",
"city": "Berlin",
"locality": "",
"latitude": "52.51086",
"longitude": "13.39894",
"elevation": "80",
"timezone": "Europe/Berlin",
"timezone_abbreviation": "GMT+1"
},
"forecast": {
"2025-11-06": {
"daily": {
"timestamp": "2025-11-06",
"weather_code": 3,
"temperature_2m_max": 14.5,
"temperature_2m_min": 6.1,
"apparent_temperature_max": 11.2,
"apparent_temperature_min": 3.4,
"temperature_2m_mean": 9.2,
"apparent_temperature_mean": 6.4,
"uv_index_max": 1.9,
"uv_index_clear_sky_max": 1.9,
"rain_sum": 0,
"showers_sum": 0,
"snowfall_sum": 0,
"precipitation_sum": 0,
Control Forecast Precision
The precision parameter allows you to control the granularity of forecast data returned by the API. Use it when you need high-resolution weather prediction such as for energy systems, delivery tracking, or environmental analytics.
- precision=daily: (default) general-purpose forecasts.
- precision=hourly: detailed hourly weather prediction.
- precision=minutely: fine-grained data, updates every 15 minutes.
Example of "daily" Forecast
curl -X 'GET' '"https://api.apifreaks.com/v1.0/weather/forecast?location=Tokyo,Japan&precision=daily&forecastDays=2&apiKey=API-KEY'
# Response
{
"location": {
"location_string": "Tokyo,Japan",
"country_name": "Japan",
"state_prov": "",
"city": "Tokyo",
"locality": "",
"latitude": "35.68219",
"longitude": "139.76222",
"elevation": "0",
"timezone": "Asia/Tokyo",
"timezone_abbreviation": "GMT+9"
},
"forecast": {
"2025-11-06": {
"daily": {
"timestamp": "2025-11-06",
"weather_code": 61,
"temperature_2m_max": 18,
"temperature_2m_min": 11.6,
"apparent_temperature_max": 17.1,
"apparent_temperature_min": 10.5,
"temperature_2m_mean": 14.7,
"apparent_temperature_mean": 13.5,
"uv_index_max": 0.7,
"uv_index_clear_sky_max": 4.2,
"rain_sum": 3,
"showers_sum": 0,
"snowfall_sum": 0,
"precipitation_sum": 3,
Example of "hourly" Forecast
curl -s -X GET "https://api.apifreaks.com/v1.0/weather/forecast?location=Tokyo,Japan&precision=hourly&forecastDays=2&apiKey=API-KEY"
# Response
{
"location": {
"location_string": "Tokyo,Japan",
"country_name": "Japan",
"state_prov": "",
"city": "Tokyo",
"locality": "",
"latitude": "35.68219",
"longitude": "139.76222",
"elevation": "0",
"timezone": "Asia/Tokyo",
"timezone_abbreviation": "GMT+9"
},
"forecast": {
"2025-11-06": {
"hourly": [
{
"timestamp": "2025-11-06T00:00",
"temperature_2m": 13.4,
"relative_humidity_2m": 71,
"dew_point_2m": 8.3,
"apparent_temperature": 12.1,
"precipitation_probability": 0,
"precipitation": 0,
"rain": 0,
"showers": 0,
"snowfall": 0,
"weather_code": 3,
"pressure_msl": 1022.7,
"surface_pressure": 1021.6,
Example of "minutely" Forecast
curl -s -X GET "https://api.apifreaks.com/v1.0/weather/forecast?location=Tokyo,Japan&precision=minutely&forecastDays=2&apiKey=API-KEY"
# Response
{
"location": {
"location_string": "Tokyo,Japan",
"country_name": "Japan",
"state_prov": "",
"city": "Tokyo",
"locality": "",
"latitude": "35.68219",
"longitude": "139.76222",
"elevation": "0",
"timezone": "Asia/Tokyo",
"timezone_abbreviation": "GMT+9"
},
"forecast": {
"2025-11-06": {
"minutely": [
{
"timestamp": "2025-11-06T00:00",
"temperature_2m": 13.4,
"relative_humidity_2m": 71,
"dew_point_2m": 8.3,
"apparent_temperature": 12.1,
"precipitation": 0,
"shortwave_radiation": 0,
"direct_radiation": 0,
"diffuse_radiation": 0,
"direct_normal_irradiance": 0,
"global_tilted_irradiance": 0,
"rain": 0,
"snowfall": 0,
Pricing
To use the Weather Forecast API, API credits are required. Charges apply only for successful queries, defined by a 2xx status code. If a request results in a 4xx or 5xx status code, no credits will be deducted, and any credits already charged will be refunded.
For each successful request, 3 credit will be charged. Utilize the Credits Usage API to efficiently monitor your recent consumption of both one-off and subscription credits. This API provides a streamlined way to track and manage your credit usage, ensuring you stay informed about your remaining balance and can optimize your resource allocation effectively.