Important API update: We have made some updates to our service and from now on please send your app id through the "X-Yahoo-App-Id" header. We have also updated our documentation page and sample codes to reflect this change. Please refer to them as you see need. Please note that the "Yahoo-App-Id" header will be deprecated soon and after that request without the "X-Yahoo-App-Id" will be rejected.
Yahoo Weather API Documentation
The Weather RSS feed enables you to get up-to-date weather information for your location. You can save this feed in My Yahoo! or your favorite feed aggregator, or incorporate the RSS data into your own web site or client application. The Weather RSS feed is a dynamically-generated feed based on location, latitude & longitude or woeid.
This page describes the format of the Weather request URL and the RSS response for developers. It contains these sections:
- Query Request
- Code Example
- RSS Response
- Condition Codes
- JSON Response
- Attribution Guidelines
- Commercial Use
The Weather RSS feed request follows simple HTTP GET syntax: start with a base URL and then add parameters and values after a question mark (?). Multiple parameters are separated by an ampersand (&).
The API is OAuth1 protected and needs to sign the request with a Yahoo App consumer key and secret. Please read through code example for sample OAuth1 call to our API.
The base URL for the Weather RSS feed is
For the Weather RSS feed we support querying by location (city name), latitude & longitude (number) or woeid (number):
- location for location string.
- lat&lon for latitude & longitude number.
- woeid for woeid number. To find out woeid, see here.
For example, to get weather for Yahoo! Headquarters in Sunnyvale, CA, all of the following will work:
By default, the response is returned in XML format. You can supply a "format" parameter in the query to get JSON response:
By default, the units of response are in imperial format. You can supply a "u" parameter in the query to get metric format:
|location||city name||location=sunnyvale,ca or location=shanghai,cn|
|format||response format||format=xml (default) or format=json|
|u||unit format||u=f (default) or u=c|
We don't have API to get woeid for now. To find your woeid, browse or search for your city from Yahoo Weather page. The woeid is in the URL for the forecast page for that city. You can also get the woeid by entering your zip code on that page. For example, if you "Change location" for Sunnyvale, the forecast page for that city is https://www.yahoo.com/news/weather/united-states/sunnyvale/sunnyvale-2502265. The woeid is 2502265. Also you can find woeid from the API response.
Few notes when you are querying the API
- Our code examples are just for illustration purpose. Never expose the consumer secret in your code.
- Make sure all the query parameters ("location", "format", "u", etc) along with oauth parameters are sorted and encoded when generating the signature.
- Our code examples are trying to illustrate the implementation with native language. There are plenty of libraries out there to ease OAuth1 request.
The Weather RSS feed is an XML document that conforms to the RSS 2.0 specification. RSS is an XML document containing a single channel element representing the feed, several elements containing metadata about the feed itself, and one or more item elements describing individual items within the feed.
The Weather RSS feed also includes additional elements from the geo vocabulary as well as a custom yweather vocabulary.
The channel element contains metadata about the feed and its contents.
|title||The title of the feed, which includes the location city. For example "Yahoo! Weather - Sunnyvale, CA"|
|link||The URL for the Weather page of the forecast for this location|
|language||The language of the weather forecast, for example, en-us for US English.|
|description||The overall description of the feed including the location, for example "Yahoo! Weather for Sunnyvale, CA"|
|lastBuildDate||The last time the feed was updated. The format is in the date format defined by RFC822 Section 5, for example Mon, 256 Sep 17:25:18 -0700.|
|ttl||Time to Live; how long in minutes this feed should be cached.|
|yweather:location||The location of this forecast. Attributes:
|yweather:units||Units for various aspects of the forecast. Attributes:
|yweather:wind||Forecast information about wind. Attributes:
|yweather:atmosphere||Forecast information about current atmospheric pressure, humidity,
and visibility. Attributes:
|yweather:astronomy||Forecast information about current astronomical conditions. Attributes:
|image||The image used to identify this feed. See Image Elements for
Child elements: url, title, link, width, height
|item||The local weather conditions and forecast for a specific location.
See Item Elements for element descriptions.
Child elements: title, link, description, guid, pubDate, geo:lat, geo:long, yweather:forecast
The image element describes an image or icon used to identify the feed.
|title||The title of the image, for example "Yahoo! Weather"|
|link||The URL of Yahoo! Weather|
|url||The URL of the image|
|width||The width of the image, in pixels|
|height||The height of the image, in pixels|
The item element contains current conditions and forecast for the given location. There are multiple yweather:forecast elements for today and tomorrow.
|title||The forecast title and time, for example "Conditions for New York, NY at 1:51 pm EST"|
|link||The Yahoo! Weather URL for this forecast.|
|description||A simple summary of the current conditions and tomorrow's forecast, in HTML format, including a link to Yahoo! Weather for the full forecast.|
|guid||Unique identifier for the forecast, made up of the location ID, the date, and the time. The attribute isPermaLink is false.|
|pubDate||The date and time this forecast was posted, in the date format defined by RFC822 Section 5, for example Mon, 25 Sep 17:25:18 -0700.|
|geo:lat||The latitude of the location.|
|geo:long||The longitude of the location.|
|yweather:condition||The current weather conditions. Attributes:
|yweather:forecast||The weather forecast for a specific day. The item element contains
multiple forecast elements for today and tomorrow. Attributes:
Condition codes are used in the response to describe the current conditions.
|5||mixed rain and snow|
|6||mixed rain and sleet|
|7||mixed snow and sleet|
|14||light snow showers|
|27||mostly cloudy (night)|
|28||mostly cloudy (day)|
|29||partly cloudy (night)|
|30||partly cloudy (day)|
|35||mixed rain and hail|
|42||scattered snow showers|