Nearest Time

Returns, for each station, the one observation closest to a time you choose. Leave out the time to get each station's latest observation. Use it for maps, dashboards, and "what was the value at 12:00?" lookups. For a range of observations, use Time Series.

Request format

GET https://api.skyfora.com/api/v1/measurements/nearest
Header Required Value
X-API-Key Yes Your organization API key
curl "https://api.skyfora.com/api/v1/measurements/nearest?station_ids=4f9b1c2e-6a70-4a3e-9a4f-2d8f5b7c0e11,7c2d9e40-1b5f-4c8a-8d3e-6f0a9b4c2d55&data_vars=ztd,pwv&time=2026-03-20T12:00:00Z&within_seconds=900" \
  -H "X-API-Key: your-api-key-here"
import requests

resp = requests.get(
    "https://api.skyfora.com/api/v1/measurements/nearest",
    headers={"X-API-Key": "your-api-key-here"},
    params={
        "station_ids": "all",
        "data_vars": "ztd,pwv",
        "within_seconds": 900,
    },
)
resp.raise_for_status()
latest = {row["station_id"]: row for row in resp.json()["data"]}

Required parameters

Parameter Type Description Example
station_ids string Comma-separated station ids from Stations, or all for every station your organization is entitled to. 4f9b1c2e-...,7c2d9e40-...
data_vars string Comma-separated variables. See Variables. ztd,pwv

Optional parameters

Parameter Type Default Description
time ISO 8601 string now The time to look up. When omitted, the response has each station's latest observation.
within_seconds integer 3600 How far from time to look, 60 to 86400. With time, the window extends this far on both sides. Without it, only before now.
raw boolean false When true, observations that the default quality filter excludes can also be returned.

Response format

One row per station that has an observation in the window, with the same fields as a Time Series row. timestamp is the time of the observation found, not the requested time.

{
  "time": "2026-03-20T12:00:00Z",
  "data": [
    {
      "timestamp": "2026-03-20T11:59:30.000Z",
      "station_id": "4f9b1c2e-6a70-4a3e-9a4f-2d8f5b7c0e11",
      "display_name": "RAW_RAAS",
      "ztd": 2353.5,
      "pwv": 12.3
    }
  ],
  "count": 1,
  "missing_station_ids": ["7c2d9e40-1b5f-4c8a-8d3e-6f0a9b4c2d55"]
}
Field Description
time The requested time, or the server time when time was omitted
data[] One row per station with an observation in the window
count Number of rows in data
missing_station_ids Requested stations with no observation in the window

Notes

  • When two observations are equally close to time, the earlier one is returned.
  • A station in missing_station_ids sent no observation, or none that passed the quality filter, in the window. Its data_last_updated in Stations shows when it last did.
  • The quality filter applies by default, so the observation returned can be further from time than the station's nearest raw observation. Set raw=true to include every observation.