❄️Forecast API

Introduction

The endpoint provides the user the ability to check the forecast of a location based on geographical coordinates.

Authentication

Authentication is achieved by passing a custom header named X-Api-Key containing the API key.

curl -X GET \
--location "https://api.nubila.ai/api/v1/forecast?lat=37.2144&lon=-121.8574" \
-H "X-Api-Key: 26...4e"

Endpoint

https://api.nubila.ai/api/v1/forecast

Parameters

Parameter
Required
Type
Description
Example

lat

Yes

number

Latitude value for the requested area

37.2144

lon

Yes

number

Longitude value for the requested area

-121.8574

Example Request

curl -X GET --location "https://api.nubila.ai/api/v1/forecast?lat=37.2144&lon=-121.8574" \
    -H "X-Api-Key: 26...4e"

Example Response (success)

{
    "data": [
        {
            "id": "0",
            "created_at": "0001-01-01T00:00:00Z",
            "updated_at": "0001-01-01T00:00:00Z",
            "latitude": 37.2144,
            "longitude": -121.8574,
            "temperature": 11.54,
            "temperature_min": 11.2,
            "temperature_max": 11.54,
            "feels_like": 10.55,
            "pressure": 1011,
            "humidity": 69,
            "wind_speed": 2.22,
            "wind_direction": 0,
            "condition": "Clouds",
            "condition_desc": "broken clouds",
            "condition_code": 803,
            "condition_icon": "04d",
            "uv": 0,
            "luminance": 0,
            "sea_level": 1011,
            "rain": 0,
            "wet_bulb": 0,
            "timestamp": 1739394000,
            "timezone": -28800,
            "location_name": "Cambrian Park, US",
            "source": "o",
            "tag": ""
        },
        {
            "id": "0",
            "created_at": "0001-01-01T00:00:00Z",
            "updated_at": "0001-01-01T00:00:00Z",
            "latitude": 37.2144,
            "longitude": -121.8574,
            "temperature": 11.24,
            "temperature_min": 10.65,
            "temperature_max": 11.24,
            "feels_like": 10.3,
            "pressure": 1011,
            "humidity": 72,
            "wind_speed": 2.24,
            "wind_direction": 0,
            "condition": "Clouds",
            "condition_desc": "broken clouds",
            "condition_code": 803,
            "condition_icon": "04d",
            "uv": 0,
            "luminance": 0,
            "sea_level": 1011,
            "rain": 0,
            "wet_bulb": 0,
            "timestamp": 1739404800,
            "timezone": -28800,
            "location_name": "Cambrian Park, US",
            "tag": ""
        }
    ],
    "ok": true
}

Example response (error)

{
    "ok": false,
    "message": "Invalid longitude",
    "error_code": 40000
}

Response Fields description

Root Fields

  • ok (boolean): Indicates whether the request was successful.

  • message (string): In case of unsuccessful request, a message explaining why the request failed

  • error_code (number): System error code representing the error

  • data (array): Contains an array of objects, representing forecast for a given timestamp, at hourly intervals

data objects’ fields

Metadata

  • id (string): Unique identifier for the weather data record.

  • created_at (string, ISO 8601): Timestamp when the record was created.

  • updated_at (string, ISO 8601): Timestamp when the record was last updated.

  • tag (string): Custom tag (if applicable).

Location Information

  • latitude (number): Latitude of the location.

  • longitude (number): Longitude of the location.

  • location_name (string): Name of the location.

  • sea_level (number): Elevation of the location in meters.

Weather Conditions

  • temperature (number): Current temperature in degrees Celsius.

  • temperature_min (number): Minimum recorded temperature in degrees Celsius.

  • temperature_max (number): Maximum recorded temperature in degrees Celsius.

  • feels_like (number): Perceived temperature in degrees Celsius (considering wind and humidity).

  • pressure (number): Atmospheric pressure in hPa (hectopascals).

  • humidity (number): Humidity percentage.

  • uv (number): Ultraviolet (UV) index.

  • luminance (number): Luminance level (exact unit depends on the source).

  • rain (number): Precipitation level in millimeters.

  • wet_bulb (number): Wet-bulb temperature in degrees Celsius (a measure of temperature considering humidity).

Wind Data

  • wind_speed (number): Wind speed in meters per second.

  • wind_direction (number): Wind direction in degrees (0-360, where 0 represents north).

Weather Condition Details

  • condition (string): General weather condition (e.g., “Clouds”, “Rain”).

  • condition_desc (string): Detailed weather description (e.g., “overcast clouds”).

  • condition_code (number): Numeric code representing the weather condition.

  • condition_icon (string): Icon identifier for the weather condition.

Time & Source Information

  • timestamp (number): Unix timestamp (seconds since epoch) representing the time for which the weather is predicted.

  • timezone (number): Timezone offset in seconds from UTC.

Last updated