Skip to content

By the Octri team · Updated

428 Precondition Required

Share

A 428 means the server wants the request to be conditional and it wasn’t. The client has to send `If-Match` with the ETag it last read, so the server can refuse to overwrite a newer change.

All HTTP status codes

Class
4xx client error
Defined in
RFC 6585, section 3
Retry
Yes, with If-Match
Key header
If-Match
Cacheable by default
No

When your API should return 428

Return 428 on PUT, PATCH or DELETE when the request has no If-Match and your API requires one. Without it a client can save over someone else’s change without knowing, and RFC 6585 added 428 to close that gap.

If the client did send If-Match and the ETag is stale, that’s a 412. Return 428 only where you enforce it, and say so in the docs, because clients written against other APIs won’t expect it.

How public APIs declare 428 in their OpenAPI specs

None of the eleven public specs we score declares a 428, as they were on 4 December 2026. Box takes If-Match on 8 operations and answers a stale one with 412, and leaves the header optional on all 8.

That fits how most APIs treat conditional writes. They’re there for clients that want them, and a client that sends none gets last-write-wins.

APIOperationsDeclare 428How errors are described
GitHub1,2880Per status code
Stripe6120One default error response
OpenAI4060Per status code
Plaid3510One default error response
Asana3020Per status code
Box2970Per status code, plus a default
Twilio1970No error responses
Slack1740One default error response
Adyen Checkout280Per status code
Swagger Petstore190Per status code, plus a default
SendGrid Mail30Per status code

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

Declare 428 in your OpenAPI spec

Mark If-Match as required and declare 428 for requests that leave it out, next to the 412 for requests that send a stale one.

yaml
paths:
  /invoices/{invoiceId}:
    patch:
      operationId: updateInvoice
      parameters:
        - name: If-Match
          in: header
          required: true
          schema:
            type: string
      responses:
        "200":
          $ref: "#/components/responses/Invoice"
        "412":
          description: The ETag is stale. Read the invoice again.
        "428":
          description: Send If-Match with the ETag from your last read.

What an Octri SDK does with a 428

A header parameter your spec declares becomes an argument of the generated method, so If-Match sits in the call next to the invoice ID.

A 428 that arrives anyway gets an SdkHttpError with statusCode 428, and the SDK doesn’t retry it, since sending the same request again without the header would fail the same way.

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

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

try {
  await acme.invoices.update({ invoiceId: "inv_123", memo: "Net 30" });
} catch (err) {
  if (err instanceof SdkHttpError && err.statusCode === 428) {
    // Sent without If-Match. Read the invoice for its ETag, then send it.
  }
  throw err;
}

More on retries and typed errors in SDK error handling.

HTTP 428 questions

Can a 428 apply to a GET?

No, in practice. It protects writes from lost updates, and a read can’t overwrite anything.

Should a 428 say which header is missing?

Yes. Name If-Match in the body and say where to get an ETag, usually the response to a GET on the same URL.

Does If-Unmodified-Since satisfy a 428?

Yes, if your API accepts it. It’s a valid precondition in RFC 9110, though a timestamp has one-second resolution, so ETags are safer for resources that change fast.

Share