429 Too Many Requests
The HTTP 429 Too Many Requests status code indicates that the client has sent too many requests in a given amount of time. The OpenAQ API has rate limits to ensure fair access and prevent abuse. When you exceed these limits, the server will respond with an HTTP 429 error.
The rate limits for the OpenAQ API are quite generous, but it’s important to be mindful of your request frequency, especially when running automated scripts or applications. If you receive a 429 error, it means you have temporarily been blocked from making further requests for a set period. Read more about rate limits in the Rate limits section of this site.
How to Resolve
Section titled “How to Resolve”Utilize rate limit headers
Section titled “Utilize rate limit headers”To resolve a 429 Too Many Requests error and prevent it from happening again, implement a strategy to manage request frequency. The OpenAQ API provides HTTP header with most responses that contain information on current API rate limit status. These headers contain information such as current number of requests used in the rate limit period, remaining requests in the rate limit period, and time until rate limit period resets. Read more about rate limit headers on the Rate limit page.
Consider a Higher Rate Limit
Section titled “Consider a Higher Rate Limit”If your usage is consistently exceeding the general use rate limits and you have a need for a higher volume of requests, you can contact the OpenAQ team to discuss a custom rate limit.