openSenseMap API
api.opensensemap.org · Science
Open environmental sensor network — air quality, temperature, humidity, UV index, and more from citizen science stations worldwide. All data is open. No API key required.
Authentication
No authentication requiredFree to use with no key needed.
Sample Requests
GET
Get nearby sensor boxes
Find environmental sensor stations near Münster, Germany.
https://api.opensensemap.org/boxes?near=51.97,7.62&format=json&maxDistance=5000
Hover any highlighted part to learn what it does
curl -X GET "https://api.opensensemap.org/boxes?near=51.97%2C7.62&format=json&maxDistance=5000"
import requests
params = {
"near": "51.97,7.62",
"format": "json",
"maxDistance": "5000"
}
response = requests.get(
"https://api.opensensemap.org/boxes",
params=params,
)
print(response.json())const url = new URL('https://api.opensensemap.org/boxes');
url.searchParams.set('near', '51.97,7.62');
url.searchParams.set('format', 'json');
url.searchParams.set('maxDistance', '5000');
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.opensensemap.org/boxes")
q := baseURL.Query()
q.Set("near", "51.97,7.62")
q.Set("format", "json")
q.Set("maxDistance", "5000")
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.opensensemap.org/boxes")
uri.query = URI.encode_www_form({
"near" => "51.97,7.62",
"format" => "json",
"maxDistance" => "5000"
})
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.opensensemap.org/boxes?" . http_build_query([
"near" => "51.97,7.62",
"format" => "json",
"maxDistance" => "5000"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));
GET
Get sensor stats
Get global network statistics.
https://api.opensensemap.org/stats
Hover any highlighted part to learn what it does
curl -X GET "https://api.opensensemap.org/stats"
import requests
response = requests.get(
"https://api.opensensemap.org/stats",
)
print(response.json())const url = 'https://api.opensensemap.org/stats'; const response = await fetch(url); const data = await response.json(); console.log(data);
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
targetURL := "https://api.opensensemap.org/stats"
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.opensensemap.org/stats")
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.opensensemap.org/stats";
$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
- No API key needed
- Find nearby stations: GET /boxes?near={lat},{lon}&maxDistance=10000
- Get station data: GET /boxes/{senseBoxId}
- Latest measurements: GET /boxes/{id}/sensors
- All data is open under PDDL license