# API data varies from Local Data

**URL:** <https://community.purpleair.com/t/api-data-varies-from-local-data/11930>\
**Category:** API\
**Created:** [March 14, 2025, 10:00am UTC](https://community.purpleair.com/t/api-data-varies-from-local-data/11930 "2025-03-14T10:00:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Douglas\_Sirkka](https://sea2.discourse-cdn.com/flex020/user_avatar/community.purpleair.com/douglas_sirkka/32/6493_2.png) [@Douglas\_Sirkka](https://community.purpleair.com/u/Douglas_Sirkka)\
**Post date:** [March 14, 2025, 10:00am UTC](https://community.purpleair.com/t/api-data-varies-from-local-data/11930/1 "2025-03-14T10:00:38Z")

</div>

Hi,  
I am quite new to accessing this API. When get the json from my sensor locally, I see what I see on the Purple Air Real Time Map - An AQI of 93.  
When I access the data from the API, I see it as much lower - 32.6.  
I don’t think I am accessing the wrong sensor via the API. The name is correct.  
Any suggestions?  
My data is below.  
Thanks,  
Doug  
Local json data:  
{  
“SensorId”: “xxx”,  
“DateTime”: “2025/03/14T09:42:42z”,  
“Geo”: “xxx”,  
“Mem”: 9568,  
“memfrag”: 26,  
“memfb”: 6920,  
“memcs”: 448,  
“Id”: 111,  
“lat”: 27.6938,  
“lon”: 85.294403,  
“Adc”: 0.02,  
“loggingrate”: 15,  
“place”: “outside”,  
“version”: “7.04”,  
“uptime”: 6462,  
“rssi”: -53,  
“period”: 120,  
“httpsuccess”: 108,  
“httpsends”: 108,  
“hardwareversion”: “3.0”,  
“hardwarediscovered”: “3.0+OPENLOG+NO-DISK+RV3028+BME68X+KX122+PMSX003-A+PMSX003-B”,  
“current\_temp\_f”: 106,  
“current\_humidity”: 9,  
“current\_dewpoint\_f”: 37,  
“pressure”: 866.79,  
“current\_temp\_f\_680”: 106,  
“current\_humidity\_680”: 9,  
“current\_dewpoint\_f\_680”: 37,  
“pressure\_680”: 866.79,  
“gas\_680”: 63.18,  
“p25aqic\_b”: “rgb(255,148,0)”,  
“pm2.5\_aqi\_b”: 97,  
“pm1\_0\_cf\_1\_b”: 28.11,  
“p\_0\_3\_um\_b”: 4859.39,  
“pm2\_5\_cf\_1\_b”: 37.09,  
“p\_0\_5\_um\_b”: 1410.06,  
“pm10\_0\_cf\_1\_b”: 42.59,  
“p\_1\_0\_um\_b”: 227.41,  
“pm1\_0\_atm\_b”: 23.69,  
“p\_2\_5\_um\_b”: 18.35,  
“pm2\_5\_atm\_b”: 33.59,  
“p\_5\_0\_um\_b”: 9.22,  
“pm10\_0\_atm\_b”: 41.83,  
“p\_10\_0\_um\_b”: 2.41,  
“p25aqic”: “rgb(255,173,0)”,  
“pm2.5\_aqi”: 93,  
“pm1\_0\_cf\_1”: 25.98,  
“p\_0\_3\_um”: 4561.66,  
“pm2\_5\_cf\_1”: 34.28,  
“p\_0\_5\_um”: 1340.34,  
“pm10\_0\_cf\_1”: 38.9,  
“p\_1\_0\_um”: 195.66,  
“pm1\_0\_atm”: 22.62,  
“p\_2\_5\_um”: 17.91,  
“pm2\_5\_atm”: 31.53,  
“p\_5\_0\_um”: 3.21,  
“pm10\_0\_atm”: 38.86,  
“p\_10\_0\_um”: 0.34,  
“pa\_latency”: 574,  
“response”: 201,  
“response\_date”: 1741945255,  
“latency”: 1746,  
“wlstate”: “Connected”,  
“status\_0”: 2,  
“status\_1”: 0,  
“status\_2”: 2,  
“status\_3”: 2,  
“status\_4”: 2,  
“status\_6”: 2,  
“ssid”: “xxx”  
}

API Data:  
{  
“api\_version” : “V1.0.14-0.0.58”,  
“time\_stamp” : 1741945330,  
“data\_time\_stamp” : 1741945279,  
“sensor” : {  
“sensor\_index” : 212941,  
“last\_modified” : 1741073346,  
“date\_created” : 1707263094,  
“last\_seen” : 1741945253,  
“private” : 0,  
“is\_owner” : 0,  
“name” : “Rabi Bhawan”,  
“icon” : 0,  
“location\_type” : 0,  
“model” : “PA-II-FLEX”,  
“hardware” : “3.0+OPENLOG+NO-DISK+RV3028+BME68X+KX122+PMSX003-A+PMSX003-B”,  
“led\_brightness” : 35,  
“firmware\_version” : “7.04”,  
“rssi” : -55,  
“uptime” : 105,  
“pa\_latency” : 702,  
“memory” : 5872,  
“position\_rating” : 0,  
“latitude” : 27.693815,  
“longitude” : 85.294426,  
“altitude” : 4279,  
“channel\_state” : 3,  
“channel\_flags” : 0,  
“channel\_flags\_manual” : 0,  
“channel\_flags\_auto” : 0,  
“confidence” : 100,  
“confidence\_auto” : 100,  
“confidence\_manual” : 100,  
“humidity” : 9,  
“humidity\_a” : 9,  
“humidity\_b” : 9,  
“temperature” : 105,  
“temperature\_a” : 105,  
“temperature\_b” : 105,  
“pressure” : 866.8,  
“pressure\_a” : 866.8,  
“pressure\_b” : 866.8,  
“voc” : 63.2,  
“voc\_b” : 63.18,  
“analog\_input” : 0.02,  
“pm1.0” : 23.2,  
“pm1.0\_a” : 22.6,  
“pm1.0\_b” : 23.7,  
“pm2.5” : 32.6,  
“pm2.5\_a” : 31.5,  
“pm2.5\_b” : 33.6,  
“pm2.5\_alt” : 21.5,  
“pm2.5\_alt\_a” : 20.4,  
“pm2.5\_alt\_b” : 22.7,  
“pm10.0” : 40.3,  
“pm10.0\_a” : 38.9,  
“pm10.0\_b” : 41.8,  
“scattering\_coefficient” : 70.6,  
“scattering\_coefficient\_a” : 68.4,  
“scattering\_coefficient\_b” : 72.9,  
“deciviews” : 22.5,  
“deciviews\_a” : 22.2,  
“deciviews\_b” : 22.8,  
“visual\_range” : 41.2,  
“visual\_range\_a” : 42.3,  
“visual\_range\_b” : 40.0,  
“0.3\_um\_count” : 4710,  
“0.3\_um\_count\_a” : 4561,  
“0.3\_um\_count\_b” : 4859,  
“0.5\_um\_count” : 1375,  
“0.5\_um\_count\_a” : 1340,  
“0.5\_um\_count\_b” : 1410,  
“1.0\_um\_count” : 211,  
“1.0\_um\_count\_a” : 195,  
“1.0\_um\_count\_b” : 227,  
“2.5\_um\_count” : 17,  
“2.5\_um\_count\_a” : 17,  
“2.5\_um\_count\_b” : 18,  
“5.0\_um\_count” : 6,  
“5.0\_um\_count\_a” : 3,  
“5.0\_um\_count\_b” : 9,  
“10.0\_um\_count” : 1,  
“10.0\_um\_count\_a” : 0,  
“10.0\_um\_count\_b” : 2,  
“pm1.0\_cf\_1” : 27.0,  
“pm1.0\_cf\_1\_a” : 25.98,  
“pm1.0\_cf\_1\_b” : 28.11,  
“pm1.0\_atm” : 23.2,  
“pm1.0\_atm\_a” : 22.62,  
“pm1.0\_atm\_b” : 23.69,  
“pm2.5\_atm” : 32.6,  
“pm2.5\_atm\_a” : 31.53,  
“pm2.5\_atm\_b” : 33.59,  
“pm2.5\_cf\_1” : 35.7,  
“pm2.5\_cf\_1\_a” : 34.28,  
“pm2.5\_cf\_1\_b” : 37.09,  
“pm10.0\_atm” : 40.3,  
“pm10.0\_atm\_a” : 38.86,  
“pm10.0\_atm\_b” : 41.83,  
“pm10.0\_cf\_1” : 40.7,  
“pm10.0\_cf\_1\_a” : 38.9,  
“pm10.0\_cf\_1\_b” : 42.59,  
“primary\_key\_a” : “0NXCQB3BZQHVL6R2”,  
“stats” : {“pm2.5” : 32.6, “pm2.5\_10minute” : 28.2, “pm2.5\_30minute” : 23.6, “pm2.5\_60minute” : 28.2, “pm2.5\_6hour” : 65.7, “pm2.5\_24hour” : 90.8, “pm2.5\_1week” : 45.8, “time\_stamp” : 1741945253},  
“stats\_a” : {“pm2.5” : 31.5, “pm2.5\_10minute” : 26.8, “pm2.5\_30minute” : 22.2, “pm2.5\_60minute” : 26.8, “pm2.5\_6hour” : 64.1, “pm2.5\_24hour” : 89.0, “pm2.5\_1week” : 44.8, “time\_stamp” : 1741945253},  
“stats\_b” : {“pm2.5” : 33.6, “pm2.5\_10minute” : 29.6, “pm2.5\_30minute” : 25.0, “pm2.5\_60minute” : 29.7, “pm2.5\_6hour” : 67.3, “pm2.5\_24hour” : 92.7, “pm2.5\_1week” : 46.9, “time\_stamp” : 1741945253}  
}  
}

---

<div class="post-metadata">

**Author:** ![Kieran](https://sea2.discourse-cdn.com/flex020/user_avatar/community.purpleair.com/kieran/32/6220_2.png) [@Kieran](https://community.purpleair.com/u/Kieran)\
**Post date:** [March 14, 2025, 6:31pm UTC](https://community.purpleair.com/t/api-data-varies-from-local-data/11930/2 "2025-03-14T18:31:07Z")

</div>

Hi @Douglas_Sirkka

This is because AQI converted data isn’t available through the API. The `pm2.5` value you’re getting through the API is the raw PM data presented in units of **µg/m³**.

- The EPA has a conversion tool you can use to convert that data into AQI found here: [AQI Calculator | AirNow.gov](https://www.airnow.gov/aqi/aqi-calculator/)

- Alternatively, you can convert the data yourself. The conversion equation can be found in the EPA’s AQI documentation: [https://www.airnow.gov/publications/air-quality-index/technical-assistance-document-for-reporting-the-daily-aqi/](https://www.airnow.gov/publications/air-quality-index/technical-assistance-document-for-reporting-the-daily-aqi/)

---

<div class="post-metadata">

**Author:** ![Douglas\_Sirkka](https://sea2.discourse-cdn.com/flex020/user_avatar/community.purpleair.com/douglas_sirkka/32/6493_2.png) [@Douglas\_Sirkka](https://community.purpleair.com/u/Douglas_Sirkka)\
**Post date:** [March 15, 2025, 9:14am UTC](https://community.purpleair.com/t/api-data-varies-from-local-data/11930/3 "2025-03-15T09:14:58Z")

</div>

Thank you @Kieran. I did look to see if this was the issue but didn’t see it in my Google/PurpleAir community search and ChatGPT didn’t catch it.  
I just needed to make a simple widget that highlighted the live AQI instead of the average. I did this with Google Apps Script [here](https://script.google.com/macros/s/AKfycbyM5MwHZcAL6zY1iT06cVXYDTOmvss7ch1SomS1m-rrUEgWw-VkdvznzBlIR--qpg1Q/exec).  
Thanks again,  
Doug

---

<div class="post-metadata">

**Author:** ![Douglas\_Sirkka](https://sea2.discourse-cdn.com/flex020/user_avatar/community.purpleair.com/douglas_sirkka/32/6493_2.png) [@Douglas\_Sirkka](https://community.purpleair.com/u/Douglas_Sirkka)\
**Post date:** [March 15, 2025, 9:17am UTC](https://community.purpleair.com/t/api-data-varies-from-local-data/11930/4 "2025-03-15T09:17:46Z")

</div>

Hi @Kieran ,  
I figured it was something like that but it didn’t come up in my Google/PurpleAir community search. I just needed to make a simple widget that highlighted the current AQI rather than the average which I did using Google Apps Script [here](https://script.google.com/macros/s/AKfycbyM5MwHZcAL6zY1iT06cVXYDTOmvss7ch1SomS1m-rrUEgWw-VkdvznzBlIR--qpg1Q/exec).  
Thanks again,  
Doug
