Get Real-Time Weather Data for Your Next Project With Our Easy-To-Use API!

by | May 19, 2023

Real-time weather data has become one of the basic needs of many businesses today. Many businesses analyze these data in many areas or serve their users. Using a weather API in line with this need is the easiest and effortless way to obtain real-time weather data today.

With the weather API, it is possible to obtain weather data with a single HTTP request. By using a weather API, businesses get rid of many costs when obtaining weather data. Such as obtaining and maintaining weather data or collecting other weather data. In this article, we will first find an answer to the question of what is the weather API, and we will talk about the use cases of the current weather data provided by the weather API. Then we will get to know the most popular free weather API used by many businesses and developers today and perform an integration.

What Is the Weather API?

Weather API is a web service developed to provide weather data. These APIs obtain data from reliable data sources to provide highly accurate weather data.

The most popular weather APIs in the market usually take requests over the HTTP protocol and return data in JSON, XML, or other formats. These APIs provide their users with a wealth of information, such as forecast weather data, temperature, humidity, wind speed, and direction, as well as weather conditions.

What Are the Use Cases of the Real-Time Current Weather Data?

Current weather data provided by Weather APIs are used in many different sectors today. Some of those:

Agriculture: Helps farmers plan operations such as harvesting and irrigation.

Tourism: It is preferred in the tourism sector when hotels organize tours or events for their customers.

Artificial intelligence: It is used in algorithms developed for weather information in the field of artificial intelligence.

Construction: Weather data is used during construction processes such as excavation, concrete preparation, and iron use.

Media: In the media field, current weather data provided by weather APIs are used in television channels and news websites.

Best Real-Time Weather Data API: The weatherstack API

home page of the weatherstack weather data api

The weatherstack API is a web service that provides almost any weather-related data a business might need. It is a free weather API.

This API supports millions of address information. It provides current weather, historical weather, and weather forecast data for this address information.

Provides flexible location search service. In this way, users can use the city or region name, zip code, IP address, and even latitude and longitude coordinates of the region they want to obtain weather information.

The accuracy of the information provided by this API is quite high. It obtains this information from reliable data sources.

It is an easy-to-use API. It easily integrates into any project. It responds with JSON format, which is the most popular data format today.

Integration of the weatherstack Weather API Into Node.js

In this part, we will integrate the weatherstack API into Node.js and develop a simple application.

Before we can integrate and use the weatherstack API, we will need an API key. To get this API key, let’s sign up for one of the attractively priced subscription plans that weatherstack offers.

We are now ready to integrate and use this API. For this, we will create a Node.js project with the following command on the desktop.

npm init

After creating a Node.js project with default settings, let’s create a file named ‘index.js’ in the same file path.

Then let’s include the following library in the project.

npm i request

After including the ‘request’ library in the project, we will paste the following codes into the ‘index.js’ file.

const express = require(‘express’);
const app = express();
let request = require(‘request’);

const apiKey = ‘API_KEY’;
const port = 3000;

app.get(‘/api/weathers’, (req, res) => {

  let city = ‘Istanbul’;

    let url = `${apiKey}&query=${city}`;

    request(url, function (err, response, body) {
          console.log(‘error:’, error);
        } else {
          console.log(‘body:’, body);

app.listen(port, () => {
  console.log(`Port: http://localhost:${port}`);

We developed a REST API with this code. When a request is made to this REST API, this API obtains the current weather data in the city of Istanbul from the weatherstack API and provides it to the user in JSON format. Before running this application, let’s paste the API key we obtained into the ‘YOUR_API_KEY’ field and run the application with the following command.

npm start

After running the application, we will make an HTTP GET request to the following URL.


After requesting this URL, the response in JSON format is as follows.

  “request”: {
    “type”: “City”,
    “query”: “Istanbul, Turkey”,
    “language”: “en”,
    “unit”: “m”
  “location”: {
    “name”: “Istanbul”,
    “country”: “Turkey”,
    “region”: “Istanbul”,
    “lat”: “41.019”,
    “lon”: “28.965”,
    “timezone_id”: “Europe\/Istanbul”,
    “localtime”: “2023-04-26 11:57”,
    “localtime_epoch”: 1682510220,
    “utc_offset”: “3.0”
  “current”: {
    “observation_time”: “08:57 AM”,
    “temperature”: 16,
    “weather_code”: 116,
    “weather_icons”: [
    “weather_descriptions”: [
      “Partly cloudy”
    “wind_speed”: 9,
    “wind_degree”: 140,
    “wind_dir”: “SE”,
    “pressure”: 1007,
    “precip”: 0.4,
    “humidity”: 72,
    “cloudcover”: 75,
    “feelslike”: 16,
    “uv_index”: 4,
    “visibility”: 10,
    “is_day”: “yes”

As seen in this response, the weatherstack API provides very detailed weather data for a location. such as temperature, wind speed, wind direction, pressure, and humidity.


As a result, getting and using real-time current weather data information is quite possible with a weather API. It is possible to start using it by integrating it into your application in just a few steps. Since a weather API provides almost every weather-related service to businesses, we also see this API is used in many areas today.

Explore the weatherstack API, which provides comprehensive weather data, and get started quickly thanks to its easy-to-use structure.


Q: Does The weatherstack API Provide Weather Forecast Data?

A: Yes, it does. The weatherstack API provides 14 days of weather forecast data. In addition, this API provides services that include data such as current weather data, historical weather data, and historical time series.

Q: Which Projects Use Weather Forecasts Data?

A: Weather forecast data are actively used in many projects and platforms today. It is used in television channels, e-commerce sites, social media applications, news websites, and many more.

Q: What are the Features a Weather API Should Have?

A: There are many global weather data APIs in the market that developers and businesses can find. Many of these APIs may not be suitable for enterprise projects. Here are some of the things that developers and businesses should consider when choosing a weather API:

  • Providing real-time data
  • Providing highly accurate data
  • Offering high availability
  • Providing historical data
  • Providing weather forecast data
  • Obtaining data from weather stations

Q: Until What Year Does the weatherstack API Provide Historical Weather Data?

A: The weatherstack API historical weather for millions of locations. It is a weather data API that provides It quickly presents all historical weather information up to July 2008 to its users. The weather history data of the locations provided by this API contain very detailed information. Like astrology, maximum temperature, minimum temperature, UV index, and more.