RateLimit-Remaining
General Summary
Section titled “General Summary”Standardized header showing how many requests the client has left before hitting the rate limit threshold.
Detailed Description
Section titled “Detailed Description”The RateLimit-Remaining response header is the IETF standardized version of X-RateLimit-Remaining. It indicates the number of requests remaining in the current rate limit window before the client will be throttled. This header decrements with each request made and resets when a new rate limit window begins.
Use Cases (When, Why, and How)
Section titled “Use Cases (When, Why, and How)”When to Use It
Section titled “When to Use It”Modern APIs should include this standardized header alongside RateLimit-Limit in every response where rate limiting applies. Prefer this over the legacy X-RateLimit-Remaining header.
Why to Use It
Section titled “Why to Use It”The standardized header ensures compatibility with modern API clients and follows current HTTP header naming conventions. It provides real-time feedback about quota consumption without relying on deprecated X- prefixed headers.
How to Use It
Section titled “How to Use It”The server calculates the remaining requests for the client and includes this value in the response. Clients should monitor this value and implement backoff logic when it approaches zero.
Example code in Javascript:
async function makeRequest(url) { const response = await fetch(url); const remaining = parseInt(response.headers.get('RateLimit-Remaining'));
if (remaining < 10) { console.warn('Approaching rate limit, slowing down requests'); await new Promise(resolve => setTimeout(resolve, 1000)); }
return response.json();}Example
Section titled “Example”RateLimit-Remaining: 847