Will it rain or snow this weekend? Weather forecast API for AI agents (Google Search weather_result: 8-day, hourly, precipitation & wind JSON)
When a user asks an agent "will it snow in Denver Sunday?" or "should we drive home Saturday or Sunday?", one Google Search call returns Google's weather card as JSON: current or target-day conditions, an 8-day forecast with highs, lows and precipitation chance, about 11 days of hourly temperature, precipitation and wind, all without a weather-provider key. This guide shows which query shapes resolve which place, how to turn weekday labels into real dates, and what not to promise. Pay per call in USDC on Base via x402, or with a card credit pack. No account needed: pay per call with x402, or use a prepaid card credit key.
One-line answer
To answer "will it rain or snow this weekend?", call GET /api/public/v1/google-search?q=weather+<city or ZIP>+<day> and read weather_result: the headline block {location, date, weather, temperature, precipitation, humidity, wind}, forecast[] (8 days of {day, weather, temperature {high, low}, precipitation, wind}), and hourly_forecast[], precipitation_forecast[] and wind_forecast[] for hour-by-hour detail. One step, $0.005 USDC.
Grok Bot, Claude Cowork and Cursor agents get Google's weather card without signing up for a weather API key. The catches: days are labeled only by weekday name ("Friday" appears twice in one 8-day forecast), the place comes from the query text more than the location parameter, and Google's daily summary and its own hourly rows can disagree. No account needed: pay per call with x402, or use a prepaid card credit key.
What the user actually asked for
| User request | Call | Read first |
|---|---|---|
| What's the weather this weekend? (user's city known) | google-search?q=weather+this+weekend&location=Chicago,Illinois,United+States | weather_result.forecast[] for Saturday and Sunday; headline block is Google's pick of the target day |
| Will it snow in Denver Sunday? | google-search?q=will+it+snow+in+denver+sunday | forecast[] row for Sunday (weather, precipitation), then hourly_forecast[] for that day |
| Weather at my ZIP right now | google-search?q=weather+98501 | headline block {date, weather, temperature, humidity, wind} plus search_information.detected_location |
| When does the rain start Sunday? Leave before it? | Same city query | precipitation_forecast[] {day, time, precipitation} and hourly_forecast[] {time, weather, temperature} |
| Is it too windy to drive the van / fly the drone? | Same city query | wind_forecast[] {speed, direction, day, time} |
| Is there a winter storm warning or travel advisory? | google-news?q=<city>+winter+storm+warning (or google-search for the NWS page) | Headlines with dates; weather_result has no alerts field |
What the response holds
| Path | What it holds | How to use it |
|---|---|---|
| weather_result {location, date, weather} | The place Google resolved ("Chicago, IL", "Denver, CO", "Tumwater, WA 98501") and the day the headline describes | date can be a target day ("Saturday") or a timestamp ("Friday 8:00 AM"); it is not always now |
| weather_result.temperature {fahrenheit, celsius}, unit | Headline temperature as numbers in both scales | For a target day this matched that day's high, not a current reading |
| weather_result {precipitation, humidity, wind {kmh, mph}} | Percent strings and wind in both units | Parse "10%" to a number before comparing |
| forecast[] {day, weather, temperature {high, low}, precipitation, humidity, wind} | 8 daily rows starting today, so the first and last weekday name repeat | Assign real dates by position: row 0 is today in the place's zone |
| hourly_forecast[] {time, weather, temperature, precipitation, humidity, wind} | 264 hourly rows (about 11 days) such as "Friday 10:00 AM"; temperature is a string here | Labels repeat a week later; walk the array in order and roll the date at each midnight |
| precipitation_forecast[] {precipitation, day, time} | About 255 hourly precipitation chances | Find the first hour above your threshold for "when does it start" |
| wind_forecast[] {speed, direction, day, time, angle} | 85 rows, roughly every 3 hours, e.g. "18 mph", "From northwest" | Coarser than hourly; say "around" |
| search_information.detected_location | Where Google placed the search | Check it against weather_result.location and the user's actual place |
| ai_overview | Sometimes a prose summary; sometimes only {error, page_token} | Can lag the card; prefer weather_result numbers |
| organic_results[] | The Weather Channel, NWS, AccuWeather, local TV pages; most links are google.com/goto redirects | Snippets can describe a different week or year; cite pages, don't lift numbers |
Full schema: https://marketplaceforaiagents.com/listings/google-search (Markdown twin at https://marketplaceforaiagents.com/agent/listings/google-search.md). Time strings use a narrow no-break space before AM/PM ("10:00\u202fAM"), so normalize whitespace before parsing.
Live observation captured on 2026-11-27
On Black Friday, 2026-11-27, at ~16:51 UTC (10:51 a.m. Central), we checked the Thanksgiving return-travel weekend. Three free-tier calls to google-search with one X-Agent-Id (X-Free-Calls-Remaining went 2, 1, 0). The first two sent location=Chicago,Illinois,United States; the third sent no location.
| Step | What came back |
|---|---|
| q=weather this weekend (location Chicago) | weather_result.location "Chicago, IL"; headline date "Saturday": 52°F, mostly cloudy, 10% precipitation, 14 mph wind. forecast: Fri light rain 45/39 70%; Sat mostly cloudy 52/37 10%; Sun rain and snow 45/36 75%, 20 mph; Mon sunny 41/35. Hourly precipitation for Sunday rose from 10% at midnight to 75% by 4 a.m. AI Overview returned only an error ("not available for this search"). 7 of 9 organic links were google.com/goto redirects. |
| q=will it snow in denver sunday (location still Chicago) | Resolved to "Denver, CO" anyway (detected_location Denver, CO). Headline date "Sunday": 48°F, mostly cloudy, 10%. forecast: Sat light snow 58/30 45%, 23 mph; Sun mostly cloudy 48/23 10%. Sunday hourly ran clear to partly sunny, 23°F at 6 a.m. to 48°F at 3 p.m. All 10 organic results were local-TV snow stories, several from other storms (one said Saturday's high was 37). |
| q=weather 98501 (no location) | Resolved to "Tumwater, WA 98501" (the ZIP is Olympia's). Headline date "Friday 8:00 AM" (Pacific; the call ran at 8:51 a.m. local): 47°F light rain, 92% humidity. forecast: Fri light rain 49/41 74%; Sun light rain 47/41 35%; Mon light rain 51/43 65%, 16 mph. The AI Overview read like it was written the night before ("light rain expected later tonight and into Friday") and gave Sunday 75% rain vs the card's 35%. |
- The big quirk: no dates anywhere. forecast[] had 8 rows from Friday to the next Friday, and hourly_forecast[] had 264 rows but only 168 distinct labels, because "Saturday 12:00 AM" covers both Nov 28 and Dec 5. Derive dates from array position and today's date in the forecast place's zone.
- The query beats the location parameter. With location=Chicago, "will it snow in denver sunday" still answered for Denver. Put the place in q, then confirm weather_result.location.
- The headline block follows the question. "this weekend" put Saturday in the headline, "sunday" put Sunday, and the ZIP query gave current conditions. Don't call the headline "right now" unless date has a time.
- Daily and hourly can disagree. Denver's Saturday row said "Light snow" 45%, yet none of the 48 hourly rows labeled Saturday said snow (one said "Light rain"). Chicago's Sunday row said "Rain and snow" while that morning's hours said rain. Report both granularities honestly: "a rain/snow mix is possible; hourly shows mostly rain."
- ZIP codes resolve to Google's place name, not the post office city: 98501 came back as Tumwater, WA. Echo the resolved place to the user.
- Types are inconsistent: headline temperature is a number object, hourly temperature is a string ("42"), and percentages and winds are strings. Normalize before math.
- Snippets are not the forecast. Organic snippets showed other weeks and even a URL with /date/2024. The Weather Channel snippet for Chicago said Sunday 93% rain while Google's card said 75%. Quote the card, and if you cite another source, name it.
A fair answer from that data: "For Chicago this weekend, Saturday looks like the better travel day: mostly cloudy, high near 52°F, 10% chance of precipitation. Sunday turns wet. Rain chances climb from about 10% at midnight to 75% by 4 a.m., with a rain and snow mix possible and winds near 20 mph. That's Google's forecast as of 10:51 a.m. CT Friday. For storm warnings, check the National Weather Service."
Answer without overclaiming
- Say it is Google's forecast and give the check time. Forecasts change, and the headline block may lag by an hour.
- State the resolved place ("Tumwater, WA 98501") so the user can catch a wrong match.
- Precipitation is a chance, not an amount. weather_result has no snowfall or rainfall totals, so don't invent inches. If totals matter, cite a named forecaster from news or search results.
- No alerts, warnings or road conditions are in weather_result. For safety calls, point to the National Weather Service or state DOT and say you could not see official alerts.
- Give dates, not only weekday names, once you've mapped them. "Sunday, Nov 29" avoids next-week confusion.
- If weather_result is missing (some phrasing returns only links), say so and rephrase as "weather <place>" rather than quoting snippet numbers.
Budget by steps
The site's current per-step price is $0.005 USDC. google-search and google-news are 1 step each, and the 402 quotes the total.
| Work | Paid steps | Current cost |
|---|---|---|
| "Weather this weekend?" for one place | 1 | $0.005 USDC |
| Hour-by-hour for one place (same call, about 11 days) | 1 | $0.005 USDC |
| The sample above: two cities and one ZIP | 3 | $0.015 USDC |
| Road trip: origin, 3 stops, destination + one storm-warning news check | 6 | $0.030 USDC |
Totals assume every call is paid and succeeds. A failed upstream call returns 502 and is not charged. The live 402 is the source of truth: read accepts[0].amount. One call returns the 8-day and hourly forecast together, so cache it for the session and re-check only before the decision point (for example, the morning of departure). To check several stops at once, the MCP call_batch tool runs 1–25 queries with one exact total and all-or-nothing settlement; see https://marketplaceforaiagents.com/learn/batch-search-api-for-agents.
curl examples
Send a stable X-Agent-Id across the task:
A="weekend-weather-task"
B="https://marketplaceforaiagents.com/api/public/v1/google-search"
curl -s -G -H "X-Agent-Id: $A" "$B" --data-urlencode "q=weather this weekend" --data-urlencode "location=Chicago,Illinois,United States" > chi.json
curl -s -G -H "X-Agent-Id: $A" "$B" --data-urlencode "q=will it snow in denver sunday" > den.json
# Resolved place and the 8-day table
jq '.weather_result | {location, date, weather}, (.forecast[] | {day, weather, hi: .temperature.high, lo: .temperature.low, precipitation, wind})' chi.json
# Hourly rows with real dates: roll the date at each 12:00 AM (set START to today in the place's zone)
jq --arg start "2026-11-27" '.weather_result.hourly_forecast | reduce .[] as $h ({d: ($start + "T00:00:00Z" | fromdate), out: []};
(if ($h.time | gsub("\\s"; " ") | endswith(" 12:00 AM")) and (.out | length > 0) then .d += 86400 else . end)
| .out += [{date: (.d | strftime("%Y-%m-%d")), time: $h.time, weather: $h.weather, temp: ($h.temperature | tonumber), precip: $h.precipitation}]) | .out[:30]' chi.json
# First hour Sunday with a precipitation chance of 50% or more
jq '[.weather_result.precipitation_forecast[] | select(.day == "Sunday") | select((.precipitation | rtrimstr("%") | tonumber) >= 50)][0]' chi.jsonCheck for official warnings separately:
curl -s -G -H "X-Agent-Id: $A" "https://marketplaceforaiagents.com/api/public/v1/google-news" --data-urlencode "q=Chicago winter weather advisory" | jq '.news_results[:5][] | {title, source, date}'To rehearse payment with test USDC and fixture data, use the sandbox (not a live forecast):
curl -si "https://marketplaceforaiagents.com/api/sandbox/v1/google-search?network=base-sepolia&q=weather+this+weekend"Paying with x402 or a card credit key
Eligible agents get three free calls per agent identity, shared across endpoints. After that there are two ways to pay, and both cover every endpoint in this guide.
- x402 (no account): read PAYMENT-REQUIRED / accepts[], verify Base mainnet (eip155:8453), allowlist USDC 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 and payTo 0x05e82e03753c7bc99fb24d10a876cce53f24b7b7, sign the EIP-3009 transferWithAuthorization for the exact amount, and retry the identical request with PAYMENT-SIGNATURE (v2) or X-PAYMENT (v1). Keep the PAYMENT-RESPONSE / X-PAYMENT-RESPONSE receipt.
- Card credit pack: your user signs in at https://marketplaceforaiagents.com/account, buys a pack ($10 = 2,000 calls, $25 = 5,000, $50 = 10,000), creates an API key and gives it to you. Send Authorization: Bearer <mfa_live_ key>. Each call or intent step uses one credit, X-Credits-Remaining shows the balance, and an empty balance returns a 402 with buy_url.
Runtimes such as Grok Bot can sometimes use a card the user has provided; the user still approves the purchase. Raise payment only when a paid call is actually needed: say what it does and what it costs (one place's full forecast is one step), and offer a wallet, a card pack, any free calls left, the sandbox, or skipping. Ask once, accept a no, and never block the task. If the user says no, answer from what you already fetched and point them to the National Weather Service for the rest.
MCP and installed skills
The same flow works through https://marketplaceforaiagents.com/mcp with call_api:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "call_api",
"arguments": {
"slug": "google-search",
"params": { "q": "weather this weekend", "location": "Chicago,Illinois,United States" }
}
}
}For MCP payment handling see https://marketplaceforaiagents.com/learn/mcp-x402-marketplace and https://marketplaceforaiagents.com/docs. Runtimes that install skills can save https://marketplaceforaiagents.com/skill.md (or run npx -y skills add Cozy-ctrl/marketplaceforaiagents-skill -y) so the next "will it snow?" request starts here.
When not to use this
- Severe-weather alerts, evacuation or life-safety decisions: send the user to the National Weather Service and local officials. weather_result has no alerts.
- Snowfall or rainfall totals, radar, or road conditions: not in this response. Cite named forecasters or the state DOT from search or news results.
- Historical weather ("how cold was last Thanksgiving?"): the card is a forecast. Use plain search results and cite them.
- Aviation or marine decisions: use official METAR/TAF or marine forecasts, not a consumer weather card.
- Polling every few minutes: one call covers about 11 days of hours. Stay inside https://marketplaceforaiagents.com/acceptable-use.
Related guides and discovery
- https://marketplaceforaiagents.com/learn/google-search-api-for-agents
- https://marketplaceforaiagents.com/learn/knowledge-graph-answer-box-api-for-agents
- https://marketplaceforaiagents.com/learn/trip-planning-api-for-agents
- https://marketplaceforaiagents.com/learn/cheapest-dates-to-fly-api-for-agents
- https://marketplaceforaiagents.com/learn/holiday-hours-api-for-agents
- https://marketplaceforaiagents.com/learn/google-news-api-for-agents
- https://marketplaceforaiagents.com/learn/batch-search-api-for-agents
- https://marketplaceforaiagents.com/listings/google-search
- https://marketplaceforaiagents.com/listings/google-news
- https://marketplaceforaiagents.com/marketplace
- https://marketplaceforaiagents.com/docs
- https://marketplaceforaiagents.com/llms.txt
Next steps