Slices

A slice is a saved download request — a model + params + bbox + time window — with a stable URL that always serves the model's latest run. Create it once, download it forever; re-pull after each run to stay current. Use slices for repeated, shared or managed downloads; use /v1/grib for one-offs.

Create — POST /v1/slices

curl -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,
    "tags": ["routing"]
  }' \
  https://api.weatherfiles.com/v1/slices

Returns a token and a download URL:

{ "token": "abc123…", "download_url": "https://api.weatherfiles.com/v1/dl/abc123…" }
Body fieldNotes
model_idRequired.
paramsRequired — a JSON array (unlike /v1/grib's comma string).
bboxOptional west,east,south,north; defaults to the full domain.
time_window_h, time_step_h, spatial_factorSame meaning as /v1/grib.
tagsRequired for new slices — up to 10, lowercase letters / digits / hyphens. Slices are grouped, sorted, and filtered by their tag list. The legacy label field is deprecated; sending it returns 422.

Download — GET /v1/dl/<token>

The token is the credential, so no Authorization header is needed — it's a capability URL you can use from a chartplotter or share carefully.

# no Authorization header - the slice token in the URL is the credential
curl -L -o north-sea.grib2 "https://api.weatherfiles.com/v1/dl/abc123…"

List — GET /v1/slices

curl -H "Authorization: Bearer $WF_TOKEN" https://api.weatherfiles.com/v1/slices

Each entry includes the freshness fields you need to refresh intelligently:

FieldMeaning
download_urlThe stable /v1/dl/<token> link.
last_run_timeModel run currently served.
next_run_time / next_available_atWhen the next run is issued / expected to be downloadable.
estimated_size_kbApproximate download size.
tags, created_at, last_used_atYour metadata + usage. label is still returned on legacy slices for back-compat but new slices will have it as null.

Refresh on a new run

The download URL never changes; re-fetching it returns the latest run. To know when to re-fetch, either poll next_available_at from /v1/slices, or send a cheap HEAD to the download URL and watch its Last-Modified header change (see Samples).

Update & delete

Re-tag with PATCH /v1/slices/<token> — only tags is editable:

curl -X PATCH -H "Authorization: Bearer $WF_TOKEN" -H "Content-Type: application/json" \
  -d '{"tags":["routing","keep"]}' \
  https://api.weatherfiles.com/v1/slices/abc123…

Delete one with DELETE /v1/slices/<token>, or bulk-delete with DELETE /v1/slices/by-tag/<tag> and DELETE /v1/slices/untagged:

curl -X DELETE -H "Authorization: Bearer $WF_TOKEN" \
  https://api.weatherfiles.com/v1/slices/abc123…

Next: Errors & rate limits · full reference.