# Erro 400 api.purpleair get historical data

**URL:** <https://community.purpleair.com/t/erro-400-api-purpleair-get-historical-data/2785>\
**Category:** API\
**Created:** [November 22, 2022, 8:36pm UTC](https://community.purpleair.com/t/erro-400-api-purpleair-get-historical-data/2785 "2022-11-22T20:36:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Val](https://sea2.discourse-cdn.com/flex020/user_avatar/community.purpleair.com/val/32/883_2.png) [@Val](https://community.purpleair.com/u/Val)\
**Post date:** [November 22, 2022, 8:36pm UTC](https://community.purpleair.com/t/erro-400-api-purpleair-get-historical-data/2785/1 "2022-11-22T20:36:51Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Jasmine\_Bootman](https://sea2.discourse-cdn.com/flex020/user_avatar/community.purpleair.com/jasmine_bootman/32/369_2.png) [@Jasmine\_Bootman](https://community.purpleair.com/u/Jasmine_Bootman)\
**Post date:** [November 22, 2022, 8:49pm UTC](https://community.purpleair.com/t/erro-400-api-purpleair-get-historical-data/2785/2 "2022-11-22T20:49:07Z")

</div>

> [@(Outdated) Historical API Endpoints are now Restricted](https://community.purpleair.com/t/historical-api-endpoints-are-now-restricted/1557):
>
> The historical endpoints in the PurpleAir API have recently become restricted due to extremely heavy use. To use the historical API, you will need to be granted access. To gain access, contact us at [contact@purpleair.com](mailto:contact@purpleair.com) with your API keys and a description of your API usage. This includes the frequency at which you will request data. All API keys will now have access to the historical endpoints. If your keys do no have access, email us at [contact@purpleair.com](mailto:contact@purpleair.com) with your API keys to be granted…

---

<div class="post-metadata">

**Author:** ![Jaime\_Contreras](https://sea2.discourse-cdn.com/flex020/user_avatar/community.purpleair.com/jaime_contreras/32/787_2.png) [@Jaime\_Contreras](https://community.purpleair.com/u/Jaime_Contreras)\
**Post date:** [January 13, 2023, 11:16pm UTC](https://community.purpleair.com/t/erro-400-api-purpleair-get-historical-data/2785/3 "2023-01-13T23:16:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Chloe\_CTDEEP](https://avatars.discourse-cdn.com/v4/letter/c/f19dbf/32.png) [@Chloe\_CTDEEP](https://community.purpleair.com/u/Chloe_CTDEEP)\
**Post date:** [January 17, 2023, 12:28pm UTC](https://community.purpleair.com/t/erro-400-api-purpleair-get-historical-data/2785/4 "2023-01-17T12:28:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Jaime\_Contreras](https://sea2.discourse-cdn.com/flex020/user_avatar/community.purpleair.com/jaime_contreras/32/787_2.png) [@Jaime\_Contreras](https://community.purpleair.com/u/Jaime_Contreras)\
**Post date:** [January 17, 2023, 5:02pm UTC](https://community.purpleair.com/t/erro-400-api-purpleair-get-historical-data/2785/5 "2023-01-17T17:02:26Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Chloe\_CTDEEP](https://avatars.discourse-cdn.com/v4/letter/c/f19dbf/32.png) [@Chloe\_CTDEEP](https://community.purpleair.com/u/Chloe_CTDEEP)\
**Post date:** [January 17, 2023, 7:16pm UTC](https://community.purpleair.com/t/erro-400-api-purpleair-get-historical-data/2785/6 "2023-01-17T19:16:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Jaime\_Contreras](https://sea2.discourse-cdn.com/flex020/user_avatar/community.purpleair.com/jaime_contreras/32/787_2.png) [@Jaime\_Contreras](https://community.purpleair.com/u/Jaime_Contreras)\
**Post date:** [January 18, 2023, 9:05pm UTC](https://community.purpleair.com/t/erro-400-api-purpleair-get-historical-data/2785/7 "2023-01-18T21:05:48Z")

</div>

Thanks again Chloe. 😊
