GribStream

Weather Forecast API Documentation

This API provides access to weather forecast data for all models. You can retrieve historical and forecasted weather data by specifying parameters such as time range, coordinates, and variables of interest.

You can use our python client at GitHub or roll your own with the details below. Sign-in to access an OpenAPI spec with Swagger UI.

Weather History Endpoint

For any given coordinate, weather parameter, and time range, there are multiple forecasted values available. Each value corresponds to a different forecast horizon (lead time), representing predictions made at various times in the past.

The API returns the forecasted value with the shortest forecast horizon for each time point. This means you receive the most recent and presumably most accurate prediction available at that moment. In data science, this is often referred to as the "best" forecast or the "nowcast" series.

    POST https://gribstream.com/api/v2/<model>/history
    

Available Models

Request Headers

Header Value Comment
Content-Type application/json Default and only valid value.
Accept Choose text/csv, application/json or application/ndjson Selects the response format. Defaults to text/csv
Accept-Encoding gzip Optional, recommended, for compressed response
Authorization Bearer <token> Replace <token> with your authentication token

Request Body Parameters

The request body should be a JSON object with the following structure:

Parameter Type Description Required
fromTime string (ISO 8601) Start time of the forecast period. Yes, either (fromTime, untilTime) or timeList
untilTime string (ISO 8601) End time of the forecast period. Yes, either (fromTime, untilTime) or timeList
timeList array of string (ISO 8601) Array of forecasted times. Yes, either (fromTime, untilTime) or timeList
asOf string (ISO 8601) Reference time for the forecast data. No
minHorizon integer Minimum forecast horizon in hours. No (default: 0)
maxHorizon integer Maximum forecast horizon in hours. No (default: 384)
coordinates array of coordinate objects List of geographical coordinates. Yes
variables array of variable objects List of weather variables to retrieve. Yes

NOTE: Selected time must be specified via range (fromTime, untilTime) or timesList

Coordinate Object

Field Type Description Required
lat float Latitude of the coordinate. Yes
lon float Longitude of the coordinate. Yes
name string Optional name for the coordinate, which will be returned in the response to help identify the location. No

Variable Object

Field Type Description Required
name string Name of the weather variable (e.g., "TMP" for temperature). Yes
level string Level of the atmosphere or surface (e.g., "2 m above ground"). Yes
info string Differentiator when the model has multiple parameters for the same name and level No
alias string Optional alias for the variable. If provided, this alias will be used as the column header in the response. No

Example Request

    POST https://gribstream.com/api/v2/hrrr/history
    Content-Type: application/json
    Accept-Encoding: gzip
    Authorization: Bearer <token>
    Payload:
    {
        "fromTime": "2025-03-10T05:00:00Z",
        "untilTime": "2025-03-10T10:00:00Z",
        "asOf": "2025-03-09T07:30:00Z",
        "minHorizon": 0,
        "maxHorizon": 48,
        "coordinates": [
            { "lat": 29.7604, "lon": -95.3698, "name": "Houston" }
        ],
        "variables": [
            { "name": "TMP", "level": "2 m above ground", "info": "", "alias": "temperature" }
        ],
    }
    

Example Response

The format of the response is determined by the Accept header. The API supports three response formats:

If the Accept-Encoding: gzip header is included, the response will be gzip-compressed.

NOTE: The response is not strictly in-order.

CSV Response Example

    forecasted_at,forecasted_time,lat,lon,name,Temperature
    2025-03-09T06:00:00Z,2025-03-10T06:00:00Z,29.760,-95.370,Houston,281.8953
    2025-03-09T06:00:00Z,2025-03-10T08:00:00Z,29.760,-95.370,Houston,280.9348
    2025-03-09T06:00:00Z,2025-03-10T05:00:00Z,29.760,-95.370,Houston,282.6501
    2025-03-09T06:00:00Z,2025-03-10T07:00:00Z,29.760,-95.370,Houston,281.3061
    2025-03-09T06:00:00Z,2025-03-10T09:00:00Z,29.760,-95.370,Houston,280.6853
    

JSON Response Example (Line-delimited)

    {"temperature":280.9347686767578,"forecasted_at":"2025-03-09T06:00:00Z","forecasted_time":"2025-03-10T08:00:00Z","lat":29.7604,"lon":-95.3698,"name":"Houston"}
    {"temperature":282.65013122558594,"forecasted_at":"2025-03-09T06:00:00Z","forecasted_time":"2025-03-10T05:00:00Z","lat":29.7604,"lon":-95.3698,"name":"Houston"}
    {"temperature":281.8952941894531,"forecasted_at":"2025-03-09T06:00:00Z","forecasted_time":"2025-03-10T06:00:00Z","lat":29.7604,"lon":-95.3698,"name":"Houston"}
    {"temperature":281.30609130859375,"forecasted_at":"2025-03-09T06:00:00Z","forecasted_time":"2025-03-10T07:00:00Z","lat":29.7604,"lon":-95.3698,"name":"Houston"}
    {"temperature":280.6852569580078,"forecasted_at":"2025-03-09T06:00:00Z","forecasted_time":"2025-03-10T09:00:00Z","lat":29.7604,"lon":-95.3698,"name":"Houston"}
    

NDJSON Response Example (JSON Array)

    [{"temperature":281.30609130859375,"forecasted_at":"2025-03-09T06:00:00Z","forecasted_time":"2025-03-10T07:00:00Z","lat":29.7604,"lon":-95.3698,"name":"Houston"}
    ,{"temperature":280.9347686767578,"forecasted_at":"2025-03-09T06:00:00Z","forecasted_time":"2025-03-10T08:00:00Z","lat":29.7604,"lon":-95.3698,"name":"Houston"}
    ,{"temperature":281.8952941894531,"forecasted_at":"2025-03-09T06:00:00Z","forecasted_time":"2025-03-10T06:00:00Z","lat":29.7604,"lon":-95.3698,"name":"Houston"}
    ,{"temperature":282.65013122558594,"forecasted_at":"2025-03-09T06:00:00Z","forecasted_time":"2025-03-10T05:00:00Z","lat":29.7604,"lon":-95.3698,"name":"Houston"}
    ,{"temperature":280.6852569580078,"forecasted_at":"2025-03-09T06:00:00Z","forecasted_time":"2025-03-10T09:00:00Z","lat":29.7604,"lon":-95.3698,"name":"Houston"}
    ]
    

Response Fields:

Field Description
forecasted_at The time when the forecast was generated.
forecasted_time The time for which the forecast applies.
lat Latitude of the coordinate.
lon Longitude of the coordinate.
name Name provided in the request for the coord set.
temperature Alias given to this weather parameter. Defaults to [name]|[level]|[info]. One of these per selected variable.

Usage Notes

Authentication

You need to include a valid authentication token in the Authorization header. You can obtain a demo token by making a request to:

    GET https://gribstream.com/auth/demo
    

Include the token in your request headers as follows:

    Authorization: Bearer <token>
    

Example cURL Command

    curl -X POST 'https://gribstream.com/api/v2/gfs/history' \
        -H "Content-Type: application/json" \
        -H "Accept-Encoding: gzip" \
        -H "Authorization: Bearer $(curl https://gribstream.com/auth/demo)" \
        -d '{
            "fromTime": "2022-08-10T00:00:00Z",
            "untilTime": "2022-08-13T00:00:00Z",
            "asOf": "2022-08-12T00:00:00Z",
            "minHorizon": 0,
            "maxHorizon": 384,
            "coordinates": [
                { "lat": 40.75, "lon": -73.98 },
                { "lat": 29.75, "lon": -95.36 },
                { "lat": 47.6, "lon": -122.33 }
            ],
            "variables": [
                { "name": "TMP", "level": "2 m above ground", "info": "" },
                { "name": "TMP", "level": "surface", "info": "" }
            ]
        }' | gunzip | head -20
    

This command retrieves the forecast data and outputs the first 20 lines of the decompressed response.

Error Handling

If there is an error with your request, the API will return an error message with an appropriate HTTP status code.

Common Error Codes

Status Code Meaning Description
400 Bad Request Invalid request parameters. Occurs when required parameters are missing or have invalid values.
401 Unauthorized Authentication failed. Occurs when the authentication token is missing or invalid.
500 Internal Server Error Server error. Occurs when there is an error processing the request on the server.

Weather Forecasts Endpoint

Retrieve all forecast runs during a time range, for a list of coordinates, for a list of weather parameters. Optionally filtering for a range of hours ahead (min/max horizons).

    POST https://gribstream.com/api/v2/<model>/forecasts
    

Available Models

Request Headers

Header Value Comment
Content-Type application/json Default and only valid value.
Accept Choose text/csv, application/json or application/ndjson Selects the response format. Defaults to text/csv
Accept-Encoding gzip Optional, recommended, for compressed response
Authorization Bearer <token> Replace <token> with your authentication token

Request Body Parameters

The request body should be a JSON object with the following structure:

Parameter Type Description Required
forecastedFrom string (ISO 8601) Earliest forecast run time. Yes, either (forecastedFrom, forecastedUntil) or timeList
forecastedUntil string (ISO 8601) Latest forecast run time. Yes, either (forecastedFrom, forecastedUntil) or timeList
timeList array of string (ISO 8601) Array of forecasted times. Yes, either (forecastedFrom, forecastedUntil) or timeList
minHorizon integer Minimum forecast horizon in hours. No (default: 0)
maxHorizon integer Maximum forecast horizon in hours. No (default: 384)
coordinates array of coordinate objects List of geographical coordinates. Yes
variables array of variable objects List of weather variables to retrieve. Yes

NOTE: Selected time must be specified via range (forecastedFrom, forecastedUntil) or timesList

Coordinate Object

Field Type Description Required
lat float Latitude of the coordinate. Yes
lon float Longitude of the coordinate. Yes
name string Optional name for the coordinate, which will be returned in the response to help identify the location. No

Variable Object

Field Type Description Required
name string Name of the weather variable (e.g., "TMP" for temperature). Yes
level string Level of the atmosphere or surface (e.g., "2 m above ground"). Yes
info string Differentiator when the model has multiple parameters for the same name and level No
alias string Optional alias for the variable. If provided, this alias will be used as the column header in the response. No

Example Request

    POST https://gribstream.com/api/v2/nbm/forecasts
    Content-Type: application/json
    Accept-Encoding: gzip
    Authorization: Bearer <token>
    Payload:
    {
        "forecastedFrom": "2024-09-10T00:00:00Z",
        "forecastedUntil": "2024-09-10T00:00:00Z",
        "minHorizon": 1,
        "maxHorizon": 3,
        "coordinates": [
            { "lat": 40.75, "lon": -73.98, "name": "NYC" },
            { "lat": 29.75, "lon": -95.36, "name": "Houston" },
            { "lat": 47.6, "lon": -122.33, "name": "Seattle" }
        ],
        "variables": [
            { "name": "TMP", "level": "2 m above ground", "info": "", "alias": "Temperature" },
            { "name": "WIND", "level": "10 m above ground", "info": "", "alias": "Wind Speed" },
            { "name": "DPT", "level": "2 m above ground", "info": "", "alias": "Dew Point" }
        ]
    }
    

Example Response

The format of the response is determined by the Accept header. The API supports three response formats:

If the Accept-Encoding: gzip header is included, the response will be gzip-compressed.

NOTE: The response order is not strictly in-order.

CSV Response Example

        forecasted_at,forecasted_time,lat,lon,name,Wind Speed,Dew Point,Temperature
        2024-09-10T00:00:00Z,2024-09-10T01:00:00Z,29.750,-95.360,Houston,3.6000,293.4500,301.0700
        2024-09-10T00:00:00Z,2024-09-10T01:00:00Z,40.750,-73.980,NYC,2.8000,282.6500,293.8700
        2024-09-10T00:00:00Z,2024-09-10T01:00:00Z,47.600,-122.330,Seattle,1.6000,288.2500,294.2700
        2024-09-10T00:00:00Z,2024-09-10T02:00:00Z,29.750,-95.360,Houston,3.2000,293.6000,300.2800
        2024-09-10T00:00:00Z,2024-09-10T02:00:00Z,40.750,-73.980,NYC,2.8000,282.8000,293.0800
        2024-09-10T00:00:00Z,2024-09-10T02:00:00Z,47.600,-122.330,Seattle,1.6000,288.4000,293.4800
        2024-09-10T00:00:00Z,2024-09-10T03:00:00Z,29.750,-95.360,Houston,3.2000,293.4600,299.4000
        2024-09-10T00:00:00Z,2024-09-10T03:00:00Z,40.750,-73.980,NYC,2.4000,282.6600,292.6000
        2024-09-10T00:00:00Z,2024-09-10T03:00:00Z,47.600,-122.330,Seattle,1.6000,288.2600,293.0000
    

JSON Response Example (One Object per Line)

        {"Dew Point":293.4499755859375,"Temperature":301.07001953125,"Wind Speed":3.6,"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T01:00:00Z","lat":29.75,"lon":-95.36,"name":"Houston"}
        {"Dew Point":282.6499755859375,"Temperature":293.87001953125,"Wind Speed":2.8000000000000003,"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T01:00:00Z","lat":40.75,"lon":-73.98,"name":"NYC"}
        {"Dew Point":288.24997558593753,"Temperature":294.27001953125,"Wind Speed":1.6,"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T01:00:00Z","lat":47.6,"lon":-122.33,"name":"Seattle"}
        {"Dew Point":293.6,"Temperature":300.28000488281253,"Wind Speed":3.2,"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T02:00:00Z","lat":29.75,"lon":-95.36,"name":"Houston"}
        {"Dew Point":282.8,"Temperature":293.0800048828125,"Wind Speed":2.8000000000000003,"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T02:00:00Z","lat":40.75,"lon":-73.98,"name":"NYC"}
        {"Dew Point":288.40000000000003,"Temperature":293.4800048828125,"Wind Speed":1.6,"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T02:00:00Z","lat":47.6,"lon":-122.33,"name":"Seattle"}
        {"Dew Point":293.4599853515625,"Temperature":299.40000000000003,"Wind Speed":3.2,"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T03:00:00Z","lat":29.75,"lon":-95.36,"name":"Houston"}
        {"Dew Point":282.6599853515625,"Temperature":292.6,"Wind Speed":2.4000000000000004,"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T03:00:00Z","lat":40.75,"lon":-73.98,"name":"NYC"}
        {"Dew Point":288.25998535156253,"Temperature":293,"Wind Speed":1.6,"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T03:00:00Z","lat":47.6,"lon":-122.33,"name":"Seattle"}
    

NDJSON Response Example (JSON Array)

    [{"Dew Point":293.6,"Temperature":300.28000488281253,"Wind Speed":3.2,"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T02:00:00Z","lat":29.75,"lon":-95.36,"name":"Houston"}
    ,{"Dew Point":282.8,"Temperature":293.0800048828125,"Wind Speed":2.8000000000000003,"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T02:00:00Z","lat":40.75,"lon":-73.98,"name":"NYC"}
    ,{"Dew Point":288.40000000000003,"Temperature":293.4800048828125,"Wind Speed":1.6,"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T02:00:00Z","lat":47.6,"lon":-122.33,"name":"Seattle"}
    ,{"Dew Point":293.4499755859375,"Temperature":301.07001953125,"Wind Speed":3.6,"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T01:00:00Z","lat":29.75,"lon":-95.36,"name":"Houston"}
    ,{"Dew Point":282.6499755859375,"Temperature":293.87001953125,"Wind Speed":2.8000000000000003,"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T01:00:00Z","lat":40.75,"lon":-73.98,"name":"NYC"}
    ,{"Dew Point":288.24997558593753,"Temperature":294.27001953125,"Wind Speed":1.6,"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T01:00:00Z","lat":47.6,"lon":-122.33,"name":"Seattle"}
    ,{"Dew Point":293.4599853515625,"Temperature":299.40000000000003,"Wind Speed":3.2,"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T03:00:00Z","lat":29.75,"lon":-95.36,"name":"Houston"}
    ,{"Dew Point":282.6599853515625,"Temperature":292.6,"Wind Speed":2.4000000000000004,"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T03:00:00Z","lat":40.75,"lon":-73.98,"name":"NYC"}
    ,{"Dew Point":288.25998535156253,"Temperature":293,"Wind Speed":1.6,"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T03:00:00Z","lat":47.6,"lon":-122.33,"name":"Seattle"}
    ]
    

Response Fields:

Field Description
forecasted_at The time when the forecast was generated.
forecasted_time The time for which the forecast applies.
lat Latitude of the coordinate.
lon Longitude of the coordinate.
name Name provided in the request for the coord set.
temperature Alias given to this weather parameter. Defaults to [name]|[level]|[info]. One of these per selected variable.

Usage Notes

Authentication

You need to include a valid authentication token in the Authorization header. You can obtain a demo token by making a request to:

    GET https://gribstream.com/auth/demo
    

Include the token in your request headers as follows:

    Authorization: Bearer <token>
    

Example cURL Command

    curl -X POST 'https://gribstream.com/api/v2/nbm/forecasts' \
        -H "Content-Type: application/json" \
        -H "Accept-Encoding: gzip" \
        -H "Authorization: $(curl https://gribstream.com/auth/demo)" \
        -d '{
            "forecastedFrom": "2024-09-10T00:00:00Z",
            "forecastedUntil": "2024-09-10T00:00:00Z",
            "minHorizon": 1,
            "maxHorizon": 3,
            "coordinates": [
                { "lat": 40.75, "lon": -73.98, "name": "NYC" },
                { "lat": 29.75, "lon": -95.36, "name": "Houston" },
                { "lat": 47.6, "lon": -122.33, "name": "Seattle" }
            ],
            "variables": [
                { "name": "TMP", "level": "2 m above ground", "info": "", "alias": "Temperature" },
                { "name": "WIND", "level": "10 m above ground", "info": "", "alias": "Wind Speed" },
                { "name": "DPT", "level": "2 m above ground", "info": "", "alias": "Dew Point" }
            ]
        }' | gunzip
    

This command retrieves the forecast data and outputs the first 20 lines of the decompressed response.

Error Handling

If there is an error with your request, the API will return an error message with an appropriate HTTP status code.

Common Error Codes

Status Code Meaning Description
400 Bad Request Invalid request parameters. Occurs when required parameters are missing or have invalid values.
401 Unauthorized Authentication failed. Occurs when the authentication token is missing or invalid.
500 Internal Server Error Server error. Occurs when there is an error processing the request on the server.

Contact Information

If you have any questions or need assistance, please contact our support team at info@gribstream.com.