Current Weather Conditions
GET/v1/weatherdata/current
Latest report from the nearest reporting station within 150 km of a coordinate in the United States or Australia. Refreshes every 5 minutes.
Price
$0.003/ callEdge cache
150s
Uptime 24h
100.00%
p95
258ms
MCP tool
weatherdata_current
The Weather Data API provides current weather conditions for any coordinate in the United States or Australia. It returns the latest report from the nearest reporting station within 150 km of the given coordinate. The API refreshes every 5 minutes. Parameters include latitude and longitude.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
| lat* | query | number | |
| lon* | query | number |
Code
curl
# 1. No key, no payment: the gateway answers 402 with the price
curl -i "https://api.realtimeapi.ai/v1/weatherdata/current?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/weatherdata/current?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/weatherdata/current?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/weatherdata/current?lat=-33.87&lon=151.21").json())With an API key
curl "https://api.realtimeapi.ai/v1/weatherdata/current?lat=-33.87&lon=151.21" -H "X-API-Key: $RTAPI_KEY"Frequently asked questions
What is the API endpoint?
The API endpoint is /current
What parameters are required?
Latitude and longitude are required parameters
How often is the data updated?
The data is updated every 5 minutes
What is the price of the API?
The price is $0.003 per request