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

# Fetch Weather Data

> Fetch weather data from an external source and persist it

# POST /weatherdata/fetch

Fetch weather data from a supported external source (e.g., NSRDB, PVGIS), validate the retrieved arrays, and save the result as a new weather data record. This is the server-side fetch path -- use `POST /weatherdata` instead if you already have weather arrays to upload directly.

## Notes

* Requires a valid JWT with write access.
* Required fields: `source` (the external provider identifier), `latitude` (-90 to 90), and `longitude` (-180 to 180).
* `name` is optional; if omitted, a default name is generated from the source and coordinates (e.g., `"NSRDB 35.0000,-106.0000"`).
* Additional source-specific parameters can be passed as extra fields in the request body and are forwarded to the fetch provider.
* Returns 400 if the external source returns invalid or inconsistent data.
* Returns 502 if the external source is unreachable or returns an unexpected error.
* The `weatherDataSource` on the created record reflects the provider name returned by the fetch service.

<Info>The fetched weather data is not automatically linked to a location. After creation, associate it with a location by referencing it during energy model configuration, or create it inline via `POST /locations` with a nested `weatherData` object.</Info>

* See `POST /weatherdata` to create weather data from your own arrays.
* See `GET /weatherdata/{weather_data_id}` to retrieve the fetched record.
