citystring必填
City URL slug (e.g. 'new-york-city', 'beijing', 'santiago'). Obtainable from the url field of get_live_city_ranking or get_world_air_quality results.
https://api.sandbase.ai/v1/api/iqair/city-air-qualityFull air quality details for a specific city including current conditions, pollutant breakdown with concentrations, hourly and daily forecasts, weather data, pollen indices, and health recommendations. City, state,.
您的輸出會顯示在這裡
完成輸入後,點擊執行。
Returns air quality details for one city: current AQI, pollutant concentrations, hourly and daily forecasts, pollen levels, and health recommendations. It needs the city, state and country URL slugs, such as new-york-city, new-york and usa.
curl -X POST "https://api.sandbase.ai/v1/api/iqair/city-air-quality" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"city": "new-york-city", "country": "usa", "state": "new-york"}'
The result is returned in outputs[0].data.
| Name | Type | Required | Description |
|---|---|---|---|
city | string | Yes | City URL slug (e.g. 'new-york-city', 'beijing', 'santiago'). Obtainable from the url field of get_live_city_ranking or get_world_air_quality results. |
country | string | Yes | Country URL slug (e.g. 'usa', 'china', 'chile'). |
state | string | Yes | State/region URL slug (e.g. 'new-york', 'beijing', 'santiago-metropolitan'). |
Real response for the request above, trimmed: lists keep their first item and long strings are cut.
{
"data": {
"details": {
"activeStationsCount": 67,
"analysis": "<script type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"FAQ…",
"anonymousContributorsCount": 47,
"breadcrumbs": [
{
"label": "USA",
"url": "/usa"
}
],
"coordinates": {
"latitude": 40.6627117,
"longitude": -73.9386769
},
"country": "USA",
"countryID": "7KEznm2wS6Zk3chh2",
"current": {
"WHOExposure": {
"WHOExposure": 1.3,
"WHOExposureColor": "red"
},
"aqi": 35,
"aqiDescription": "Air quality index",
"concentration": 6.4,
"condition": "Clear sky",
"estimated": false,
"humidity": 83,
"icon": "01n"
},
"featuredStation": {
"aqi": 39,
"contributorProfile": {
"name": "HeWhoIsBecomingWhoHeIs",
"pictureURL": "https://lh3.googleusercontent.com/a/AAcHTtd--bVO6WCoAzFAnzh_-M_aZVyoF6FgkPYOcBkl…",
"url": "profile/-1-jlihbc"
},
"flagURL": "https://cdn.airvisual.net/flags/usa.jpg",
"gallery": {
"pictures": [
"https://cdn.airvisual.net/assets/stations/c1f7f6b1-2336-41a0-bf1b-a19ce2bb284f.c…"
]
},
"id": "68947965c212f4cae27ec7da",
"name": "South Slope",
"url": "/usa/new-york/new-york/south-slope"
},
"followers": {
"count": 2559921,
"pictures": [
"https://cdn.airvisual.net/tiny/default.png"
]
},
"forecasts": {
"daily": [
{
"aqi": 42,
"condition": "Clear sky",
"humidity": 75,
"icon": "01d",
"pollen": {
"globalIndexLevel": 1,
"pollens": [
{
"level": 0,
"type": "grass"
}
]
},
"pressure": 1025,
"temperature": {
"max": 19,
"min": 10
},
"ts": "2026-11-03T08:00:00.000Z"
}
],
"hourly": [
{
"aqi": 35,
"condition": "Clear sky",
"humidity": 83,
"icon": "01n",
"pressure": 1026,
"temperature": 11,
"ts": "2026-11-03T07:00:00.000Z",
"wind": {
"direction": 231,
"speed": 8
}
}
]
},
"hasLowCostSensor": true
},
"pollutants": [
{
"aqi": 35,
"concentration": 6.4,
"description": "Fine particles (≤ 2.5 µm)",
"pollutantName": "pm25",
"unit": "µg/m³"
}
],
"recommendations": {
"pollution": {
"airPurifier": {
"value": "hidden"
},
"exercise": {
"text": "Enjoy outdoor activities",
"value": "green"
},
"mask": {
"value": "hidden"
},
"windows": {
"product": {
"name": "AirVisual Series",
"text": "Get a monitor",
"url": "/commercial-air-quality-monitors"
},
"text": "Open your windows to bring clean, fresh air indoors",
"value": "green"
}
}
}
},
"status": "success"
}
| Field | Meaning |
|---|---|
data.details.current.aqi | Current air quality index for the city. aqiDescription names the index. |
data.details.current.concentration | Current pollutant concentration behind the AQI value. The pollutants list gives the unit. |
data.details.current.condition / humidity | Current weather condition text and humidity value. |
data.pollutants[].pollutantName / description | Short code and plain name of each measured pollutant, such as pm25 for fine particles. |
data.pollutants[].aqi / concentration / unit | AQI for that pollutant, its measured concentration, and the unit of the concentration. |
data.details.forecasts.daily[].aqi / temperature.max / temperature.min | Forecast AQI and the high and low temperature for each day. ts gives the date and time. |
data.details.forecasts.daily[].pollen.pollens[] | Pollen level for each type (grass, weed, tree). globalIndexLevel gives an overall pollen level. |
data.details.forecasts.hourly[].aqi / temperature / wind.speed / wind.direction | Hourly forecast for AQI, temperature and wind. ts gives the hour. |
data.recommendations.pollution | Advice for exercise, windows, mask and airPurifier. Each has a value such as green or hidden, and some have a text. |
data.details.coordinates / timezone / activeStationsCount | Latitude and longitude of the city, its time zone name, and the number of active monitoring stations. |
city, state and country slugs from the url of a result in IQAir Live City Ranking or IQAir World Air Quality.ts use ISO 8601 UTC format, for example 2026-11-03T08:00:00.000Z.data.details.recommendations is repeated in data.recommendations, so you can read either one.url values and breadcrumb url values are relative paths, such as /usa/new-york/new-york.$0.01 per successful call. Failed calls are not charged. It is included in the daily free quota of each organization.
開始建置
具備統一驗證與用量追蹤的平台 API 端點。
curl -X POST "https://api.sandbase.ai/v1/api/iqair/city-air-quality" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"city": "new-york-city",
"state": "new-york",
"country": "usa"
}'請將您的 SandBase API 金鑰設定在伺服器環境中。請求使用 Bearer 驗證。
export SANDBASE_API_KEY="YOUR_API_KEY"請將金鑰保留在伺服器端,不要在瀏覽器程式碼中公開。
citystring必填City URL slug (e.g. 'new-york-city', 'beijing', 'santiago'). Obtainable from the url field of get_live_city_ranking or get_world_air_quality results.
statestring必填State/region URL slug (e.g. 'new-york', 'beijing', 'santiago-metropolitan').
countrystring必填Country URL slug (e.g. 'usa', 'china', 'chile').
這是此 API 的已儲存範例回應;檢視時不會發出即時請求。
尚未發布已儲存回應。請在 Playground 中執行 API 以檢視其回應。
探索更多
| API | 價格 | 回應 |
|---|---|---|
IQAir | 每次呼叫 $0.01 | 非同步 JSON |
IQAir | 每次呼叫 $0.01 | 非同步 JSON |
IQAir | 每次呼叫 $0.01 | 非同步 JSON |
IQAir | 每次呼叫 $0.01 | 非同步 JSON |
問題
使用 POST 請求將您的 SandBase API 金鑰放在 Authorization 標頭(Bearer)中,並以 JSON 主體傳入參數,即可呼叫 https://api.sandbase.ai/v1/api/iqair/city-air-quality。您也可以直接在本頁的 Playground 試用,不必撰寫程式碼。
每次 $0.01,並從您的 SandBase 餘額中扣款。您只會為實際發出的呼叫付費;沒有訂閱方案。
必要:city (string), state (string) 和 country (string)。 本頁的 Parameters 表格與 Playground 會列出每個欄位。
JSON 結果。此端點為非同步執行,因此回應會告訴您如何取得完成的結果。 本頁的 README 包含範例回應。
不需要。IQAir City Air Quality 是透過 SandBase 運作,因此一組 SandBase API 金鑰即可使用此端點以及目錄中的其他所有 API 和模型。您不需要另外申請 IQAir API 存取權。