Skip to content

By the Octri team · Updated

429 Too Many Requests

Share

A 429 means the client sent more requests than the server will take in a window of time. The server can add a Retry-After header saying how long to wait, and a client that waits that long and sends the request again will usually get through.

All HTTP status codes

Class
4xx client error
Defined in
RFC 6585, section 4
Retry
Yes, after a wait
Wait header
Retry-After
Cacheable
No

When your API should return 429

Return 429 when one caller has gone over a limit that's theirs, like 100 requests a minute per API key, and the same request will work once the window resets. Put the wait in Retry-After, either as a number of seconds or as an HTTP date, because clients can't guess how your window works.

If the whole service is overloaded and every caller is affected, that's a 503. If the caller's plan doesn't include the endpoint at all, waiting won't fix it, so that's a 403. A 429 is the one that says try again later, and RFC 6585 says caches must not store it.

How public APIs declare 429 in their OpenAPI specs

We counted every operation in the eleven public specs we score, as they were on 4 December 2026. Only three of the eleven declare a 429 anywhere, and only OpenAI declares it on most of its operations.

Stripe, Slack and Plaid describe most of their errors with one default response, so a 429 is covered there without being named. A code generator can't tell a rate limit from any other error in that case, and it can't read a Retry-After header the spec never mentions.

APIOperationsDeclare 429With Retry-AfterHow errors are described
OpenAI406303177Per status code
GitHub1,288203Per status code
Box29730Per status code, plus a default
Stripe61200One default error response
Plaid35100One default error response
Asana30200Per status code
Twilio19700No error responses
Slack17400One default error response
Adyen Checkout2800Per status code
Swagger Petstore1900Per status code, plus a default
SendGrid Mail300Per status code

Counted per operation from each vendor’s public OpenAPI document on 4 December 2026.

Declare 429 in your OpenAPI spec

Define the 429 once under components and reference it from every operation that's rate limited. Declaring Retry-After as a header is what lets a generated client find it.

yaml
paths:
  /invoices:
    post:
      operationId: createInvoice
      responses:
        "201":
          $ref: "#/components/responses/InvoiceCreated"
        "429":
          $ref: "#/components/responses/TooManyRequests"

components:
  responses:
    TooManyRequests:
      description: Rate limit exceeded. Wait for Retry-After, then try again.
      headers:
        Retry-After:
          description: Seconds to wait before the next request.
          schema:
            type: integer
            minimum: 0
        X-RateLimit-Limit:
          schema:
            type: integer
        X-RateLimit-Remaining:
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"

What an Octri SDK does with a 429

Every SDK Octri generates retries a 429 by itself, in all ten languages. It makes up to 3 attempts, and it waits for Retry-After when the response has one, in seconds or as an HTTP date. Without it the wait starts at 500 ms and doubles each time with some jitter, and either way it's capped at 8 seconds. You can change the attempts and the backoff in SDK Studio.

A 429 is retried on a POST too, with the same Idempotency-Key on every attempt. If the last attempt still gets a 429, the caller gets an SdkRateLimitError with the status, the headers and the request ID in TypeScript, Python, Java, Kotlin, PHP and Ruby.

typescript
import { Acme, SdkRateLimitError } from "acme-sdk";

const acme = new Acme({ apiKey: process.env.ACME_API_KEY });

try {
  // Retried up to 3 times on a 429, waiting for Retry-After each time.
  await acme.invoices.create({ customerId: "cus_123", amount: 4200 });
} catch (err) {
  if (err instanceof SdkRateLimitError) {
    console.log(err.headers["retry-after"], err.requestId);
  }
  throw err;
}

More on retries and typed errors in SDK error handling.

See which 429s your users can’t get past

Your server logs count every 429 you send. They can’t tell you which ones the client got past on the next attempt and which ones it gave up on, and the second kind is the one your users notice.

An Octri SDK with monitoring switched on reports those. A 429 that’s still failing after the last retry arrives in Octri Monitoring as an error with the status code, the operation and the request ID. Search for it to see which operations run out of retries, and set a threshold alert to Slack or PagerDuty, say more than 20 in 5 minutes.

Monitoring is off in the SDK until the developer using it turns it on, so the count covers the users who did. A 429 that succeeds on a retry isn’t reported.

sql
statusCode = 429 AND environment = 'production'
  ORDER BY timestamp DESC LIMIT 50

HTTP 429 questions

Is a 429 the client’s fault or the server’s?

Partly. It’s in the 4xx class, so formally the client caused it by sending too much. In practice it often comes from a shared limit, like an organisation-wide quota, and the client that gets the 429 may not be the one that used most of it.

What should a client do if there’s no Retry-After header?

Back off exponentially and add jitter, so a group of clients that were limited together don’t all come back in the same second. Start around half a second, double each time and stop after a few attempts.

Do 429 responses count against the rate limit?

Often, yes. Many APIs count every request they receive, rejected ones included, which is why a client that retries immediately in a loop can keep itself limited.

Should a 429 response have a body?

Yes. RFC 6585 says it should explain the condition. A JSON error with a code like rate_limit_exceeded and the limit that was hit gives a developer something to log and search for.

Is there a standard header for the limit itself?

No, not a finished one. X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset are the common convention, and GitHub uses them. The IETF has a draft for RateLimit and RateLimit-Policy headers that would replace them.

Share