Industries

Products

Developer

Blog

Blog

/

API & mapping

All about API rate limits

1.19.2024//API & mapping, Tutorials

Blog post banner

Rate limiting is used to prevent our clients from taxing system resources on our end, ensuring that the API runs efficiently.

Cam Schnackel

Technical Specialist

What is rate limiting?

Rate limiting is used to control the rate of requests sent and received from the Xweather API. Its purpose is to prevent our clients from taxing system resources on our end, ensuring that the API runs efficiently for all clients at all times. It is a standard practice employed by APIs to help prevent performance hitches or outages.

Rate limits differ between subscription tiers. Our API rate limits apply to each tier by referring to the “accesses/minute max” number on our Pricing Plans page here. If you already have an active subscription, please refer to your subscription agreement or reach out to Customer Success by opening a Support Ticket. You can also track information related to rate limits using response headers, which include your current minutely rate limit, the number of hits you have available for the remaining minute, and more. To learn more about these response headers, please refer to the relevant documentation page here.


Managing your API rate limit

There are a few best practices and general tips worth considering when it comes to API rate limiting. By keeping certain techniques in mind when designing your project, you can ensure that you are only querying what you need, at the frequency you need it.

Understand your data frequency needs

Understanding how often data sources report is particularly important. For example, some weather stations report hourly, while others report as often as minutely; forecast data is updated as often as hourly in the US but generally 3-6 hours everywhere else. Even when sources do update, sometimes the changes in data are minimal, and depending on your use case, you may not need the most recent data. To view the update intervals for specific endpoints, you can view our endpoint documentation list or visit individual documentation pages for your endpoint of interest.

Hacking endpoint update interval frequency

Another tip specifically relates to automated scripts: Certain workflows may make use of automated scripts to trigger certain actions when specific conditions are met at certain times of the day. When automating a script to pull data from the Xweather API at certain intervals, try to avoid timing these things at the top of the hour. For example, instead of having a script run at 1:00, set it for a few minutes later to something like 1:06. This will ensure you capture the most recent data we’ve received.

Refer to our documentation on scripting best practices for more detailed information on these strategies and more.

What if I need to make many requests at once?

Going over your rate limit will prevent you from continuing to make further requests until the next minute, so following this is very important. In case you need to regularly make a large number of API requests at once, there is a strategy we strongly recommend adhering to.

When dealing with high request volume, try to spread them out as needed. For example, if you had a rate limit of around 1000 calls per minute, but needed to make 20,000 requests, keep your minutely request amount at 1000 or below. And if your current rate limit makes this unmanageable, consider upgrading to a higher subscription tier – you can upgrade through your account dashboard or by contacting your Account Manager.

A note about batch requests: While a batch request can be a useful means of improving performance, it will not have any impact on rate limiting since each endpoint hit still counts as a unique request.

What if I need more help?

We hope some of these tips and strategies will help you more effectively manage your rate limit. Should you have any questions about this information, or require assistance in finding a solution tailored to your specific use case, please don’t hesitate to submit a support request to our Customer Success team!

Cam Schnackel

Technical Specialist

Related Resources

Related
Resources

Resource

Weather API

Expert opinion

The best weather API of 2024: Why Xweather leads the pack

=

Next

America’s war with billion-dollar hurricanes