# Should I use groups for historical data downloads from multiple sensors?

**URL:** <https://community.purpleair.com/t/should-i-use-groups-for-historical-data-downloads-from-multiple-sensors/3639>\
**Category:** API\
**Created:** [February 16, 2023, 8:53am UTC](https://community.purpleair.com/t/should-i-use-groups-for-historical-data-downloads-from-multiple-sensors/3639 "2023-02-16T08:53:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ihsankahveci](https://sea2.discourse-cdn.com/flex020/user_avatar/community.purpleair.com/ihsankahveci/32/2048_2.png) [@ihsankahveci](https://community.purpleair.com/u/ihsankahveci)\
**Post date:** [February 16, 2023, 8:53am UTC](https://community.purpleair.com/t/should-i-use-groups-for-historical-data-downloads-from-multiple-sensors/3639/1 "2023-02-16T08:53:34Z")

</div>

I am trying to send requests for downloading daily averages of ~300 sensors over 3 years. The API guide suggests using the group functionality when working with real-time API. However, historical API doesn’t support multiple sensors. I have two strategies:

1. Write a for loop that uses `Get Sensor History` request for each sensor with one-year intervals.
2. Add my sensors into a group, then write a for loop that uses `Get Member History` for each group member, but everything else is the same.

Are there any efficiency gains or rate limit differences between the two?

Thank you!

---

<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:** [February 16, 2023, 12:29pm UTC](https://community.purpleair.com/t/should-i-use-groups-for-historical-data-downloads-from-multiple-sensors/3639/2 "2023-02-16T12:29:22Z")

</div>

My understanding is that there is no way to include multiple sensors in a historical API request - it must always be one sensor per request. I personally use a for loop to run a list of sensor indexes over the API request URL.

---

<div class="post-metadata">

**Author:** ![ihsankahveci](https://sea2.discourse-cdn.com/flex020/user_avatar/community.purpleair.com/ihsankahveci/32/2048_2.png) [@ihsankahveci](https://community.purpleair.com/u/ihsankahveci)\
**Post date:** [February 16, 2023, 5:40pm UTC](https://community.purpleair.com/t/should-i-use-groups-for-historical-data-downloads-from-multiple-sensors/3639/3 "2023-02-16T17:40:08Z")

</div>

Thank you for the reply. You are right that **it must always be one sensor per request**. However, that one request can be sent with `group_id` and `member_id` or with `sensor_index` in the URL. I want to know whether there is a difference between the two.

---

<div class="post-metadata">

**Author:** ![Ethan](https://sea2.discourse-cdn.com/flex020/user_avatar/community.purpleair.com/ethan/32/177_2.png) [@Ethan](https://community.purpleair.com/u/Ethan)\
**Post date:** [February 17, 2023, 9:08pm UTC](https://community.purpleair.com/t/should-i-use-groups-for-historical-data-downloads-from-multiple-sensors/3639/4 "2023-02-17T21:08:44Z")

</div>

There isn’t a difference. However, using members may be beneficial since you can use a group. You can have your code get a list of all of the sensors in your group and then get their data. You could add or remove sensors from your group at any time, and your code would not have to change to accommodate.
