Erro 400 api.purpleair get historical data

Good afternoon!
I am requesting in api.purpleair to get historical data (CSV) but it is giving following error message:

Error 400
{
“api_version”: “V1.0.11-0.0.41”,
“time_stamp”: 1669149190,
“error”: “InvalidParameterValueError”,
“description”: “The value provided for parameter ‘sensor_index’ was not valid.”
}

What guidance to resolve the error?

Thank you for your usual attention!

1 Like

Hi Jasmine! Question: when you refer to historical data, how far back is consider historical? If I want to retrieve say, since November 1st 2022, would I need to contact PurpleAir?

Thanks for your support!.

Jaime

Essentially, anything that isn’t live data is historical data. Depending on what averaging period you want (e.g. 1 hour or 24 hour), you may need to make multiple requests to the API to retrieve all that data due to restrictions in the API. For instance, if you did want hourly data, you’d need to make requests in 2-week increments, going back to 11/1/2022.

1 Like

Chloe, thank you for your reply and informative message. I’ll proceed with the two week intervals as noted, but one detail remains. Can I make group request in two weeks intervals? or should I make them individual? I have 14 active sensors.
Thank you Chloe again for your help.

Unfortunately, you’ll need to make each request individually as there is currently no function to query a group of sensors with the historical API. Each request will need to be one sensor over two weeks of hourly data.

1 Like

Thanks again Chloe. :blush:

1 Like