> ## Documentation Index
> Fetch the complete documentation index at: https://dos.dzaleka.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Weather API

> Get local weather forecast for Dzaleka and Dowa district

## GET /api/weather

Retrieve current weather conditions and forecast for the Dowa district (where Dzaleka is located).

<Note>
  Weather data is sourced from the Malawi Meteorological Services website and updated regularly.
</Note>

### Query Parameters

No query parameters required.

### Response Format

<ResponseField name="location" type="string" required>
  Location name (typically "Dowa")
</ResponseField>

<ResponseField name="date" type="string" required>
  Forecast date
</ResponseField>

<ResponseField name="forecast" type="object" required>
  Weather forecast data

  <ResponseField name="current" type="object" required>
    Current weather conditions

    <ResponseField name="temperature" type="string">
      Maximum temperature
    </ResponseField>

    <ResponseField name="minTemperature" type="string">
      Minimum temperature
    </ResponseField>

    <ResponseField name="condition" type="string">
      Weather condition (e.g., "Sunny", "Rain", "Cloudy")
    </ResponseField>

    <ResponseField name="rainfall" type="string">
      Expected rainfall amount
    </ResponseField>

    <ResponseField name="windSpeed" type="string">
      Wind speed
    </ResponseField>

    <ResponseField name="windDirection" type="string">
      Wind direction
    </ResponseField>

    <ResponseField name="time" type="string">
      Time period for forecast
    </ResponseField>
  </ResponseField>

  <ResponseField name="hourly" type="array" required>
    Hourly forecast breakdown with same fields as current
  </ResponseField>
</ResponseField>

<ResponseField name="alerts" type="array" required>
  Array of weather alerts and warnings

  <ResponseField name="type" type="string">
    Alert type ("warning", "severe", "info")
  </ResponseField>

  <ResponseField name="message" type="string">
    Alert message with details
  </ResponseField>
</ResponseField>

<ResponseField name="lastUpdated" type="string" required>
  ISO 8601 timestamp of last data update
</ResponseField>

### Example Request

```bash theme={null}
curl https://services.dzaleka.com/api/weather
```

### Example Response

```json theme={null}
{
  "location": "Dowa",
  "date": "March 9, 2026",
  "forecast": {
    "current": {
      "temperature": "28°C",
      "minTemperature": "18°C",
      "condition": "Partly Cloudy",
      "rainfall": "0mm",
      "windSpeed": "15 km/h",
      "windDirection": "SE",
      "time": "12:00 - 15:00"
    },
    "hourly": [
      {
        "time": "15:00 - 18:00",
        "condition": "Rain",
        "maxTemp": "24°C",
        "minTemp": "19°C",
        "rainfall": "5mm",
        "windSpeed": "20 km/h",
        "windDirection": "E"
      }
    ]
  },
  "alerts": [
    {
      "type": "warning",
      "message": "15:00 - 18:00: Rain - 5mm rainfall, 20 km/h wind"
    }
  ],
  "lastUpdated": "2026-03-09T10:30:00Z"
}
```

### Error Responses

<ResponseField name="error" type="string">
  Error message if weather data fetch fails
</ResponseField>

**500 Internal Server Error**:

```json theme={null}
{
  "error": "Failed to fetch weather data"
}
```

## Use Cases

* Display current weather on community dashboard
* Plan outdoor events based on forecast
* Agriculture and farming planning
* Community safety alerts during severe weather

## Data Source

Weather data is scraped from the [Malawi Meteorological Services](https://www.metmalawi.gov.mw/) daily forecast for Dowa district.

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Events API" icon="calendar" href="/api/events">
    Plan events with weather data
  </Card>

  <Card title="Population API" icon="users" href="/api/population">
    Camp population statistics
  </Card>
</CardGroup>
