---
title: "Get historical weather data"
url: "https://dev-portal.dehaven.org/apis/empty-api-v1/versions/e40571fa-f6cf-4b13-a833-6fc3b759e34d/operations/getHistoricalWeather"
---

> Full API specification: https://dev-portal.dehaven.org/apis/empty-api-v1/versions/e40571fa-f6cf-4b13-a833-6fc3b759e34d.md

# Get historical weather data

`GET` `/historical-weather`

Operation ID: `getHistoricalWeather`

Fetches historical weather data for a specific location and date range.

## Query parameters

- `location` (string, required) - Location for which to retrieve historical weather data.
- `start_date` (string, date, required) - Start date for the historical data (YYYY-MM-DD).
- `end_date` (string, date, required) - End date for the historical data (YYYY-MM-DD).
- `limit` (integer, int32, optional) - Maximum number of items to return
- `offset` (integer, int32, optional) - Number of items to skip

## Responses

- `200` - Successful operation
- `400` - Bad Request
- `500` - Internal Server Error

## OpenAPI definition

```yaml
openapi: 3.1.0
info:
  title: Weather API
  version: 1.0.0
servers:
  - url: https://api.example.com/weather/v1
    description: Main API server
paths:
  /historical-weather:
    get:
      summary: Get historical weather data
      description: Fetches historical weather data for a specific location and date range.
      operationId: getHistoricalWeather
      tags:
        - Weather
      parameters:
        - name: location
          in: query
          description: Location for which to retrieve historical weather data.
          schema:
            type: string
          required: true
        - name: start_date
          in: query
          description: Start date for the historical data (YYYY-MM-DD).
          schema:
            type: string
            format: date
          required: true
        - name: end_date
          in: query
          description: End date for the historical data (YYYY-MM-DD).
          schema:
            type: string
            format: date
          required: true
        - name: limit
          in: query
          description: Maximum number of items to return
          schema:
            type: integer
            format: int32
            minimum: 1
            maximum: 100
            default: 20
        - name: offset
          in: query
          description: Number of items to skip
          schema:
            type: integer
            format: int32
            minimum: 0
            default: 0
      responses:
        "200":
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HistoricalWeatherList"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
components:
  schemas:
    HistoricalWeatherList:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/HistoricalWeather"
        meta:
          type: object
          properties:
            page:
              type: object
              properties:
                offset:
                  type: integer
                  description: The number of items to skip before starting to collect the result
                    set.
                  example: 0
                limit:
                  type: integer
                  description: The numbers of items to return.
                  example: 20
                total:
                  type: integer
                  description: The total number of items available.
                  example: 30
                estimated_total:
                  type: boolean
                  description: If the total number of items available is an estimate.
                  example: false
      example:
        data:
          - date: 2024-07-01
            temperature: 20
            humidity: 75
            wind_speed: 10
            description: Sunny
          - date: 2024-07-02
            temperature: 22
            humidity: 70
            wind_speed: 12
            description: Cloudy
        meta:
          page:
            offset: 0
            limit: 20
            total: 30
            estimated_total: false
    Error:
      type: object
      properties:
        code:
          type: string
          description: Error code.
          example: "400"
        message:
          type: string
          description: Error message.
          example: Bad Request
    HistoricalWeather:
      type: object
      properties:
        date:
          type: string
          format: date
          description: Date of the historical weather data.
        temperature:
          type: number
          format: float
          description: Average temperature in Celsius.
        humidity:
          type: integer
          description: Average humidity percentage.
        wind_speed:
          type: number
          format: float
          description: Average wind speed in km/h.
        description:
          type: string
          description: Description of the weather conditions.
      example:
        date: 2024-07-01
        temperature: 20
        humidity: 75
        wind_speed: 10
        description: Sunny
```
