AirGradient Forum

Dashboard API Documentation

Is there any available API documentation for the AirGradient dashboard? I have been playing around with ESPHome and would like to send data to the AirGradient dashboard but the only info I can find about the API is to mimic the call/structure in the DIY instructions. It would be great if there were some documentation to reference as a source-of-truth.

2 Likes

I agree with this request. Is there anything available? I got into the Arduino code to pull the valid fields, but a true API documentation resource would be prefered.

We have our public API documented here.

But that does not (yet) contain the POST calls from the sensor. I will talk to our developers to add that.

2 Likes

I’m still not seeing the POST data for the /measures endpoint on the API page:
https://api.airgradient.com/public/docs/api/v1/

I see it still shows /v1 for the version, but it looks like things are changing.

In ESPHome I’m using rhumCompensated, but according to this page I see rhum_corrected under the Models/Measures section, but I’m not sure if that is even accurate.

I actually came here to see if there was a new field for the PM 2.5 corrected value, or one for the raw value from the sensors, but I’m not any more clear.

In the API page I see pm02_corrected but I don’t see this in the source files of AgValue.cpp or OpenMetrics.cpp
I do see pm02Compensated in those .cpp files, so is that the most accurate?

Ultimately, I would like to see the API reference page be up to date and accurate with the actual endpoints to be used and if fields are changing, that is the call for a new Version of the API so things don’t break if properties are being modified.

Is there an updated API implementation and documentation that returns payloads of locationID, serialno, groupId, placeId, etc. for the app.airgradient.com app server?

I see no way to get elements without knowing the IDs by looking at the dashboard in a browser. There should be a top level API call that returns IDs such that the API is self describing.

Maybe try this?
https://api.airgradient.com/public/docs/api/v1/#/default/getAllCurrentMeasures

That’s exactly what I needed and works well, thank you.

@Achim_AirGradient
The documentation and API reference is still very out of date. In the API docs, under the Models for Measure, it shows atmp_corrected. rhum_corrected, and rco2_corrected none of which I can find any reference to in the GiHub project for the firmware, so I’m pretty sure these aren’t being used at all.

Not having this accurate doesn’t fit the desire to be open and accessible to users.

I was also reviewing what was being sent in the API payload from my device according to its logs and I see only atmp and rhum but at some point in the past I thought it was sending atmpCompensated and rhumCompensated and I do see references to these two in the firmware code, but since the logging doesn’t show that it was part of the payload, I’m not sure if it is actually being sent and the log is incorrect, or if this isn’t used at this point.
There is no reference to either of these two in Swagger UI