Getting started overview

wttr.in is a command-line utility and web service designed to deliver weather forecasts directly to your terminal or web browser. It distinguishes itself by offering a minimalist interface and requiring no complex setup or authentication for fundamental usage. Users can query weather conditions for specific locations, view multi-day forecasts, and receive output in various formats, including plain text, Unicode art, and machine-readable JSON. The service is built for quick access and integration into scripts, making it a common choice for developers and system administrators requiring immediate weather data without graphical interfaces or extensive API configurations.

The process of getting started with wttr.in involves directly sending an HTTP GET request to its endpoint, typically using command-line tools such as curl or wget. There's no registration, API key acquisition, or SDK installation required to begin. This simplicity allows users to obtain weather information almost instantaneously, focusing on the data itself rather than infrastructure setup. wttr.in's design prioritizes ease of use and accessibility, aligning with the principles of lightweight command-line tools that offer utility without overhead.

Here's a quick reference for the basic steps to get started:

Step What to do Where
1. Open terminal Access your command-line interface Local computer
2. Make request Type curl wttr.in Terminal prompt
3. Observe output View weather forecast Terminal display
4. Customize (optional) Add location or format parameters Terminal prompt

Create an account and get keys

One of the primary advantages of wttr.in is its design which eliminates the need for user accounts, API keys, or any form of registration for its core functionality. This approach simplifies access significantly compared to many other weather services, which often require developers to sign up, generate credentials, and manage rate limits or subscription tiers. For wttr.in, all required information is embedded directly within the URL of the HTTP request itself. This means that anyone with an internet connection and a command-line tool like curl can immediately start fetching weather data.

There are no authentication headers, API key parameters, or OAuth flows to implement. This design choice aligns with the philosophy of simple, open-source command-line utilities that prioritize immediate utility and minimal friction. Developers can integrate wttr.in into scripts or applications without the overhead of credential storage, rotation, or secure transmission, which streamlines development and deployment processes for basic weather information retrieval. For advanced usage or custom instances, users might consider hosting their own wttr.in server, which also does not introduce API key requirements for the client, only server setup and maintenance if they choose to install wttr.in locally.

Your first request

Making your first request to wttr.in is straightforward and can be done from any terminal with curl installed. The most basic request fetches weather for your current estimated location. This is often determined by your IP address, which the service uses to approximate your geographic position.

Basic Request (Current Location)

To get the weather for your current location, simply open your terminal and type:

curl wttr.in

This command sends an HTTP GET request to the wttr.in server, which responds with a three-day weather forecast presented as a plain-text or Unicode art output. The output typically includes current conditions, temperature, wind speed, precipitation, and a forecast for the upcoming days, all rendered within the terminal window.

Requesting Weather for a Specific Location

To specify a location, append the location name to the wttr.in/ URL. You can use city names, airport codes (like JFK), or even geographical coordinates.

curl wttr.in/London

This command will display the weather for London. For locations with spaces, replace the space with an underscore or use a + sign, or quote the URL (though quoting is generally more robust for web requests, as explained by Mozilla's guide to URLs).

curl wttr.in/New_York
# OR
curl wttr.in/New+York

Specifying Output Format (JSON)

For programmatic use or integration into other applications, wttr.in supports a JSON output format. To request JSON, append ?format=j1 to your query.

curl wttr.in/Paris?format=j1

This will return a JSON object containing detailed weather information, including current conditions, daily forecasts, and hourly data. The JSON format is particularly useful for parsing weather data within scripts, allowing developers to extract specific pieces of information such as temperature, humidity, or wind speed programmatically.

Other Format Options

wttr.in also supports other formats, such as ?format=v2 for a more verbose textual output, or ?format=v3 for a condensed format. You can explore all available options by visiting the wttr.in help page directly in your browser or terminal.

Common next steps

Once you've successfully made your first request to wttr.in, several common next steps can enhance your usage, integrate it into your workflow, or explore its advanced capabilities.

  1. Explore Customization Options: wttr.in offers extensive customization through URL parameters. You can modify units (metric vs. imperial), language, display specific information (e.g., moon phase, sunrise/sunset times), and adjust the number of days in the forecast. For example, to get a two-day forecast in Fahrenheit for Berlin, you might use curl wttr.in/Berlin?2&F. A comprehensive list of these options is available on the wttr.in documentation page.

  2. Integrate into Shell Scripts: The ease of use and JSON output make wttr.in ideal for shell scripting. You can parse the JSON output using tools like jq to extract specific data points and integrate them into custom terminal dashboards, status bar indicators, or automated reports. For instance, a script could fetch the current temperature for your city every hour and display it in a notification.

    #!/bin/bash
    WEATHER_DATA=$(curl -s wttr.in/London?format=j1)
    TEMPERATURE=$(echo "$WEATHER_DATA" | jq -r '.current_condition[0].temp_C')
    echo "Current temperature in London: ${TEMPERATURE}°C"
  3. Set up an Alias: For frequently checked locations or specific formats, consider setting up a shell alias. This allows you to type a short command (e.g., weatherlondon) to get your desired forecast instantly.

    alias weatherlondon='curl wttr.in/London'

    Add this alias to your shell's configuration file (e.g., .bashrc, .zshrc) to make it persistent.

  4. Host Your Own Instance: For heavy usage, enhanced privacy, or specific customization requirements not met by the public service, you can host your own wttr.in instance. The project is open-source, and instructions for self-hosting wttr.in are available on its GitHub repository. This gives you full control over the service, including rate limits and data sources, though it requires server setup and maintenance.

  5. Explore ASCII Art and Graphics: Beyond basic text, wttr.in can render weather forecasts using ASCII art, moon phases, and even QR codes. Experiment with different visual parameters to find outputs that suit your preferences or specific display environments.

Troubleshooting the first call

While wttr.in is generally reliable and easy to use, you might encounter a few issues during your first call. Here are common problems and their solutions:

1. curl: (6) Could not resolve host: wttr.in

  • Problem: Your terminal cannot find the wttr.in domain. This usually indicates a network or DNS issue.

  • Solution:

    • Check your internet connection.
    • Verify that your DNS settings are correct. You can try pinging a known website like Google (ping google.com) to see if general internet connectivity is working.
    • Ensure no local firewall rules are blocking outbound HTTP requests.

2. No output or truncated output

  • Problem: The request completes, but no weather data is displayed, or the output is incomplete.

  • Solution:

    • The public wttr.in service might occasionally experience high load or temporary outages. Try again after a few minutes.
    • If you are behind a corporate proxy, curl might need proxy settings. For example, export http_proxy="http://your.proxy.com:8080". Consult your network administrator for correct proxy configurations.
    • Ensure you don't have any strange characters or syntax errors in your URL.

3. Incorrect location detected

  • Problem: wttr.in shows weather for a location different from your actual one when you don't specify a location.

  • Solution:

    • When no location is specified (curl wttr.in), the service estimates your location based on your IP address. IP-based geolocation can sometimes be inaccurate, especially for mobile networks or VPN users.
    • Always specify your desired location explicitly (e.g., curl wttr.in/Seattle) to ensure accuracy. Using specific coordinates (e.g., curl wttr.in/@47.6062,-122.3321 for Seattle) can further refine the location data, as detailed in the wttr.in usage guide.

4. Unexpected characters or display issues

  • Problem: The terminal output shows garbled characters instead of clear weather icons or text.

  • Solution:

    • This often happens if your terminal doesn't support Unicode characters. wttr.in tries to detect terminal capabilities but might sometimes default to Unicode.
    • Try forcing a basic ASCII output with curl wttr.in/?M or curl wttr.in/?F for plain characters.
    • Ensure your terminal's font and encoding settings are configured to support UTF-8, which is standard for modern terminals and widely supported. Further guidance on terminal encoding can be found in documentation like the Windows Terminal profile settings.

5. Error messages (e.g., "unknown location")

  • Problem: wttr.in returns an error message indicating it cannot find the specified location.

  • Solution:

    • Double-check the spelling of the location.
    • For multi-word locations, use underscores (_) or plus signs (+) instead of spaces (e.g., wttr.in/San_Francisco).
    • Try a more general location if a very specific address or small town isn't recognized.