Find an API

Search public APIs with auth details & Postman guides

← All APIs

OpenWeatherMap API

api.openweathermap.org · Science

Science API Key Free Tier Weather Forecast Climate

Current weather, forecasts, historical data, and weather maps for any location. 60+ years of weather archive, global coverage. Free tier: 1,000 calls/day.

Authentication

API Key Free API key at openweathermap.org. Pass as ?appid= query parameter or Authorization: Bearer header.

Sample Requests

GET Current weather by city

Get current weather for London.

https://api.openweathermap.org/data/2.5/weather?q=London&appid=YOUR_API_KEY&units=metric

Hover any highlighted part to learn what it does

curl -X GET "https://api.openweathermap.org/data/2.5/weather?q=London&appid=YOUR_API_KEY&units=metric"
import requests
params = {
    "q": "London",
    "appid": "YOUR_API_KEY",
    "units": "metric"
}
response = requests.get(
    "https://api.openweathermap.org/data/2.5/weather",
    params=params,
)
print(response.json())
const url = new URL('https://api.openweathermap.org/data/2.5/weather');
url.searchParams.set('q', 'London');
url.searchParams.set('appid', 'YOUR_API_KEY');
url.searchParams.set('units', 'metric');

const response = await fetch(url); 
const data = await response.json();
console.log(data);
package main

import (
	"fmt"
	"io"
	"net/http"
	"net/url"
)

func main() {
	baseURL, _ := url.Parse("https://api.openweathermap.org/data/2.5/weather")
	q := baseURL.Query()
	q.Set("q", "London")
	q.Set("appid", "YOUR_API_KEY")
	q.Set("units", "metric")
	baseURL.RawQuery = q.Encode()
	targetURL := baseURL.String()
	req, _ := http.NewRequest("GET", targetURL, nil)

	client := &http.Client{}
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}
require "net/http"
require "json"

uri = URI("https://api.openweathermap.org/data/2.5/weather")
uri.query = URI.encode_www_form({
  "q" => "London",
  "appid" => "YOUR_API_KEY",
  "units" => "metric"
})

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"

req = Net::HTTP::Get.new(uri)

res = http.request(req)
puts JSON.parse(res.body)
<?php
$url = "https://api.openweathermap.org/data/2.5/weather?" . http_build_query([
    "q" => "London",
    "appid" => "YOUR_API_KEY",
    "units" => "metric"
]);
$opts = ["http" => [
    "method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));
GET 5-day forecast

Get 5-day/3-hour forecast for New York.

https://api.openweathermap.org/data/2.5/forecast?q=New York&cnt=10&appid=YOUR_API_KEY&units=imperial

Hover any highlighted part to learn what it does

curl -X GET "https://api.openweathermap.org/data/2.5/forecast?q=New%20York&cnt=10&appid=YOUR_API_KEY&units=imperial"
import requests
params = {
    "q": "New York",
    "cnt": "10",
    "appid": "YOUR_API_KEY",
    "units": "imperial"
}
response = requests.get(
    "https://api.openweathermap.org/data/2.5/forecast",
    params=params,
)
print(response.json())
const url = new URL('https://api.openweathermap.org/data/2.5/forecast');
url.searchParams.set('q', 'New York');
url.searchParams.set('cnt', '10');
url.searchParams.set('appid', 'YOUR_API_KEY');
url.searchParams.set('units', 'imperial');

const response = await fetch(url); 
const data = await response.json();
console.log(data);
package main

import (
	"fmt"
	"io"
	"net/http"
	"net/url"
)

func main() {
	baseURL, _ := url.Parse("https://api.openweathermap.org/data/2.5/forecast")
	q := baseURL.Query()
	q.Set("q", "New York")
	q.Set("cnt", "10")
	q.Set("appid", "YOUR_API_KEY")
	q.Set("units", "imperial")
	baseURL.RawQuery = q.Encode()
	targetURL := baseURL.String()
	req, _ := http.NewRequest("GET", targetURL, nil)

	client := &http.Client{}
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}
require "net/http"
require "json"

uri = URI("https://api.openweathermap.org/data/2.5/forecast")
uri.query = URI.encode_www_form({
  "q" => "New York",
  "cnt" => "10",
  "appid" => "YOUR_API_KEY",
  "units" => "imperial"
})

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"

req = Net::HTTP::Get.new(uri)

res = http.request(req)
puts JSON.parse(res.body)
<?php
$url = "https://api.openweathermap.org/data/2.5/forecast?" . http_build_query([
    "q" => "New York",
    "cnt" => "10",
    "appid" => "YOUR_API_KEY",
    "units" => "imperial"
]);
$opts = ["http" => [
    "method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));

Postman Setup Guide

Get Postman ↗
  1. Get a free API key at openweathermap.org/api
  2. Pass appid=YOUR_KEY as query param
  3. Try GET https://api.openweathermap.org/data/2.5/weather?q=Paris&appid=YOUR_KEY&units=metric
  4. units: metric (°C), imperial (°F), standard (Kelvin)

What can you build with OpenWeatherMap API?

OpenWeatherMap API is a Science API. Developers commonly use science APIs for:

  • accessing research datasets and scientific literature
  • powering academic and R&D applications
  • running scientific calculations and simulations
  • visualising experimental and observational data
  • integrating with research and reference databases

API Key authentication. You'll receive a key after signing up. Send it with every request — in a header or query parameter. Keep it out of client-side code and never commit it to version control. OpenWeatherMap API is free to use up to a usage limit, making it a low-risk choice to experiment with.

New to APIs? Read our beginner's guide · Learn about API keys · What is REST?

Open documentation ↗