Skip to main content
REST API

429 Too Many Requests

ErrorRetryValidateMedium

What you will learn

  • Parse Retry-After header and respect it before retrying โ€” ignoring it escalates limits
  • Test both sliding-window and token-bucket limit behaviours โ€” they fail differently under burst
  • Assert rate-limit headers (X-RateLimit-*) are present and decrement correctly

Description

Handle rate limiting responses. Check retry headers.

Test Scenario

// Make many rapid requests
for (let i = 0; i < 100; i++) {
  await request.get('/api/v1/rate-limited');
}
const response = await request.get('/api/v1/rate-limited');
expect(response.status()).toBe(429);
expect(response.headers()['retry-after']).toBeDefined();
Endpoint/api/v1/rate-limited

Testing Tips

  • โ€ขMake rapid requests to trigger
  • โ€ขCheck Retry-After header
  • โ€ขCheck X-RateLimit headers
// Playwright API Testing - REST
import { test, expect } from '@playwright/test';
test('REST API request', async ({ request }) => {
const response = await request.get('/api/v1/resource');
expect(response.ok()).toBeTruthy();
expect(response.status()).toBe(200);
const data = await response.json();
expect(data).toBeDefined();
});

Challenge ID: rest-error-429

2 frameworks available

API Playground

Send requests and inspect responses

Endpoint: /api/v1/rate-limited

Press Enter to send