Xweather Forecasts API

Weather forecasts

OpenAPI Specification

xweather-forecasts-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Xweather Weather Air Quality Forecasts API
  description: The Xweather Weather API provides real-time and historical weather data including current conditions, forecasts, severe weather alerts, lightning data, air quality, maritime weather, and more. Backed by Vaisala, Xweather delivers science-backed hyper-local weather intelligence through a RESTful interface. Authentication uses a client ID and client secret passed as query parameters or HTTP headers.
  version: 1.0.0
  contact:
    name: Xweather Support
    url: https://www.xweather.com/support
  termsOfService: https://www.xweather.com/legal/terms
servers:
- url: https://data.api.xweather.com
  description: Xweather Weather API base URL
security:
- clientAuth: []
tags:
- name: Forecasts
  description: Weather forecasts
paths:
  /forecasts/{location}:
    get:
      operationId: getForecasts
      summary: Get Weather Forecasts
      description: Returns weather forecast data for a specified location including hourly and daily forecasts.
      tags:
      - Forecasts
      parameters:
      - name: location
        in: path
        required: true
        schema:
          type: string
        description: Location identifier (ZIP code, city name, lat/long, or place name).
        example: new-york,ny
      - name: client_id
        in: query
        required: true
        schema:
          type: string
        description: Your Xweather API client ID.
      - name: client_secret
        in: query
        required: true
        schema:
          type: string
        description: Your Xweather API client secret.
      - name: filter
        in: query
        required: false
        schema:
          type: string
          enum:
          - 1hr
          - 3hr
          - 6hr
          - 12hr
          - 1day
        description: Forecast interval filter.
      - name: limit
        in: query
        required: false
        schema:
          type: integer
        description: Number of forecast periods to return.
      - name: fields
        in: query
        required: false
        schema:
          type: string
        description: Comma-separated list of fields to return.
      responses:
        '200':
          description: Weather forecast data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForecastsResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  responses:
    NotFound:
      description: Not found - location or resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiResponse'
    Unauthorized:
      description: Unauthorized - invalid client ID or secret
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiResponse'
    BadRequest:
      description: Bad request - invalid parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiResponse'
  schemas:
    ApiResponse:
      type: object
      properties:
        success:
          type: boolean
          description: Whether the request was successful.
        error:
          $ref: '#/components/schemas/ApiError'
      required:
      - success
    ApiError:
      type: object
      properties:
        code:
          type: string
          description: Error code string.
          example: invalid_client
        description:
          type: string
          description: Human-readable error description.
          example: Invalid client ID or secret.
    ForecastsResponse:
      allOf:
      - $ref: '#/components/schemas/ApiResponse'
      - type: object
        properties:
          response:
            type: object
            properties:
              loc:
                $ref: '#/components/schemas/Location'
              periods:
                type: array
                items:
                  $ref: '#/components/schemas/ForecastPeriod'
    ForecastPeriod:
      type: object
      properties:
        timestamp:
          type: integer
          description: Unix timestamp for the forecast period.
        dateTimeISO:
          type: string
          format: date-time
        maxTempC:
          type: number
          description: Maximum temperature in Celsius.
        maxTempF:
          type: number
          description: Maximum temperature in Fahrenheit.
        minTempC:
          type: number
          description: Minimum temperature in Celsius.
        minTempF:
          type: number
          description: Minimum temperature in Fahrenheit.
        avgTempC:
          type: number
        avgTempF:
          type: number
        precipMM:
          type: number
          description: Precipitation amount in mm.
        precipIN:
          type: number
          description: Precipitation amount in inches.
        pop:
          type: integer
          description: Probability of precipitation (0-100).
        humidity:
          type: integer
          description: Relative humidity percentage.
        windSpeedKPH:
          type: number
        windSpeedMPH:
          type: number
        windDir:
          type: string
        windDirDEG:
          type: number
        weather:
          type: string
        weatherCoded:
          type: array
          items:
            type: object
        icon:
          type: string
        isDay:
          type: boolean
    Location:
      type: object
      properties:
        id:
          type: string
          description: Location identifier.
        name:
          type: string
          description: Location name.
        state:
          type: string
          description: State or province code.
        stateFull:
          type: string
          description: Full state or province name.
        country:
          type: string
          description: Country code (ISO 3166-1 alpha-2).
        countryFull:
          type: string
          description: Full country name.
        lat:
          type: number
          format: float
          description: Latitude.
        lon:
          type: number
          format: float
          description: Longitude.
        elevM:
          type: number
          description: Elevation in meters.
        elevFT:
          type: number
          description: Elevation in feet.
        profile:
          type: object
          description: Additional location profile data.
  securitySchemes:
    clientAuth:
      type: apiKey
      in: query
      name: client_id
      description: Xweather uses client_id and client_secret query parameters for authentication. Both are required on every request.