🌧️Weather API

Introduction

The endpoint provides the user the ability to check the current weather 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/weather?lat=37.2144&lon=-121.8574" \
-H "X-Api-Key: 13...5c"

Endpoint

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

Parameters

Parameter
Required
Description
Example

lat

Yes

Latitude value for the requested area

37.2144

lon

Yes

Longitude value for the requested area

-121.8574

Example Request

curl -X GET --location "https://api.nubila.ai/api/v1/weather?lat=37.2144&lon=-121.8574" \
    -H "X-Api-Key: 13...5c"

Example Response (success)

{
    "id": "0",
    "created_at": "0001-01-01T00:00:00Z",
    "updated_at": "0001-01-01T00:00:00Z",
    "latitude": 37.2144,
    "longitude": -121.8574,
    "temperature": 9.7,
    "temperature_min": 8.16,
    "temperature_max": 10.66,
    "feels_like": 7.36,
    "pressure": 1016,
    "humidity": 61,
    "wind_speed": 4.63,
    "wind_scale": 0,
    "wind_speed_list": null,
    "wind_scale_list": null,
    "wind_direction": 0,
    "condition": "Clouds",
    "condition_desc": "overcast clouds",
    "condition_code": 804,
    "condition_icon": "04n",
    "uv": 0,
    "luminance": 0,
    "elevation": 1016,
    "rain": 0,
    "wet_bulb": 0,
    "timestamp": 1739325314,
    "timezone": -28800,
    "location_name": "Cambrian Park",
    "address": "",
    "tag": "",
    "is_online": false,
    "is_malfunction": false
}

Example response (error)

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

Response Fields description

Root Fields

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

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

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

  • data (object): Contains the weather information object

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.

Location Information

  • latitude (number): Latitude of the location.

  • longitude (number): Longitude of the location.

  • location_name (string): Name of the location.

  • address (string): Address of the location (if available).

  • elevation (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_scale (number): Wind scale (e.g., Beaufort scale).

  • wind_speed_list (array|null): List of wind speed values over time (if available).

  • wind_scale_list (array|null): List of wind scale values over time (if available).

  • 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 data retrieval time.

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

System Status

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

  • is_online (boolean): Indicates whether the weather station or source is online.

  • is_malfunction (boolean): Indicates whether there is a malfunction in the data source.

Last updated