Historical weather (global)
GET /api/weather-historyHistorical daily weather for any location and date range (up to 1 year): high/low temp, precipitation, wind, conditions. Send GET /api/weather-history with the required fields lat, lon, start and end and pay $0.002 per call over x402 or MPP (there is no free tier). It returns a JSON object with lat, lon, days and source.
Open-Meteo archive, no key, global. Data from 1940 to 5 days ago. ?lat=51.51&lon=-0.13&start=2025-06-01&end=2025-06-07.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
lat | number | yes | Latitude, -90 to 90 Also accepted as latitude. |
lon | number | yes | Longitude, -180 to 180 Also accepted as lng, long, longitude. |
start | string | yes | Start date, YYYY-MM-DD |
end | string | yes | End date, YYYY-MM-DD (max 1 year from start) |
units | string | no | Temperature unit: celsius (default) or fahrenheit |
Example request
curl -i "https://agent402.tools/api/weather-history?lat=51.5074&lon=-0.1278&start=2025-06-01&end=2025-06-07"
Without payment this returns HTTP 402 Payment Required with the exact price for weather-history; any x402 v2 or MPP client pays it and retries.
Example response
{
"lat": 51.5074,
"lon": -0.1278,
"days": [
{
"date": "2025-06-01",
"condition": "Slight rain",
"weatherCode": 61,
"tempMax": 19.8,
"tempMin": 12.1,
"unit": "°C",
"precipSum": 3.2,
"windMax": 18.4,
"windUnit": "km/h"
}
],
"source": "api.open-meteo.com (CC BY 4.0)"
}
| Field | Type | Always present | In the example |
|---|---|---|---|
lat | number | yes | 51.5074 |
lon | number | yes | -0.1278 |
days | array of objects | yes | 1 item in the example |
source | string | yes | api.open-meteo.com (CC BY 4.0) |
From an MCP client
catalog.call {
"slug": "weather-history",
"params": {
"lat": 51.5074,
"lon": -0.1278,
"start": "2025-06-01",
"end": "2025-06-07"
}
}
The hosted connector at https://agent402.tools/mcp needs a payment for weather-history; the stdio package pays it from a wallet or from AGENT402_CREDITS_KEY. Local install: npx -y agent402-mcp.
Errors and behavior
lat,lon,startandendare required. An input the tool rejects returns an HTTP 4xx whose body carrieserror,tool,expected,requiredandexample, so the caller can correct it.- A paid call that ends in any status of 400 or above is not charged over x402, MPP or a prepaid credits key: settlement is cancelled when the tool fails. The exception is a Tempo push credential, a transfer the buyer sent before the call: it settles before the tool runs, so if the tool then fails the payment is recorded as a refund owed to the paying wallet.
- Wallet-only: this tool reaches the network or stored state, so it has no proof-of-work tier. A prepaid card-credits key issued earlier (
Authorization: Bearer a402_...) also pays it. - A
POSTwith a JSON body to /api/weather-history is served as this GET, with the body as the input. - An
Idempotency-Keyheader makes a retried paid call replay the first 200 instead of charging again (an answer larger than 1 MB is not replayed).
Paid call (JavaScript agent)
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client();
client.setSpendControls?.(false); // keep your own spending ceiling in code
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch("https://agent402.tools/api/weather-history?lat=51.5074&lon=-0.1278&start=2025-06-01&end=2025-06-07");
Related tools
Air quality (global)
GET /api/weather-air-qualityCurrent air quality index and pollutant concentrations for any location: US AQI, PM2.5, PM10, ozone, NO2, SO2, CO. Open-…
Current weather (global)
GET /api/weather-currentCurrent weather conditions for any location on Earth: temperature, feels-like, humidity, wind speed/direction/gusts, pre…
Daily forecast (global)
GET /api/weather-daily7-day daily weather forecast for any location: high/low temp, precipitation sum and probability, max wind, UV index, sun…
Hourly forecast (global)
GET /api/weather-hourly48-hour hourly weather forecast for any location: temperature, precipitation probability and amount, wind, cloud cover, …
Crypto global market
GET /api/crypto-globalGlobal crypto market snapshot: total market cap, total 24h volume, BTC dominance, ETH dominance, active coin count, acti…
Historical FX rate by date
GET /api/fx-historicalHistorical foreign-exchange rate for a specific date using European Central Bank reference rates (via Frankfurter). Retu…