- Class
- 5xx server error
- Defined in
- RFC 9110, section 15.6.4
- Retry
- Yes, after a wait
- Key header
- Retry-After
- Cacheable by default
- No
When your API should return 503
Return 503 during planned maintenance, when a dependency your API needs is down, or when you shed load to stay up. Add Retry-After with a number of seconds or an HTTP date, so clients back off for the right time and don’t all come back at once.
If one caller is over their own limit and everyone else is fine, that’s a 429. If something broke unexpectedly, that’s a 500. A load balancer with no healthy backends returns 503 by itself, so make sure its body matches your API’s error format.
How public APIs declare 503 in their OpenAPI specs
Four of the eleven public specs we score declare a 503, as they were on 4 December 2026. GitHub does on 104 operations, OpenAI on 85, Box on 4 and Asana on 2.
OpenAI documents Retry-After on 18 of its 85. Nobody else documents it on a 503, so a reader of those specs can’t tell whether a wait is suggested.
| API | Operations | Declare 503 | With Retry-After | How errors are described |
|---|---|---|---|---|
| GitHub | 1,288 | 104 | 0 | Per status code |
| OpenAI | 406 | 85 | 18 | Per status code |
| Box | 297 | 4 | 0 | Per status code, plus a default |
| Asana | 302 | 2 | 0 | Per status code |
| Stripe | 612 | 0 | 0 | One default error response |
| Plaid | 351 | 0 | 0 | One default error response |
| Twilio | 197 | 0 | 0 | No error responses |
| Slack | 174 | 0 | 0 | One default error response |
| Adyen Checkout | 28 | 0 | 0 | Per status code |
| Swagger Petstore | 19 | 0 | 0 | Per status code, plus a default |
| SendGrid Mail | 3 | 0 | 0 | Per status code |
Counted per operation from each vendor’s public OpenAPI document on 4 December 2026.
Declare 503 in your OpenAPI spec
Define the 503 once with Retry-After and reference it from every operation, so a planned outage reaches clients as a wait time.
paths:
/invoices:
get:
operationId: listInvoices
responses:
"200":
$ref: "#/components/responses/InvoiceList"
"503":
$ref: "#/components/responses/ServiceUnavailable"
components:
responses:
ServiceUnavailable:
description: Down for maintenance or overloaded. Wait for Retry-After.
headers:
Retry-After:
description: Seconds to wait before trying again.
schema:
type: integer
minimum: 0
content:
application/json:
schema:
$ref: "#/components/schemas/Error"What an Octri SDK does with a 503
An Octri SDK retries a 503 on any method, POST included, since a 503 usually means the server didn’t do the work. It makes up to 3 attempts and waits for Retry-After when the response has one, capped at 8 seconds, or backs off from 500 ms with jitter when it doesn’t.
POSTs keep the same Idempotency-Key on every attempt. If the last attempt still gets a 503, the caller gets an SdkInternalServerError with the status and the Retry-After header, in TypeScript, Python, Java, Kotlin, PHP and Ruby.
import { Acme, SdkInternalServerError } from "acme-sdk";
const acme = new Acme({ apiKey: process.env.ACME_API_KEY });
try {
await acme.invoices.create({ customerId: "cus_123", amount: 4200 });
} catch (err) {
if (err instanceof SdkInternalServerError && err.statusCode === 503) {
// Retried 3 times already. Queue it for later.
console.log(err.headers["retry-after"], err.requestId);
}
throw err;
}More on retries and typed errors in SDK error handling.
Tell a blip from an outage
A 503 the SDK retried past cost a user a second or two. A 503 that outlasted every retry was an outage for them, and those are the ones worth an alert.
An Octri SDK with monitoring switched on reports the second kind to Octri Monitoring with the operation and the request ID. Set a threshold alert on them for whoever is on call, and pair it with an uptime check on a health endpoint to see whether the whole API is down or one operation is.
Monitoring is off in the SDK until the developer using it turns it on, so the count covers the users who did.
statusCode = 503 AND environment = 'production'
ORDER BY timestamp DESC LIMIT 50HTTP 503 questions
Should a 503 response be cached?
No. A cache that stores a 503 keeps serving the outage after you’ve recovered. Send Cache-Control: no-store if anything between you and your clients might cache it.
Is 503 right for planned maintenance?
Yes. Send it with Retry-After set to when the window ends, and announce the window on your status page so nobody files a bug.
Does a 503 hurt search rankings?
No, not for a short outage. Google treats a 503 as temporary and keeps the page indexed, though a long run of them can get URLs dropped.