Skip to content

# Environmental Sensors API

GET/v1/sensordata/stations/near

Stations of every network (usgs, coops, openaq) within radius_km of a point, nearest first, with the parameters each reports and the distance in metres. Refreshes every 24 hours.

Price

$0.005/ call

Edge cache

21600s

Uptime 24h

100.00%

p95

194ms

MCP tool

sensordata_stations-near

The Environmental Sensors API provides readings from open environmental networks, including air quality, US river gauges, tides, water levels, and earthquakes. The API offers a nearest-station search by coordinates and derived flags such as AQI category, flood stage, and recent quakes within a radius. The endpoint returns stations of every network within a specified radius, with parameters and distance in meters. The data refreshes every 24 hours.

Parameters

NameInTypeDescription
lat* query number
lon* query number
radius_km query number = 25
parameter query string
network query string
limit query integer = 50

Code

curl
# 1. No key, no payment: the gateway answers 402 with the price
curl -i "https://api.realtimeapi.ai/v1/sensordata/stations/near?lat=-33.87&lon=151.21"

# 2. Pay: retry with a signed x402 payment (any x402 client builds this header)
curl "https://api.realtimeapi.ai/v1/sensordata/stations/near?lat=-33.87&lon=151.21" -H "PAYMENT-SIGNATURE: $X402_PAYMENT"
TypeScript · @x402/fetch
// npm i @x402/fetch @x402/core @x402/evm viem
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = x402Client.fromConfig({ schemes: [{ network: "eip155:8453", client: new ExactEvmScheme(privateKeyToAccount(PRIVATE_KEY)) }] });
const pay = wrapFetchWithPayment(fetch, client);
const data = await (await pay("https://api.realtimeapi.ai/v1/sensordata/stations/near?lat=-33.87&lon=151.21")).json();
console.log(data);
Python · x402
# pip install "x402[requests,evm]==2.27.0" eth-account
from eth_account import Account
from x402 import x402ClientSync
from x402.http.clients import x402_requests
from x402.mechanisms.evm import EthAccountSigner
from x402.mechanisms.evm.exact import register_exact_evm_client

client = x402ClientSync()
register_exact_evm_client(client, EthAccountSigner(Account.from_key(PRIVATE_KEY)))
session = x402_requests(client)
print(session.get("https://api.realtimeapi.ai/v1/sensordata/stations/near?lat=-33.87&lon=151.21").json())
With an API key
curl "https://api.realtimeapi.ai/v1/sensordata/stations/near?lat=-33.87&lon=151.21" -H "X-API-Key: $RTAPI_KEY"

Frequently asked questions

What networks are included in the API?

The API includes data from OpenAQ, USGS, and NOAA CO-OPS.

How often is the data refreshed?

The data is refreshed every 24 hours.

What is the price of the API?

The price is $0.005 per request.

What parameters can be specified in the API request?

The parameters include lat, lon, radius_km, parameter, network, and limit.

What is the unit of distance in the API response?

The distance is returned in meters.

Get a free key

1,000 calls a month across every feed. Who is setting it up?

No key needed at all: agents can pay per call in USDC with x402.