Rate Limits
Rate limiting is an essential concept in APIs that restricts the number of requests a client can make in a specified amount of time. This helps prevent abuse, ensures fair usage of resources, and protects against DDoS attacks.
When you hit a rate limit, the API will return a 429 Too Many Requests
status code, signaling that you need to wait before making more requests. Understanding how rate limits work will help you manage your requests effectively and prevent disruptions to your application.
How Rate Limits Work
Rate Limit Definition
Requests per minute: The number of requests you are allowed to make in a given minute (e.g., 100 requests per minute).
Requests per hour/day: Some APIs also have limits based on hourly or daily quotas (e.g., 1000 requests per hour).
Reset Time: Rate limits are usually reset after a certain time period, which is indicated in the API response headers.
The Marvel Rivals API uses a dynamic rate limit that adjusts to each user and their usage to help better their performance.
Rate Limit Headers
When you make an API request, you may receive rate limit information in the response headers. These headers provide insight into your current rate limit status.
Here are the most common headers:
X-RateLimit-Limit
: The maximum number of requests allowed in the current time window.X-RateLimit-Remaining
: The number of requests remaining before hitting the rate limit.X-RateLimit-Reset
: The time when the rate limit will reset (usually as a Unix timestamp).
Example:
Last updated
Was this helpful?