Skip to main content
Version: 5.x
Supported on
Snapchat
Spectacles
Camera Kit Android
This feature may have limited compatibility and may not perform optimally.
Camera Kit iOS
This feature may have limited compatibility and may not perform optimally.
Camera Kit Web
This feature may have limited compatibility and may not perform optimally.

AccuWeather API

Here at Snap we built a custom API that allows for developers to create with AccuWeather APIs more efficiently. Rather than communicating and developing directly with AccuWeather APIs, you will be developing with the APIs of Snap’s custom service which communicates with AccuWeather APIs. Please follow the below API documentation to build Lenses with Weather APIs.

AccuWeather API module is available in APIs category of Lens Studio Asset Library; alt text

You can find an example using the AccuWeather API here.

Endpoints

This section documents the API endpoints of the AccuWeather API for use with the Remote Service Module. This API can be used to get current weather conditions as well as forecasts.

Current Condition

Remote service module endpoint: current_condition

Parameters

NameTypeDescription
BodyJSONCoordinate object with latitude and longitude. Example: {"lat": LATITUDE, "lng": LONGITUDE}

Response

NameTypeDescription
current_conditionWeatherA weather object representing the current condition.
addressAddressA localized representation of the input coordinates.
time_zoneTimeZoneTimeZone data for the requested location. Null if the timezone cannot be found.

Hourly Forecast

Remote service module endpoint: hourly_forecast

Parameters

NameTypeDescription
BodyJSONCoordinate object with latitude and longitude. Example: {"lat": LATITUDE, "lng": LONGITUDE}

Response

NameTypeDescription
hourly_forecastWeather[]An array of 12 weather objects representing the forecast. Each entry in the array represents an hour of forecasts.
addressAddressA localized representation of the input coordinates
time_zoneTimeZoneTimeZone data for the requested location. Null if the timezone cannot be found.

Daily Forecast

Remote service module endpoint: daily_forecast

Parameters

NameTypeDescription
BodyJSONCoordinate object with latitude and longitude. Example: {"lat": LATITUDE, "lng": LONGITUDE}

Response

NameTypeDescription
daily_forecastDailyForecast[]An array of 5 daily forecast objects which contain weather forecasts for the day and night of each day.
addressAddressA localized representation of the input coordinates
time_zoneTimeZoneTimeZone data for the requested location. Null if the timezone cannot be found.

Current Condition and Forecast

Remote service module endpoint: current_condition_and_forecast

Parameters

NameTypeDescription
BodyJSONCoordinate object with latitude and longitude. Example: {"lat": LATITUDE, "lng": LONGITUDE}

Response

NameTypeDescription
current_conditionWeatherA weather object representing the current condition.
hourly_forecastWeather[]An array of 12 weather objects representing the forecast. Each entry in the array represents an hour of forecasts.
daily_forecastDailyForecast[]An array of 5 daily forecast objects which contain weather forecasts for the day and night of each day.
addressAddressA localized representation of the input coordinates.
time_zoneTimeZoneTimeZone data for the requested location. Null if the timezone cannot be found.

Air Quality API Endpoints

This section documents API endpoints for the Plume Labs by AccuWeather air quality API.

Current Conditions and Forecast Air Quality

Remote service module endpoint: current_air_quality

Parameters

NameTypeDescription
BodyJSONCoordinate object with latitude and longitude. Example: {"lat": LATITUDE, "lng": LONGITUDE}

Response

NameTypeDescription
airQualityAirQualityAir quality data for the requested location.
addressAddressA localized representation of the input coordinates.
time_zoneTimeZoneTimeZone data for the requested location. Null if the timezone cannot be found.

Types

This section documents the data types the AccuWeather API returns.

Weather (JSON)

FieldTypeDescription
conditionConditionThe weather condition.
detailed_conditionDetailedConditionThe detailed weather condition.
temperature_fnumberTemperature in Fahrenheit.
epoch_msnumberThe epoch in milliseconds of the forecast or current condition this weather object represents.
relative_humidity_percnumberRelative humidity as a percent. This will only be set for CurrentConditions. Hourly and Daily Forecasts will not set this.
pressure_mbnumberPressure in millibars. This will only be set for CurrentConditions. Hourly and Daily Forecasts will not set this.
wind_speednumberThe speed of the wind in kilometers per hour.
precipitation_probabilitynumberPrecipitation probability. Only set for Daily and Hourly Forecasts, ranging from 0 to 100.
sunrise_epoch_secnumberThe seconds since epoch of the sunrise. Only set in DailyForecast objects.
sunset_epoch_secnumberThe seconds since epoch of the sunset. Only set in DailyForecast objects.

DailyForecast (JSON)

FieldTypeDescription
dayWeatherWeather forecast during the day.
nightWeatherWeather forecast during the night.

Condition (Enum)

NameTypeDescription
UNKNOWNStringThe weather condition is unknown.
CLEAR_NIGHTStringForecast or condition includes being clear at night.
CLOUDYStringForecast or condition includes cloudy weather.
HAILStringForecast or condition includes hail.
LIGHTNINGStringForecast or condition includes lightning.
LOW_VISIBILITYStringForecast or condition includes low visibility.
PARTIAL_CLOUDYStringForecast or condition includes partial cloudiness.
PARTIAL_CLOUDY_NIGHTStringForecast or condition includes partial cloudiness at night.
RAINYStringForecast or condition includes rain.
SNOWStringForecast or condition includes snow.
SUNNYStringForecast or condition includes sun.
WINDYStringForecast or condition includes higher than usual winds.
HOTStringForecast or condition includes hotter than usual weather.
COLDStringForecast or condition includes colder than usual weather.

DetailedCondition (Enum)

NameTypeDescription
UNKNOWNStringThe weather condition is unknown.
SUNNYStringForecast or condition is sunny.
CLOUDYStringForecast or condition includes cloudy weather.
RAINYStringForecast or condition includes rain.
MOSTLY_CLOUDY_DAYStringForecast or condition is mostly cloudy.
MOSTLY_CLOUDY_NIGHTStringForecast or condition at night is mostly cloudy.
SNOWStringForecast or condition includes snow.
HOTStringForecast or condition includes hotter than usual weather.
COLDStringForecast or condition includes colder than usual weather.
WINDYStringForecast or condition includes higher than usual winds.
CLEARStringForecast or condition is clear.
MOSTLY_CLEARStringForecast or condition is mostly clear.
PARTLY_CLOUDYStringForecast or condition is partially cloudy.
INTERMITTENT_CLOUDS_DAYStringForecast or condition includes intermittent clouds during the day.
INTERMITTENT_CLOUDS_NIGHTStringForecast or condition includes intermittent clouds during the night.
MOSTLY_SUNNYStringForecast or condition is mostly sunny.
PARTLY_SUNNYStringForecast or condition is partly sunny.
RAIN_SHOWERSStringForecast or condition includes rain showers.
HAZY_SUNSHINEStringForecast or condition includes hazy sunshine.
OVERCASTStringForecast or condition includes an overcast.
FOGGYStringForecast or condition is foggy.
MOSTLY_CLOUDY_WITH_SHOWERS_DAYStringForecast or condition is mostly cloudy with showers during the day.
MOSTLY_CLOUDY_WITH_SHOWERS_NIGHTStringForecast or condition is mostly cloudy with showers during the night.
PARTLY_SUNNY_WITH_SHOWERSStringForecast or condition is partly sunny with showers.
THUNDERSTORMSStringForecast or condition includes thunderstorms.
MOSTLY_CLOUDY_WITH_T_STORMS_DAYStringForecast or condition is mostly cloudy with thunderstorms during the day.
MOSTLY_CLOUDY_WITH_T_STORMS_NIGHTStringForecast or condition is mostly cloudy with thunderstorms during the night.
PARTLY_SUNNY_WITH_T_STORMSStringForecast or condition is partly sunny with thunderstorms.
FLURRIESStringForecast or condition includes snow flurries.
MOSTLY_CLOUDY_WITH_FLURRIES_DAYStringForecast or condition is mostly cloudy with flurries during the day.
MOSTLY_CLOUDY_WITH_FLURRIES_NIGHTStringForecast or condition is mostly cloudy with flurries during the night.
PARTLY_SUNNY_WITH_FLURRIESStringForecast or condition is partly sunny with flurries.
MOSTLY_CLOUDY_WITH_SNOW_DAYStringForecast or condition is mostly cloudy with snow during the day.
MOSTLY_CLOUDY_WITH_SNOW_NIGHTStringForecast or condition is mostly cloudy with snow during the night.
HAILStringForecast or condition includes hail.
SLEETStringForecast or condition includes sleet.
FREEZING_RAININGStringForecast or condition includes freezing rain.
RAIN_AND_SNOWStringForecast or condition includes both rain and snow.
HAZY_MOONLIGHTStringForecast or condition includes hazy moonlight.
PARTLY_CLOUDY_WITH_SHOWERSStringForecast or condition is partly cloudy with rain showers.
PARTLY_CLOUDY_WITH_T_STORMSStringForecast or condition is partly cloudy with thunderstorms.

Address (JSON)

FieldTypeDescription
admin_area_1StringFirst level of administration. In the US, this is the state. This field is optional and may not always be included.
admin_area_2StringSecond level of administration. In the US, this is the county. This field is optional and may not always be included.
admin_area_3StringThird level of administration. This field is optional and may not always be included.
admin_area_4StringFourth level of administration. This field is optional and may not always be included.
admin_area_5StringFifth level of administration. This field is optional and may not always be included.
localityStringCity or town for the input latitude and longitude.
sublocalityStringLevel below locality for a smaller geographic area.
colloquial_areaStringColloquial name for the area. This field is optional and may not always be included.
neighborhoodStringName for the neighborhood.
premiseStringIncluded if a small area is named, e.g., 'Times Square'.
subpremiseStringIncluded if the latitude and longitude have a name for a single entity.
point_of_interestStringNamed point of interest such as "Empire State Building". This field is optional and may not always be included.
countryStringCountry for the input latitude and longitude.
country_codeStringCountry code for the input latitude and longitude. This field is optional and may not always be included.
postal_codeStringPostal code for the input latitude and longitude. This field is optional and may not always be included.
macro_areaStringThe continent, ocean, or marine area for the input latitude and longitude.

TimeZone (JSON)

FieldTypeDescription
idStringTimezone ID, for example: America/New_York, Asia/Hong_Kong.
offset_sNumberTime offset in seconds, for example: -18000 for America/New_York.

Air Quality (JSON)

FieldTypeDescription
epochMsStringThe current time since epoch in milliseconds.
overallIndexNumberAir quality rating on a scale set by local regulating bodies. Scales can vary widely based on location.
overallPlumeLabsIndexNumberAir quality rating on a scale set by Plume Labs.
dominantPollutantStringThe dominant air pollutant.
categoryStringOne-word description of the air quality in the requested language.
categoryColorNumberA unique color assigned to the level of air quality.
Was this page helpful?
Yes
No