- Class
- 2xx success
- Defined in
- RFC 9110, section 15.3.3
- Retry
- Not needed
- Key header
- Location
- Cacheable by default
- No
When your API should return 202
Return 202 when the work takes longer than a client should wait on one connection, like an export, a video encode or a bulk import. Respond as soon as the job is queued, with a job ID and a URL the client can poll, usually in Location and in the body.
If the work is done by the time you respond, return 201 or 200 with the result. A 202 promises nothing about the outcome, so the status endpoint has to report failures too, with the reason.
How public APIs declare 202 in their OpenAPI specs
Five of the eleven public specs we score declare a 202, as they were on 4 December 2026. GitHub does on 41 operations, Box on 10, and OpenAI, Twilio and SendGrid on one each.
Only one of those 54 responses documents a Location header, on Box. Everywhere else a developer has to find the job’s URL in the body schema or in the prose.
| API | Operations | Declare 202 | With Location |
|---|---|---|---|
| GitHub | 1,288 | 41 | 0 |
| Box | 297 | 10 | 1 |
| OpenAI | 406 | 1 | 0 |
| Twilio | 197 | 1 | 0 |
| SendGrid Mail | 3 | 1 | 0 |
| Stripe | 612 | 0 | 0 |
| Plaid | 351 | 0 | 0 |
| Asana | 302 | 0 | 0 |
| Slack | 174 | 0 | 0 |
| Adyen Checkout | 28 | 0 | 0 |
| Swagger Petstore | 19 | 0 | 0 |
Counted per operation from each vendor’s public OpenAPI document on 4 December 2026.
Declare 202 in your OpenAPI spec
Declare the 202 with a small job schema, and link it to the operation that reads the job, so a reader can follow the whole flow from your docs.
paths:
/exports:
post:
operationId: createExport
responses:
"202":
description: Export queued. Poll the Location URL for its status.
headers:
Location:
schema:
type: string
content:
application/json:
schema:
$ref: "#/components/schemas/ExportJob"
links:
GetExport:
operationId: getExport
parameters:
exportId: $response.body#/idWhat an Octri SDK does with a 202
An Octri SDK treats a 202 as a success and returns the job body typed from your spec. It doesn’t wait for the job to finish, since a spec has no standard way to say which field to poll and which values mean done.
The call that reads the job is an ordinary method, so while you poll it gets the SDK’s retries on a 429 or a 500, 502, 503 or 504.
import { Acme } from "acme-sdk";
const acme = new Acme({ apiKey: process.env.ACME_API_KEY });
// 202: the export is queued, and the body is the job.
let job = await acme.exports.create({ format: "csv" });
while (job.status === "pending") {
await new Promise((resolve) => setTimeout(resolve, 2000));
job = await acme.exports.get({ exportId: job.id });
}More on retries and typed errors in SDK error handling.
HTTP 202 questions
Should a 202 response include Retry-After?
Often, yes. RFC 9110 defines it for 503 and redirects, but async APIs like Azure’s send it with a 202 to say how long to wait before the first poll, which cuts the number of requests you serve.
Should the status endpoint return an error when the job fails?
No. Return 200 with the job in a failed state and the reason. The poll itself worked, and an error status would read as the poll failing.
Is a 202 the same as a webhook?
No. A 202 leaves the client to poll, and a webhook calls the client when the job finishes. Many APIs offer both and let the client choose.