Historical Weather API

Historical weather observations for any global coordinate at one-hour granularity, spanning 47 plus years. Available on Professional and Expert plans.

OpenAPI Specification

openweathermap-history-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: OpenWeatherMap Historical Weather API
  version: 2.5.0
  description: >-
    Returns historical weather data for any location on the globe with one-hour
    granularity. Available on Professional and Expert plans. Data spans 47
    plus years.
  contact:
    name: OpenWeather
    url: https://openweathermap.org/history
  license:
    name: Creative Commons Attribution-ShareAlike 4.0 International
    url: https://creativecommons.org/licenses/by-sa/4.0/
servers:
  - url: https://history.openweathermap.org/data/2.5
    description: Historical Weather API base URL
paths:
  /history/city:
    get:
      operationId: getHistoricalWeatherCity
      summary: Historical Hourly Weather By Coordinate
      description: >-
        Returns hourly historical weather records for the supplied latitude,
        longitude, and time window. Maximum request span on Professional and
        Expert plans is one week per call.
      tags:
        - History
      parameters:
        - name: lat
          in: query
          required: true
          description: Latitude in decimal degrees.
          schema:
            type: number
            format: float
        - name: lon
          in: query
          required: true
          description: Longitude in decimal degrees.
          schema:
            type: number
            format: float
        - name: type
          in: query
          required: true
          description: Granularity. Currently only `hour` is supported.
          schema:
            type: string
            enum:
              - hour
        - name: start
          in: query
          required: false
          description: Unix UTC start timestamp.
          schema:
            type: integer
            format: int64
        - name: end
          in: query
          required: false
          description: Unix UTC end timestamp. Alternative to `cnt`.
          schema:
            type: integer
            format: int64
        - name: cnt
          in: query
          required: false
          description: Number of hourly timestamps to return. Alternative to `end`.
          schema:
            type: integer
        - name: units
          in: query
          required: false
          schema:
            type: string
            enum:
              - standard
              - metric
              - imperial
        - name: appid
          in: query
          required: true
          description: OpenWeather API key.
          schema:
            type: string
      responses:
        '200':
          description: Historical weather response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HistoricalWeatherResponse'
        '400':
          description: Invalid request parameters.
        '401':
          description: Unauthorized.
        '429':
          description: Too many requests.
components:
  schemas:
    HistoricalWeatherListItem:
      type: object
      properties:
        dt:
          type: integer
          format: int64
        main:
          type: object
          properties:
            temp:
              type: number
              format: float
            feels_like:
              type: number
              format: float
            pressure:
              type: integer
            humidity:
              type: integer
            temp_min:
              type: number
              format: float
            temp_max:
              type: number
              format: float
            sea_level:
              type: integer
            grnd_level:
              type: integer
        wind:
          type: object
          properties:
            speed:
              type: number
              format: float
            deg:
              type: integer
        clouds:
          type: object
          properties:
            all:
              type: integer
        rain:
          type: object
          properties:
            1h:
              type: number
              format: float
            3h:
              type: number
              format: float
        snow:
          type: object
          properties:
            1h:
              type: number
              format: float
            3h:
              type: number
              format: float
        weather:
          type: array
          items:
            type: object
            properties:
              id:
                type: integer
              main:
                type: string
              description:
                type: string
              icon:
                type: string
    HistoricalWeatherResponse:
      type: object
      properties:
        message:
          type: string
        cod:
          type: string
        city_id:
          type: integer
        calctime:
          type: number
          format: float
        list:
          type: array
          items:
            $ref: '#/components/schemas/HistoricalWeatherListItem'
  securitySchemes:
    appid:
      type: apiKey
      in: query
      name: appid
security:
  - appid: []
tags:
  - name: History
    description: Historical weather records by coordinate with hourly granularity.