Unofficial documentation of the private HTTP API behind the OPPO/OnePlus/realme
Weather app ("weatherservicesdk" protocol). Reverse-engineered from Weather
16.45.2 (net.oneplus.weather, international build) and verified against the
live server with hand-crafted requests. Everything needed to build a working
client is contained in this document.
Upstream data provider: The Weather Company / weather.com (see Data provider).
| Item | Value |
|---|---|
| Base URL | https://weather-server.allawnos.com |
| Regional variants | weather-server-eu, weather-api-sg (same protocol) |
| Method | POST (all endpoints) |
| Request body | JSON, Content-Type: application/json; charset=utf-8 |
| Response body | gzip-compressed JSON, Content-Type: application/x-gzip;charset=UTF-8 |
The response is always gzip-compressed, regardless of Accept-Encoding.
Clients should detect the gzip magic bytes 1f 8b and decompress before
parsing. HTTP status is 200 for successful calls; errors are reported in-band
(see Error codes).
No API key or secret. Every request carries two query parameters:
?appId=app-weather&authCode=<hex>
authCode is a SHA-256 chain over well-known constants plus the request path
and the current time:
pkgName = "com.coloros.weather2"
appId = "app-weather"
timeStamp = current epoch seconds, as a decimal string
inner = SHA256( pkgName ) (hex string)
authCode = SHA256( timeStamp + appId + path + inner ) (hex string)
path is the URL path of the endpoint, exactly as sent (e.g.
/weather/data/gzipJson/sdk/v2), with no query string.
For timeStamp = 1788150208 and path = /weather/citySearch/v2/sdk:
SHA256("com.coloros.weather2") = 3c0ea504ac6e3733d9ba3ad0f86c9376899a0e653fb601c85467649cb415d623
SHA256("1788150208" + "app-weather"
+ "/weather/citySearch/v2/sdk"
+ "3c0ea504...156d23") = e9864320f40b60200ad2ebde5c07bc38de3433ef1c8f747d5785d29fbaafbf24
Full URL:
https://weather-server.allawnos.com/weather/citySearch/v2/sdk?appId=app-weather&authCode=e9864320f40b60200ad2ebde5c07bc38de3433ef1c8f747d5785d29fbaafbf24
The same timeStamp value is also sent as a header and is the only time-varying
input, so the value used in the URL, the header, and the hash must match.
| Header | Example value | Notes |
|---|---|---|
pkgName |
com.coloros.weather2 |
Signing identity; must match the hash input |
timeStamp |
1788150208 |
Epoch seconds, same value used in authCode |
versionCode |
16045002 |
App version code |
versionName |
16.45.2 |
App version name |
serviceVersionCode |
16045002 |
SDK/service version code |
serviceVersionName |
16.45.2 |
SDK/service version name |
model |
CPH2747 |
Device model |
osVersion |
V16.1.0 |
ColorOS/OxygenOS version |
encryptFlag |
2 |
Must be present |
authType |
2 |
Must be present |
Content-Type |
application/json; charset=utf-8 |
Omitting encryptFlag/authType (or sending stale/expired timeStamp) gets
HTTP 401 with an empty body. The version/model/os values shown above were
accepted verbatim from the app; the server does not appear to validate them
against reality, only presence.
| Path | Purpose | Status |
|---|---|---|
/weather/citySearch/v2/sdk |
City search / geocoding | verified |
/weather/data/gzipJson/sdk/v2 |
Weather data, v2 protocol | verified |
/weather/data/gzipJson/sdk |
Weather data, v1 protocol | present in client |
/weather/radarChart/v2 |
Rainfall radar chart | present in client |
/weather/app/config |
App configuration | present in client |
/weather/version/get/v0/sdk |
Server-side version check | present in client |
/hotcity/v0/sdk |
Popular cities list | present in client |
/weather/observe/data |
Lite observed data | present in client |
/weather/lightData |
Lightweight weather data | present in client |
/weather/data/preview/search-preview/v1 |
Search-result preview data | present in client |
/weather/feedback/accuracy/v1 |
"Is this accurate" feedback | present in client |
/weather/location/for-app/sdk |
Reverse geocoding | ECIES-protected, see below |
/weather/location/for-service/sdk |
Reverse geocoding (service) | ECIES-protected, see below |
/weather/ad/indexAdData |
Ad data | ECIES-protected, see below |
The ECIES-protected paths are negotiated by the native com.allawn.cryptography
SDK (encryptFlag: 3), which additionally exchanges deviceId, cipherInfo,
and wrapperKey headers. They are not needed for the data endpoints documented
here, which work with plain encryptFlag: 2 / authType: 2.
Geocoding: converts a free-text query into city records with server-assigned location keys.
{
"word": "London",
"language": "en-US",
"supportServerHighlight": true
}JSON array (empty if no match). Fields:
| Field | Type | Description |
|---|---|---|
locationKey |
string | Stable city ID; use in weather-data requests |
countryID |
string | ISO 3166-1 alpha-2 country code |
cityName |
string | Localized city name |
secondaryName |
string | Localized parent (state/province) |
tertiaryName |
string | Localized country-level name |
countryName |
string | Localized country name |
regionName |
string | Localized continent/region |
standardDisplayName |
string | Full display name, comma-joined |
highlightDisplayName |
string | Same, with the match wrapped in <span style='color:#0080FF;'>…</span> |
language |
string | Language actually used by the server (lowercase, e.g. en-us) |
lat, lon |
string | Decimal coordinates |
timezone |
string | IANA time zone |
{
"locationKey": "00515141000107",
"countryID": "GB",
"cityName": "London",
"tertiaryName": "London",
"countryName": "United Kingdom",
"regionName": "Europe",
"standardDisplayName": "London, England, United Kingdom",
"highlightDisplayName": "<span style='color:#0080FF;'>London</span>, England, United Kingdom",
"language": "en-us",
"lat": "51.5074",
"lon": "-0.1278",
"timezone": "Europe/London"
}The main data endpoint. One request returns all forecast types for one or more cities.
{
"cityId": "00515141000107",
"geoHash": {"00515141000107": "gcpvj0"},
"lastRspDataTypeMd5Map": {},
"dataType": {"00515141000107": "120,130,140,160"},
"operationCardVer": "1.2",
"returnCity": true,
"language": "en-US",
"unit": "c",
"protocal": "v1"
}| Field | Type | Description |
|---|---|---|
cityId |
string | Location key(s), comma-joined for multiple cities |
geoHash |
object | Map cityId → geohash of the city (any valid geohash of the point; the server does not validate it) |
dataType |
object | Map cityId → comma-joined dataType codes (table below) |
lastRspDataTypeMd5Map |
object | Cache-dedup echo, see Caching |
operationCardVer |
string | Operation-card version, 1.2 |
returnCity |
bool | Include city info in response |
language |
string | BCP-47, e.g. en-US |
unit |
string | c or f |
protocal |
string | v1 (sic — misspelled in the protocol) |
The v1 endpoint (/weather/data/gzipJson/sdk) uses locationKey instead of
cityId; request/response shapes are otherwise the same.
| Code | Key | Content |
|---|---|---|
| 110 | mint |
Minutely rain nowcast |
| 111 | tips |
Weather tips |
| 112 | alert |
Weather alerts/warnings |
| 120 | obw |
Observed weather (current conditions) |
| 130 | hfw |
Hourly forecast |
| 140 | dfw |
Daily forecast |
| 150 | ti |
Life index |
| 160 | aq |
Air quality |
| 190 | — | Typhoon |
| 997 | opcard |
Operation cards |
| 999 | cctvInfo |
Video content |
{
"data": [
{
"locationId": "00515141000107",
"weatherData": {
"weatherDataProvider": 1,
"errorCode": 202,
"errorMessage": "…",
"obw": {"data": {…}, "errorCode": 200, "errorMessage": "…", "md5": "…"},
"hfw": {"data": {…}, "errorCode": 200, "errorMessage": "…", "md5": "…"},
"dfw": {"data": {…}, "errorCode": 200, "errorMessage": "…", "md5": "…"},
"aq": {"data": {…}, "errorCode": 200, "errorMessage": "…", "md5": "…"},
"alert": {"errorCode": 405, "errorMessage": "…"},
"mint": {"errorCode": 405, "errorMessage": "…"},
"ti": {"errorCode": 405, "errorMessage": "…"},
"tips": {"errorCode": 404, "errorMessage": "…"}
}
}
]
}weatherData contains one entry per requested dataType (keyed as in the
table above). Each entry is {data, errorCode, errorMessage, md5}; data is
omitted when errorCode != 200. weatherDataProvider (int) identifies which
upstream served the response — 1 = The Weather Company.
Note the nesting: per-type errorCode 200 does not mean the whole response
succeeded; the outer weatherData.errorCode is 202 when any requested type
failed (see Error codes).
{
"forecastTimeSeconds": 1788150208,
"expireTime": 1788154236000,
"sign": "78a44895bfe160f30408893e3887be6c",
"temp": 16.0,
"weatherCode": 58,
"windDegree": 240,
"windSpeed": 14,
"windPower": 3,
"windGustLevel": 0,
"humidity": 81,
"uvIndex": 0,
"bodyTemp": 15.0,
"pressure": 1005.76,
"visibility": 16090,
"adLink": "https://weather.com//en-us/weather/today/l/<hash>?par=oppo_widget&temp=c&datasource=1",
"weatherAdLink": "https://… (same as adLink)",
"todayDate": 1788150208,
"realRefreshAt": 1788150208,
"spatialType": 0
}| Field | Unit | Description |
|---|---|---|
temp, bodyTemp |
°C or °F per unit |
Current / feels-like temperature |
weatherCode |
— | Condition code, see Weather codes |
windDegree |
degrees | Direction, meteorological (240 = WSW) |
windSpeed |
km/h | Sustained wind speed |
windPower |
Beaufort scale | 0–12 |
windGustLevel |
Beaufort scale | Gust strength |
humidity |
% | Relative humidity |
uvIndex |
UV index | 0–11+ |
pressure |
hPa | Station pressure |
visibility |
meters | |
adLink/weatherAdLink |
URL | Attribution link to weather.com |
forecastTimeSeconds, todayDate, realRefreshAt |
epoch seconds | Observation time |
expireTime |
epoch milliseconds | When this value should be refetched |
sign |
string | Server-side content signature |
spatialType |
int | Location granularity flag |
data = {forecastTimeSeconds, expireTime, sign, data: [entry, …], hourlyAdLink}. Entries:
| Field | Unit | Description |
|---|---|---|
hourth |
hour-of-day | Local hour label (0–23) |
time |
epoch seconds | Validity time |
weatherCode |
— | Condition code |
temp |
°C/°F per unit |
Forecast temperature |
rainProbability, precipitationProbability |
% | Both present, same value |
rainPrecipitation |
mm | Expected amount |
windDegrees, windSpeed, windPower |
as above | |
humidity, relativeHumidity |
% | Both present, same value |
bodyTemp |
°C/°F | Feels-like |
uvIndex |
UV index |
Example entry:
{
"hourth": 5,
"time": 1788152400,
"weatherCode": 58,
"temp": 16.0,
"rainProbability": 5,
"rainPrecipitation": 0.0,
"windDegrees": 243,
"windSpeed": 14,
"windPower": 3,
"relativeHumidity": 81,
"humidity": 81,
"uvIndex": 0,
"precipitationProbability": 5
}data = {forecastTimeSeconds, expireTime, sign, data: [entry, …], dailyAdLink, dailyDetailsAdLink, sourceAdLink, bottomUrl}. Entries:
| Field | Unit | Description |
|---|---|---|
time |
epoch milliseconds | Local midnight of the forecast day |
dayCode, nightCode |
— | Daytime / nighttime condition codes |
tempMin, tempMax |
°C/°F per unit |
|
dayWindDegree, nightWindDegree |
degrees | Wind direction |
dayWindSpeed, nightWindSpeed |
km/h | |
dayWindPower, nightWindPower |
Beaufort | |
sunriseTime, sunsetTime |
epoch milliseconds | May be absent (polar day/night) |
moonriseTime, moonsetTime |
epoch milliseconds | May be absent |
moonPhase |
string | Localized phase name |
moonPhaseCode |
string | NM, WNC (waning crescent), LQ (last quarter), WNG (waning gibbous), FQ, WXG, FXG |
precipitationProbability |
% | |
uvIndex |
UV index | |
pollenIndex |
int | 0 when unavailable |
humidity |
% |
Example entry:
{
"time": 1788156000000,
"dayCode": 58,
"nightCode": 58,
"tempMin": 12.0,
"tempMax": 22.0,
"dayWindDegree": 267,
"nightWindDegree": 268,
"dayWindSpeed": 22,
"dayWindPower": 4,
"nightWindSpeed": 20,
"nightWindPower": 4,
"sunriseTime": 1788153083000,
"sunsetTime": 1788202132000,
"moonriseTime": 1788204803000,
"moonsetTime": 1788167439000,
"moonPhase": "亏凸月",
"moonPhaseCode": "WNG",
"precipitationProbability": 18,
"uvIndex": 5,
"pollenIndex": 0,
"humidity": 68
}(Localized text such as moonPhase is returned in the request language when
available; untranslated values may fall back to Chinese.)
{
"forecastTimeSeconds": 1788149875,
"expireTime": 1788157075000,
"sign": "65166d677d627f0285b256c7728fdf54",
"index": 26,
"pm25": 1,
"pm10": 1,
"o3": 48,
"co": 130,
"no": 0,
"no2": 1,
"so": 1,
"lead": 0,
"category": "Good",
"description": "Air quality is considered satisfactory, and air pollution poses little or no risk.",
"adLink": "https://weather.com//en-us/forecast/air-quality/l/<hash>?par=oppo_widget&datasource=1"
}| Field | Unit |
|---|---|
index |
AQI |
pm25, pm10, lead |
µg/m³ |
o3 |
ppb |
co |
ppb |
no, no2, so |
ppb |
category |
English AQI band (e.g. "Good") |
description |
Localized explanatory sentence |
On the international stack these data types are rejected with 405 — the
upstream provider serving weatherDataProvider: 1 does not supply them. They
are served on other regional stacks (notably the China-market build).
Codes appear in weatherData.errorCode (outer) and in each per-type entry.
| Code | Level | Meaning | Client action |
|---|---|---|---|
| 200 | both | Success | — |
| 202 | outer | Partial failure — at least one requested dataType failed | Retry failed types |
| 404 | type | Server-side cache miss | Retry |
| 405 | type | dataType not supported by current provider | Do not retry |
| 500 | type/server | Server error, e.g. invalid cityId | Do not retry |
errorMessage is server-generated Chinese text (e.g. 成功, 有失败项,需要重试);
do not rely on it for logic — use the numeric code.
Each per-type payload carries an md5 field (content hash, e.g. equal to the
sign field inside obw data). The client can echo these back:
"lastRspDataTypeMd5Map": {
"00515141000107": {"obw": "78a44895bfe160f30408893e3887be6c", "dfw": "70ab…"}
}If nothing changed the server returns an error 404-style cache indicator or an
unchanged payload; sending an empty map (or a per-city empty object) always
forces full data. Values also carry expireTime (epoch milliseconds) after
which the client should refetch regardless of md5.
cityId, geoHash, dataType, and lastRspDataTypeMd5Map are all maps keyed
by location key; for multiple cities, join the keys with commas in cityId and
repeat them as map keys:
{
"cityId": "00515141000107,00515141000108",
"geoHash": {"00515141000107": "gcpvj0", "00515141000108": "gcpvj1"},
"dataType": {"00515141000107": "120,130", "00515141000108": "120,130"},
"lastRspDataTypeMd5Map": {},
"operationCardVer": "1.2",
"returnCity": true,
"language": "en-US",
"unit": "c",
"protocal": "v1"
}The response data array then contains one element per city.
weatherCode / dayCode / nightCode are opaque provider condition codes
from the upstream (The Weather Company). No complete code table was found in
the app; codes are mapped to icons/labels by provider-specific client logic.
Values directly observed during live testing: 2 (partly cloudy), 55 (drizzle), 57 (freezing drizzle / light rain), 58 (rain), 59 (light rain). The app's UI category set (sunny, cloudy, overcast, rain, snow, sleet, fog, haze/smog, sand/dust, hail, thunderstorm, wind) suggests a granular numeric scheme, likely TWC/WMO-style. If you build a renderer, map codes defensively to a small category set rather than hard-coding strings per code.
Every response carries weatherDataProvider: 1, and all attribution links
(adLink, hourlyAdLink, dailyAdLink, source logo bottomUrl) point at
weather.com with par=oppo_widget&datasource=1. This identifies the upstream
as The Weather Company. The backend is a multi-provider aggregation layer;
the China-market build uses different providers (and requires device
attestation for location requests), so behavior of code tables and supported
data types may differ there.
Self-contained Python 3 (standard library only):
#!/usr/bin/env python3
"""Minimal client for the OPPO Weather backend (weatherservicesdk protocol)."""
import gzip, hashlib, json, sys, time, urllib.request
HOST, APP_ID, PKG = "https://weather-server.allawnos.com", "app-weather", "com.coloros.weather2"
sha = lambda s: hashlib.sha256(s.encode()).hexdigest()
def call(path, body):
ts = str(int(time.time()))
url = f"{HOST}{path}?appId={APP_ID}&authCode={sha(ts + APP_ID + path + sha(PKG))}"
req = urllib.request.Request(url, data=json.dumps(body).encode(), method="POST")
for k, v in {
"pkgName": PKG, "model": "CPH2747", "osVersion": "V16.1.0",
"versionCode": "16045002", "versionName": "16.45.2",
"serviceVersionCode": "16045002", "serviceVersionName": "16.45.2",
"timeStamp": ts, "encryptFlag": "2", "authType": "2",
"Content-Type": "application/json; charset=utf-8",
}.items():
req.add_header(k, v)
with urllib.request.urlopen(req, timeout=20) as r:
b = r.read()
return json.loads(gzip.decompress(b) if b[:2] == b"\x1f\x8b" else b)
def search(word, language="en-US"):
return call("/weather/citySearch/v2/sdk",
{"word": word, "language": language, "supportServerHighlight": True})
def weather(location_key, language="en-US", unit="c"):
return call("/weather/data/gzipJson/sdk/v2", {
"cityId": location_key,
"geoHash": {location_key: "u10"},
"lastRspDataTypeMd5Map": {},
"dataType": {location_key: "120,130,140,160"},
"operationCardVer": "1.2", "returnCity": True,
"language": language, "unit": unit, "protocal": "v1",
})
if __name__ == "__main__":
if sys.argv[1] == "search":
for c in search(sys.argv[2] if len(sys.argv) > 2 else "London"):
print(c["locationKey"], c["standardDisplayName"])
elif sys.argv[1] == "weather":
wd = weather(sys.argv[2])["data"][0]["weatherData"]
obw = wd.get("obw", {}).get("data", {})
print(obw.get("temp"), "°, code", obw.get("weatherCode"),
", humidity", obw.get("humidity"))Usage (with the listing above saved as weather.py):
$ python3 weather.py search London
00515141000107 London, England, United Kingdom
$ python3 weather.py weather 00515141000107
16.0 °, code 58 , humidity 81
- This is an undocumented private API; the server may change or restrict it at any time.
- Rate limits were not probed; the real app polls sparingly.
weatherCodesemantics and unit guarantees (wind speed, pressure) are inferred from observed values and app behavior, not from server documentation.- The China-market stack (
isChinaRegion=true) has additional requirements (device attestation certificates for location) and different providers.