TestingAPIs is still being built. If something breaks, email support@testingapis.com.

Fail the first N attempts for a key, then succeed

GETPOSThttps://api.testingapis.com/api/chaos/retry/{key}Sign in to see this endpoint's URL

A deterministic way to test retry logic: with succeedAfter=3, attempts 1-3 fail and attempt 4 succeeds. Every response has an X-Attempt header, and failures add Retry-After: 1. Reset the counter with DELETE /api/chaos/retry/{key}. Available for GET and POST.A deterministic way to test retry logic: with succeedAfter=3, attempts 1-3 fail and attempt 4 succeeds. Every response has an X-Attempt header, and failures add Retry-After: 1. Reset the counter with DELETE …. Available for GET and POST.

Parameters 3

NameTypeDescription
keyrequiredpath · stringYour own counter name (up to 64 characters). Each key counts attempts independently.
succeedAfterquery · integer (int32)Number of attempts that fail before success (0-20, default 3). Default: 3.
failStatusquery · integer (int32)Status used for failures: 429, 500, 502, 503 or 504 (default 503). Default: 503.

Responses

200
This attempt succeeded.
400
Invalid key, succeedAfter or failStatus.
503
This attempt failed (or the chosen failStatus).

Example

Request
curl -X GET "https://api.testingapis.com/api/chaos/retry/docs-demo?succeedAfter=0" \
  -H "X-TestingApis-Key: YOUR_API_KEY"
Response200 OK
{"message": "Succeeded on attempt 1.", "attempt": 1, "succeedAfter": 0}

Sign in to see the details

The parameters, request and response examples and the live Try it panel for this endpoint are for signed-in members. Accounts are free and take a few seconds to create.