The historical API can be used to download PurpleAir data from any date range. However, there is a limit to the amount of data that can be collected per request. Multiple requests will need to be made to collect data past that limit.
The time limits for each average are listed below. Averages are on the left, and the time limit is on the right.
Say you were collecting real-time PM2.5 data from January 1 to January 4. Only 2 days of real-time data can be collected per request, so two requests need to be made; the first request for January 1-2 and the second request for January 3-4. These dates will be in UTC.
The request URLs may look like this:
Notice how the end timestamp for the first request is January 3. This is because this date is exclusive and will not appear in the data. The start timestamp is inclusive, meaning data on that date will be collected. The first example request will get data from January 1 at 12:00 a.m. to January 2 at 11:59 p.m.
Looping with Code
Programming languages will allow you to loop through a date range and automatically make the required number of API requests. The PurpleAir Data Download Tool does this in the background without the user needing programming experience.