Code samples
Copy-pasteable snippets for the common tasks, in four languages. They assume your token is in WF_TOKEN (shell) or TOKEN (code), and reuse a few variables across
snippets for brevity. See the reference for every field.
List all models
Every model you can access, with its bounds, params, resolution and run cadence.
curl -H "Authorization: Bearer $WF_TOKEN" \ https://api.weatherfiles.com/v1/models
Filter models by parameter
No server-side filter — fetch /v1/models and filter on the params array (e.g. ocean currents).
curl -s -H "Authorization: Bearer $WF_TOKEN" \
https://api.weatherfiles.com/v1/models \
| jq '[.[] | select(.params | index("currents")) | .id]'Sliceless one-shot GRIB
Best for scripts/cron. bbox is west,east,south,north; -L follows the streamed response.
curl -H "Authorization: Bearer $WF_TOKEN" -L -o forecast.grib2 \ "https://api.weatherfiles.com/v1/grib?model=harm-nl¶ms=wind,gusts&bbox=3,7,51,54&time_window_h=48"
Create a slice and download it
A slice is a saved, refreshable request. POST returns a token + a stable download_url that always serves the latest run.
# create
TOKEN_URL=$(curl -s -H "Authorization: Bearer $WF_TOKEN" \
-H "Content-Type: application/json" \
-d '{"model_id":"harm-nl","params":["wind","gusts"],"bbox":"3,7,51,54","time_window_h":48,"label":"north-sea"}' \
https://api.weatherfiles.com/v1/slices | jq -r .download_url)
# download (no auth needed - the slice token is in the URL)
curl -L -o north-sea.grib2 "$TOKEN_URL"List slices, refresh the freshest
GET /v1/slices returns each slice with last_run_time / next_available_at. Re-download a slice URL any time to get its latest run.
curl -s -H "Authorization: Bearer $WF_TOKEN" https://api.weatherfiles.com/v1/slices \ | jq 'sort_by(.last_run_time) | last | .download_url'
Detect a new run is available
A slice URL always serves the current run. Use HEAD to cheaply check Last-Modified, or poll next_available_at from /v1/slices.
# Last-Modified changes when a new run is published curl -sI -L "$TOKEN_URL" | grep -i last-modified
Handle a 429 with Retry-After
Downloads are rate-limited per account. On 429, wait the Retry-After seconds and retry.
Not shown for curl — see the Python / Node / Go tabs.
Stream a large GRIB without buffering
Write the response straight to disk so a multi-MB GRIB never sits in memory.
Not shown for curl — see the Python / Node / Go tabs.