Weather API

Create custom API integrations using OpenAPI schemas to extend Mates' capabilities with any REST service

Last updated 11 months ago

Icon to Download

Overview

Introduction

The Weather API tool gives any Mate the ability to access current weather data and forecasts for locations worldwide. Using the WeatherAPI.com service, this tool provides real-time weather information, allowing you to get accurate weather conditions and predictions without leaving your conversation.

Getting Started

The Weather API tool is pre-configured and ready to use. You don't need to worry about authentication as it's already set up for you.

Key Features

Current Weather Information

Get real-time weather data for any location around the world.

Example:

What's the current weather in Tokyo?

Possible response:

Current weather in Tokyo, Japan:

Temperature: 18°C (64.4°F)

Condition: Partly cloudy

Humidity: 65%

Wind: 12 km/h from NE

Last updated: 2025-03-09 19:30 local time

Weather Forecasts

Obtain weather predictions for the coming days (up to 14 days).

Example:

Show me the 3-day forecast for New York.

Possible response:

3-day forecast for New York, United States:

Today (March 9):

  • High: 8.5°C (47.3°F)

  • Low: 1.2°C (34.2°F)

  • Condition: Cloudy with occasional showers

  • Chance of rain: 70%

  • Sunrise: 06:23 AM, Sunset: 05:58 PM

Tomorrow (March 10):

  • High: 10.2°C (50.4°F)

  • Low: 3.5°C (38.3°F)

  • Condition: Partly cloudy

  • Chance of rain: 20%

  • Sunrise: 06:21 AM, Sunset: 05:59 PM

March 11:

  • High: 12.8°C (55.0°F)

  • Low: 5.1°C (41.2°F)

  • Condition: Sunny

  • Chance of rain: 0%

  • Sunrise: 06:20 AM, Sunset: 06:00 PM

Air Quality Information

Get air quality data for locations when available.

Example:

What's the current air quality in Beijing?

Possible response:

Current air quality in Beijing, China:

US EPA Index: 4 (Unhealthy)

Temperature: 12°C (53.6°F)

Condition: Hazy

Humidity: 45%

Wind: 8 km/h from NW

Weather Alerts

Receive information about any active weather warnings or alerts.

Example:

Are there any weather alerts for Miami?

Possible response:

Weather alerts for Miami, Florida:

Flood Warning

  • Severity: Moderate

  • Areas affected: Miami and surrounding coastal areas

  • Heavy rainfall expected over the next 24 hours with potential for localized flooding

How to Use

Specifying Locations

You can request weather information for locations in several ways:

  • City name: "London", "Paris", "Tokyo"

  • City and country: "Melbourne, Australia", "Portland, US"

  • Postal codes: "90210" (for Beverly Hills, US)

  • Coordinates: "40.7128,-74.0060" (for New York)

Example:

What's the weather like in 90210?

Getting Detailed Information

For more specific weather data, you can make more detailed requests:

Example:

What's the wind speed and direction in Chicago right now?

Possible response:

Current wind conditions in Chicago, United States:

Wind speed: 25 km/h (15.5 mph)

Direction: NW (Northwest)

Gusts up to: 35 km/h (21.7 mph)

Temperature: -2°C (28.4°F)

Planning Ahead

Use the forecast feature to plan activities:

Example:

Will it rain in Seattle this weekend?

Possible response:

Weekend forecast for Seattle, United States:

Saturday (March 12):

  • Condition: Light rain

  • Chance of rain: 80%

  • High: 11°C (51.8°F), Low: 7°C (44.6°F)

Sunday (March 13):

  • Condition: Overcast with occasional showers

  • Chance of rain: 60%

  • High: 12°C (53.6°F), Low: 8°C (46.4°F)

It looks like rain is likely in Seattle this weekend, with the highest chance on Saturday.

Best Practices

Be Specific About Location

For the most accurate results, be as specific as possible about the location you're inquiring about:

Better: "What's the weather in Portland, Maine?"

Instead of: "What's the weather in Portland?" (could be Oregon or Maine)

Specify Timeframes for Forecasts

When asking about future weather, indicate the timeframe you're interested in:

Example:

What will the weather be like in Paris next Tuesday?

Ask About Specific Conditions

If you're interested in particular weather aspects, ask specifically:

Example:

Will it be windy in Chicago tomorrow?

Limitations

  • Weather forecasts become less accurate the further into the future they predict

  • Some remote locations may have limited data available

  • Severe weather conditions may change rapidly and not be reflected immediately

  • Air quality data may not be available for all locations

Conclusion

The Weather API tool gives any Mate the ability to provide accurate, up-to-date weather information and forecasts. Whether you're planning a trip, preparing for outdoor activities, or simply curious about conditions around the world, this tool delivers reliable weather data directly in your conversation.

OpenAPI Schema

openapi: 3.0.3
info:
  title: WeatherAPI.com
  description: |
    Weather data API with current conditions and forecasts.
    
    ## LLM Guide
    - Get weather data by location (city, coordinates, postal code)
    - API key is handled via credentials
    - Supports current weather and forecasts up to 14 days
  version: 1.0.0
servers:
  - url: https://api.weatherapi.com/v1

paths:
  /current.json:
    get:
      summary: Get current weather
      description: |
        Returns current weather for a location.
        
        ## For LLMs
        - Provide location via 'q' parameter
        - Use 'aqi=yes' for air quality data
        - API key is handled automatically
      operationId: getCurrentWeather
      parameters:
        - name: key
          in: query
          description: |
            API key (required).
            ## For LLMs
            - MUST use EXACT string '{{weatherApiKey}}' with braces
            - Will be replaced during execution
          required: true
          schema:
            type: string
            enum: ['{{weatherApiKey}}']
          example: '{{weatherApiKey}}'
        - name: q
          in: query
          description: |
            Location parameter:
            - City name (e.g., "London", "Paris,fr")
            - Coordinates (e.g., "48.8567,2.3508")
            - Postal code (e.g., "10001")
            - IP address
          required: true
          schema:
            type: string
          example: "Paris"
        - name: aqi
          in: query
          description: Include air quality data (yes/no)
          required: false
          schema:
            type: string
            enum: ["yes", "no"]
            default: "no"
      responses:
        '200':
          description: Weather data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CurrentWeatherResponse'
        default:
          $ref: '#/components/responses/Error'

  /forecast.json:
    get:
      summary: Get weather forecast
      description: |
        Returns forecast for a location.
        
        ## For LLMs
        - Specify days (1-14) for forecast length
        - Use 'alerts=yes' for weather warnings
        - API key is handled automatically
      operationId: getForecast
      parameters:
        - name: key
          in: query
          description: |
            API key (required).
            ## For LLMs
            - MUST use EXACT string '{{weatherApiKey}}' with braces
          required: true
          schema:
            type: string
            enum: ['{{weatherApiKey}}']
          example: '{{weatherApiKey}}'
        - name: q
          in: query
          description: Location (same options as current.json)
          required: true
          schema:
            type: string
          example: "Paris"
        - name: days
          in: query
          description: Number of forecast days (1-14)
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 14
            default: 1
          example: 3
        - name: aqi
          in: query
          description: Include air quality data (yes/no)
          required: false
          schema:
            type: string
            enum: ["yes", "no"]
            default: "no"
        - name: alerts
          in: query
          description: Include weather alerts (yes/no)
          required: false
          schema:
            type: string
            enum: ["yes", "no"]
            default: "no"
      responses:
        '200':
          description: Forecast data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForecastResponse'
        default:
          $ref: '#/components/responses/Error'

components:
  schemas:
    Location:
      type: object
      description: Location information
      properties:
        name:
          type: string
          example: "Paris"
        region:
          type: string
          example: "Ile-de-France"
        country:
          type: string
          example: "France"
        lat:
          type: number
          example: 48.87
        lon:
          type: number
          example: 2.33
        tz_id:
          type: string
          example: "Europe/Paris"
        localtime:
          type: string
          example: "2021-01-01 12:00"

    Condition:
      type: object
      description: Weather condition
      properties:
        text:
          type: string
          example: "Partly cloudy"
        icon:
          type: string
          example: "//cdn.weatherapi.com/weather/64x64/day/116.png"
        code:
          type: integer
          example: 1003

    CurrentWeather:
      type: object
      description: Current weather measurements
      properties:
        last_updated:
          type: string
          example: "2021-01-01 11:55"
        temp_c:
          type: number
          description: Temperature (°C)
          example: 5.0
        temp_f:
          type: number
          description: Temperature (°F)
          example: 41.0
        is_day:
          type: integer
          description: Daytime (1) or nighttime (0)
          enum: [0, 1]
          example: 1
        condition:
          $ref: '#/components/schemas/Condition'
        wind_mph:
          type: number
          example: 5.6
        wind_kph:
          type: number
          example: 9.0
        wind_dir:
          type: string
          example: "SW"
        pressure_mb:
          type: number
          example: 1024.0
        humidity:
          type: integer
          example: 81
        cloud:
          type: integer
          description: Cloud cover %
          example: 50
        feelslike_c:
          type: number
          example: 2.5
        vis_km:
          type: number
          description: Visibility (km)
          example: 10.0
        uv:
          type: number
          description: UV Index
          example: 1.0
        air_quality:
          type: object
          description: Air quality (only with aqi=yes)
          properties:
            us-epa-index:
              type: integer
              description: EPA index (1-6)
              example: 1

    ForecastDay:
      type: object
      description: Forecast for a day
      properties:
        date:
          type: string
          example: "2023-01-15"
        day:
          type: object
          properties:
            maxtemp_c:
              type: number
              example: 8.5
            mintemp_c:
              type: number
              example: 1.2
            avgtemp_c:
              type: number
              example: 5.3
            maxwind_kph:
              type: number
              example: 14.0
            totalprecip_mm:
              type: number
              example: 0.5
            condition:
              $ref: '#/components/schemas/Condition'
            daily_chance_of_rain:
              type: integer
              example: 20
        astro:
          type: object
          properties:
            sunrise:
              type: string
              example: "07:15 AM"
            sunset:
              type: string
              example: "05:45 PM"

    CurrentWeatherResponse:
      type: object
      description: Current weather response
      properties:
        location:
          $ref: '#/components/schemas/Location'
        current:
          $ref: '#/components/schemas/CurrentWeather'
    
    ForecastResponse:
      type: object
      description: Forecast response
      properties:
        location:
          $ref: '#/components/schemas/Location'
        current:
          $ref: '#/components/schemas/CurrentWeather'
        forecast:
          type: object
          properties:
            forecastday:
              type: array
              items:
                $ref: '#/components/schemas/ForecastDay'
        alerts:
          type: object
          description: Weather alerts (only with alerts=yes)
          properties:
            alert:
              type: array
              items:
                type: object
                properties:
                  headline:
                    type: string
                    example: "Flood Warning"
                  severity:
                    type: string
                    example: "Moderate"
                  areas:
                    type: string
                    example: "Paris and surrounding suburbs"
  
  responses:
    Error:
      description: Error response
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: object
                properties:
                  code:
                    type: integer
                    example: 1006
                  message:
                    type: string
                    example: "No location found matching parameter 'q'"