API documentation
One endpoint turns the weather into a decision for an activity at a place and date.
Quick start
- Create a free account, verify your email and copy your API key from the dashboard.
- Call
https://api.weatherai.io/v1/decidewith alocationand anactivity.
curl -H "X-API-Key: YOUR_KEY" \
"https://api.weatherai.io/v1/decide?location=London&activity=running&when=tomorrow"
const r = await fetch(
"https://api.weatherai.io/v1/decide?location=London&activity=running&when=tomorrow",
{ headers: { "X-API-Key": process.env.WEATHERAI_KEY } });
const d = await r.json();
console.log(d.verdict, d.score, d.summary);
import os, requests
r = requests.get("https://api.weatherai.io/v1/decide",
params={"location": "London", "activity": "running", "when": "tomorrow"},
headers={"X-API-Key": os.environ["WEATHERAI_KEY"]}, timeout=10)
d = r.json()
print(d["verdict"], d["score"], d["summary"])
using var http = new HttpClient();
http.DefaultRequestHeaders.Add("X-API-Key", Environment.GetEnvironmentVariable("WEATHERAI_KEY"));
var json = await http.GetStringAsync(
"https://api.weatherai.io/v1/decide?location=London&activity=running&when=tomorrow");
Console.WriteLine(json);
Authentication
Send your key in the X-API-Key header (Authorization: Bearer wai_… also works). ?key= works too, but headers keep keys out of logs and browser history. Keys start with wai_. You can create up to 5 keys and revoke any of them in the dashboard; a revoked key stops working at once. Keep keys on your server; never put them in public web pages or apps.
GET /v1/decide
| Parameter | Required | Description |
|---|---|---|
location | yes | City or town name, lat,lon, UK postcode, US zip code, Canadian postal code or IP address. q also works. |
activity | yes | One of the activities. Common aliases such as run, bike, bbq, wedding and laundry are accepted. |
when | no | today (default), tomorrow or a date yyyy-MM-dd up to 13 days ahead, in the location's local time. |
from, to | no | Only consider hours from from (0–23) and before to (1–24), local time. Example: from=17&to=21 for an evening run. |
units | no | metric (default) or imperial for the figures in data. |
detail | no | hourly adds an hour-by-hour score with the main issue for each hour. |
Response
{
"location": { "name": "London", "region": "City of London, Greater London", "country": "United Kingdom",
"lat": 51.52, "lon": -0.11, "tz_id": "Europe/London", "localtime": "2026-10-17 21:04" },
"activity": "running",
"date": "2026-10-18",
"verdict": "good",
"score": 82,
"best_windows": [ { "start": "2026-10-18 07:00", "end": "2026-10-18 10:00", "score": 91 } ],
"risks": [ { "type": "rain", "severity": "high", "from": "2026-10-18 14:00", "to": "2026-10-18 18:00",
"detail": "1.2 mm of rain" } ],
"summary": "Good conditions for a run in London; best 07:00–10:00. Watch for rain from 14:00.",
"data": { "temp_min": 8.1, "temp_max": 14.0, "feels_like_min": 6.0, "feels_like_max": 12.5,
"rain_chance_max": 70, "precip_total_mm": 4.8, "wind_max_kph": 30, "gust_max_kph": 45,
"uv_max": 3, "cloud_avg": 52, "humidity_avg": 78, "sunrise": "07:24", "sunset": "18:07",
"units": "metric" },
"billing": { "charged": "free", "cost_gbp": "0.0000", "free_remaining": 993, "balance_gbp": "4.2000" }
}
| Field | Meaning |
|---|---|
verdict | great (85+), good (70+), fair (55+), poor (35+) or avoid. |
score | 0–100: how good the best opportunity on that date is. |
best_windows | Up to 3 runs of good hours (score 60+) at least as long as the activity needs, best first. Empty when nothing is good enough. |
risks | What lowers the score and when: rain, thunder, snow, wind, gusts, heat, cold, UV, cloud, humidity, visibility, moon; plus official weather alerts. Severity low, moderate or high (alerts use the issuer's severity). |
summary | One sentence ready to show to a user or read out by an assistant. |
data | Key figures for the hours considered. Stargazing adds the moon phase, illumination and moonrise/moonset. |
billing | Whether the call was free or paid, what it cost, free calls left this month and your credit balance. |
GET /v1/best-day
Which of the next days is best? One call compares up to 14 days for an activity and ranks them. It costs one call, however many days it compares.
| Parameter | Required | Meaning |
|---|---|---|
location, activity | yes | As for /v1/decide. |
days | no | How many days to compare, starting today: 1 to 14. Default 7. |
from, to, units | no | As for /v1/decide, applied to every day (e.g. evenings only: from=17&to=22). |
GET https://api.weatherai.io/v1/best-day?location=London&activity=bbq&days=7
{
"location": { "name": "London", "country": "United Kingdom", … },
"activity": "outdoor-event",
"days_checked": 7,
"summary": "Best day for an outdoor event in London: Saturday 17 October (great, 92), 12:00–19:00.",
"best": { "date": "2026-10-17", "weekday": "Saturday", "verdict": "great", "score": 92,
"best_window": { "start": "2026-10-17 12:00", "end": "2026-10-17 19:00", "score": 92 },
"top_risks": [], "summary": "Great conditions for an outdoor event in London; best 12:00–19:00." },
"days": [ { "date": "2026-10-14", "weekday": "Wednesday", "verdict": "fair", "score": 61, … }, … ],
"billing": { … }
}
Activities
| activity | What it looks for | Shortest window | Hours considered |
|---|---|---|---|
running | Outdoor run or jog: comfortable temperature, little rain, light wind, not too much sun. | 1 h | 05:00–22:00 |
cycling | Road or leisure cycling: wind and gusts matter most, then rain and temperature. | 2 h | 05:00–21:00 |
outdoor-event | Several hours outdoors with guests: dry, warm enough, not too windy, in daylight. | 4 h | 08:00–23:00 |
beach | Sunbathing and swimming: warm, sunny, dry and not too windy. High UV is reported as a risk, not a reason to stay away. | 3 h | 07:00–20:00 |
laundry-drying | Washing on the line: dry air, a breeze, some warmth and no rain. | 4 h | 06:00–21:00 |
stargazing | Clear, dark skies at night: little cloud, a small or set moon, good visibility and no rain. | 2 h | 18:00–06:00 next day |
hiking | Several hours on foot in daylight: dry, mild, good visibility, no storms. Mountain weather can differ from the forecast for the nearest town. | 3 h | 06:00–20:00 |
golf | Four or more hours on the course: dry, light wind, comfortable temperature. Any thunder means off the course. | 4 h | 06:00–21:00 |
tennis | An hour or two on an outdoor court: dry courts and little wind matter most. | 1 h | 07:00–22:00 |
dog-walking | A walk with a dog: heat is the main danger (dogs overheat and pavements get hot), then storms and heavy rain. | 1 h | 05:00–23:00 |
gardening | A few hours in the garden: mild, mostly dry and not too windy. | 2 h | 07:00–20:00 |
fishing | Hours by the water: light wind, no storms (a rod attracts lightning). Light rain and cloud are fine. | 3 h | 04:00–22:00 |
sailing | Needs a breeze of about 12 to 35 km/h, no squalls or storms, and good visibility. Not a marine forecast: check official marine and tide information before going out. | 3 h | 07:00–20:00 |
drone-flying | Short flights in daylight: low wind and gusts, no rain or snow, good visibility, batteries above about 5°C. Always follow local drone rules. | 1 h | 06:00–21:00 |
exterior-painting | Painting walls, fences or woodwork outside: air at 10°C or more, dry for hours, humidity under about 70% and little wind. Check the paint's own limits. | 5 h | 07:00–19:00 |
concrete-pour | A pour and the first hours of curing: air above 5°C (no frost), no rain, not too hot or windy (fast drying cracks the surface). | 6 h | 06:00–19:00 |
roofing | Work on roofs and scaffolding: wind and gusts first, then rain, ice and storms. | 4 h | 06:00–20:00 |
crop-spraying | Spraying crops: a light, steady breeze (about 3 to 15 km/h; dead calm risks drift in an inversion), no rain soon after, not hot. Always follow the product label. | 2 h | 05:00–21:00 |
outdoor-work | A shift outdoors: heat stress first, then storms, cold, ice and heavy rain. | 4 h | 06:00–20:00 |
driving | Time on the road: ice, snow, fog, heavy rain and storm-force gusts. Temperature itself does not matter. | 2 h | 05:00–23:00 |
The list is also available as JSON, free and without a key: GET https://api.weatherai.io/v1/activities.
How scoring works
Every forecast hour starts at 100 and loses points for each thing outside the activity's comfortable range: the "feels like" temperature, the chance and amount of rain, thunderstorms, snow, wind and gusts, UV, cloud, humidity, visibility, darkness (or daylight, for stargazing), moonlight, ice (near-freezing with rain or snow, for driving, roofing and walking) and a minimum air temperature for work that needs it (concrete, paint). Hours scoring 60 or more are good; runs of good hours at least as long as the activity needs become best_windows. The rules are deliberately simple and the same for every customer, so answers are explainable.
Hours that have already passed at the location are never recommended.
Errors
Errors return JSON {"error": {"code": "…", "message": "…"}}. Only a successful 200 answer is charged.
| HTTP | code | Meaning |
|---|---|---|
| 400 | invalid_location, invalid_activity, invalid_when, invalid_time_range, invalid_days | Fix the request. |
| 401 | missing_key, invalid_key | Send a valid key. |
| 402 | no_credit | This month's free calls are used and your credit is empty: top up. |
| 403 | email_not_verified, account_suspended | Verify your email or contact support. |
| 404 | location_not_found | We couldn't find that place. |
| 422 | no_hours_left | No forecast hours left for that date and time range (for example, late evening for "today"). |
| 429 | rate_limited | Slow down (see limits below). |
| 503 | weather_unavailable | Temporary problem on our side. Retry shortly. |
Billing and limits
- 1,000 free calls every calendar month (UTC), then £0.0012 per call from prepaid credit, VAT included. See pricing.
/v1/decideand/v1/best-daycost one call each when they succeed, and so do the MCP toolsdecideandbest_day. Everything else is free.- Every answer carries headers
X-Free-Calls-Remaining,X-Credit-Balance-GBPandX-Call-Cost-GBP. - Up to 20 requests per second per account.
- Answers for the same place are cached for up to 10 minutes on our side; caching on yours for 10–30 minutes is fine and saves calls.
Other endpoints (free)
GET /v1/activities | The activities you can ask about. No key needed. |
GET /v1/usage | Free calls used and left this month, credit balance and how many paid calls it covers. Needs your key. |
GET /openapi.json | OpenAPI 3 description of the API. |
GET /health | Returns ok when the API is up. |
MCP server (AI agents)
weatherAI.io is also an MCP server, so assistants and agents can use it as tools without any code. Server URL:
https://api.weatherai.io/mcp
It speaks the Streamable HTTP transport. Authenticate with your API key as the X-API-Key header (or Authorization: Bearer wai_…). For apps that only take a URL, add it as ?key=wai_…, and treat that URL as a secret.
| Tool | What it does | Cost |
|---|---|---|
decide | Verdict, score, best windows, risks and summary for one activity, place and day. | 1 call |
best_day | Compares the next days (up to 14) and picks the best. | 1 call |
list_activities | The activities the tools understand. | free |
get_usage | Free calls left this month and credit balance. | free |
Claude Code
claude mcp add --transport http weatherai https://api.weatherai.io/mcp --header "X-API-Key: wai_YOUR_KEY"
Claude (claude.ai and the desktop app)
Settings → Connectors → Add custom connector, with the URL https://api.weatherai.io/mcp?key=wai_YOUR_KEY.
Cursor (~/.cursor/mcp.json)
{
"mcpServers": {
"weatherai": {
"url": "https://api.weatherai.io/mcp",
"headers": { "X-API-Key": "wai_YOUR_KEY" }
}
}
}
VS Code (.vscode/mcp.json)
{
"servers": {
"weatherai": {
"type": "http",
"url": "https://api.weatherai.io/mcp",
"headers": { "X-API-Key": "wai_YOUR_KEY" }
}
}
}
Menus and file locations change between versions of these apps; if a step doesn't match, look for "MCP servers" or "connectors" in the app's settings.
Without MCP
Give your agent the OpenAPI spec or this function definition. The summary field is meant to be repeated to the user as it is.
{
"name": "weather_decision",
"description": "Decide whether and when to do an outdoor activity at a place and date. Returns verdict, score 0-100, best time windows, risks and a one-line summary.",
"parameters": {
"type": "object",
"properties": {
"location": { "type": "string", "description": "City, 'lat,lon', postcode or zip code" },
"activity": { "type": "string", "enum": ["running", "cycling", "outdoor-event", "beach", "laundry-drying", "stargazing", "hiking", "golf", "tennis", "dog-walking", "gardening", "fishing", "sailing", "drone-flying", "exterior-painting", "concrete-pour", "roofing", "crop-spraying", "outdoor-work", "driving"] },
"when": { "type": "string", "description": "today, tomorrow or yyyy-MM-dd (up to 13 days ahead)" }
},
"required": ["location", "activity"]
}
}