BYTETOOLS

wttr.in API

wttr.in is a free console-oriented weather API with no key. Get weather as plain text, ASCII art, PNG or full JSON with one curl command. Live example included.

No API key requiredCORS enabledHTTPSCompletely free and open source. Self-hosting is supported for high-volume use.

Endpoint tested and returned HTTP 200 on 2026-08-19

What is the wttr.in API?

wttr.in is a free weather service designed to be called from the terminal with curl. It requires no API key and can return weather as formatted plain text, ASCII art, a PNG image or structured JSON, based purely on the URL you request.

wttr.in is the weather API that became famous because `curl wttr.in` just works. Requesting the bare hostname returns a colour-formatted three-day forecast rendered as text art, which makes it a favourite for shell prompts, tmux status bars and server MOTD banners.

For programmatic use, appending `?format=j1` switches it to a full JSON document containing current conditions and a three-day forecast in one response. That single-request completeness is its main advantage over APIs that make you assemble several calls.

Quick facts

Base URL
https://wttr.in
Authentication
No key. Please set a descriptive User-Agent and avoid hammering the service — it is run by a single maintainer.
Rate limit
Not formally published. Informal fair use; heavy scripted polling may be throttled by IP.
Pricing
Completely free and open source. Self-hosting is supported for high-volume use.
CORS
Enabled — callable directly from browser JavaScript
Official docs
Read the docs

How to use the wttr.in API

Every request below was executed against the live API on 2026-08-19, and the response shown is the real body it returned — not an illustration.

1. Full JSON weather for London

GET https://wttr.in/London?format=j1

curl
curl 'https://wttr.in/London?format=j1'
JavaScript (fetch)
const res = await fetch("https://wttr.in/London?format=j1");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);
Python (requests)
import requests

res = requests.get("https://wttr.in/London?format=j1", timeout=20)
res.raise_for_status()
print(res.json())
Response — HTTP 200 (truncated)
{
  "current_condition": [
    {
      "FeelsLikeC": "19",
      "FeelsLikeF": "66",
      "cloudcover": "99",
      "humidity": "46",
      "observation_time": "11:52 AM",
      "precipInches": "0.0",
      "precipMM": "0.1",
      "pressure": "1007",
      "pressureInches": "30",
      "temp_C": "21",
      "temp_F": "70",
      "uvIndex": "5",
      "visibility": "10",
      "visibilityMiles": "6",
      "weatherCode": "176",
      "weatherDesc": [
        {
          "value": "Patchy rain nearby"
        }
      ],
      "weatherIconUrl": [
        {
          "value": "https://cdn.worldweatheronline.com/images/wsymbols01_png_64/wsymbol_0009_light_rain_showers.png"
        }
      ],
      "winddir16Point": "WSW",
      "winddirDegree": "255",
      "windspeedKmph": "13",
      "windspeedMiles": "8"
    }
  ],
  "nearest_area": [
    {
      "areaName": [
        {
          "value": "London"
        }
      ],
      "country": [
        {
          "value": "United Kingdom"
        }
      ],
      "latitude": "51.517",
      "longitude": "-0.106",
      "population": "7421228",
      "region": [
        {
          "value": "City of London Greater London"
        }
      ],
      "weatherUrl": [
        {
          "value": "https://www.worldweatheronline.com/v2/weather.aspx?q=51.508,-0.121"
        }
      ]
    }
  ],
  "request": [
    {
      "query": "Lat 51.51 and Lon -0.13",
      "type": "LatLon"
    }
  ],
  "weather": [
    {
      "astronomy": [
        {
          "moon_illumination": "39",
          "moon_phase": "Waxing Crescent",
          "moonrise": "

Parameters

ParameterTypeRequiredDescription
<location>pathOptionalCity, airport code, IP, GPS coords or `~PlaceName`. Empty means geolocate by IP. London
formatstringOptional`j1` for full JSON, `j2` for a compact variant, or a custom one-line template. j1
langstringOptionalTwo-letter language code for text output. de
u / mflagOptionalForce USCS (`u`) or metric (`m`) units. m

Response fields

current_conditionarray
Single-element array with the current observation — temp_C, temp_F, humidity, weatherDesc and more.
weatherarray
Three days of forecast, each with `hourly` entries at three-hour intervals.
nearest_areaarray
The resolved location, useful for confirming the service understood your query.
requestarray
Echo of how your query was interpreted (query type and value).

What you can build with the wttr.in API

  • Show the weather in a terminal prompt, tmux bar or server login banner
  • Fetch a complete three-day forecast in a single request with format=j1
  • Generate a weather PNG for embedding in a README or status page
  • Quick weather lookups in shell scripts and CI jobs without key management

Common errors and how to fix them

404

The location string could not be resolved.

Fix: Try a larger nearby city, an airport code, or explicit `lat,lon` coordinates.

503

Upstream weather source temporarily unavailable, or you are being throttled.

Fix: Back off and retry after a minute; cache results rather than polling in a loop.

wttr.in API — frequently asked questions

How do I get JSON from wttr.in instead of ASCII art?

Append `?format=j1` to the URL. For example `curl 'https://wttr.in/London?format=j1'` returns a full JSON document with current conditions and a three-day forecast.

Does wttr.in need an API key?

No. It is completely key-free and open source. For heavy or commercial use the maintainer recommends self-hosting your own instance rather than polling the public one.

Can wttr.in detect my location automatically?

Yes. Requesting the bare hostname geolocates by your IP address. That is approximate and will be wrong behind a VPN, so pass an explicit location for anything user-facing.

What is the difference between format=j1 and format=j2?

Both return JSON; `j1` is the full document including hourly forecast arrays, while `j2` is a trimmed variant. Use `j1` unless response size is a concern.

Tools that pair with this API

wttr.in is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 2026-08-19; always check the official documentation before relying on this API in production, as terms and limits can change.