HTTP status codes for your Next.js SaaS API.

Find the right response for your route handler. Search by code, meaning or API situation — free, no sign-up.

Loading the tool…

RFC reference with application guidance. Reserved codes are labeled; protocol-level responses belong to the HTTP server. Import { NextResponse } from next/server.

HTTP reference without JavaScript

Reviewed 2026-10-09. Search in the tool above; all entries remain readable here and in Markdown.

HTTP reference without JavaScript
CodeMeaningNext.js SaaS usageResponse exampleSource
100 ContinueThe request headers are accepted; the client may send its body.Let the HTTP server manage Expect: 100-continue; not an application JSON response.// No NextResponse.json example: do not emit this code from a normal route handler.Official source ↗
101 Switching ProtocolsThe server agrees to change protocols.Handled by an upgrade-capable server, not a normal Next.js JSON route.// No NextResponse.json example: do not emit this code from a normal route handler.Official source ↗
200 OKThe request succeeded.Return a fetched resource or successful action result.return NextResponse.json({ data: 'example' }, { status: 200 });Official source ↗
201 CreatedThe request created one or more resources.After inserting a record; provide Location for the new resource.return NextResponse.json({ data: 'example' }, { status: 201, headers: { 'Location': '/api/items/123' } });Official source ↗
202 AcceptedProcessing was accepted but has not completed.Queue an asynchronous job and return a status URL.return NextResponse.json({ data: 'example' }, { status: 202 });Official source ↗
203 Non-Authoritative InformationA transforming proxy modified the origin representation.Use only when your service is acting as such a transforming proxy.return NextResponse.json({ data: 'example' }, { status: 203 });Official source ↗
204 No ContentThe request succeeded and has no response content.A successful delete with no payload; JSON is forbidden.return new NextResponse(null, { status: 204 }); // No JSON bodyOfficial source ↗
205 Reset ContentThe action succeeded; the client should reset its document view.A UI reset signal with an empty body; never include JSON.return new NextResponse(null, { status: 205 }); // No JSON bodyOfficial source ↗
206 Partial ContentOne or more requested byte ranges are returned.For actual range responses; include Content-Range, not a JSON pagination marker.return new NextResponse('abcd', { status: 206, headers: { 'Content-Range': 'bytes 0-3/10', 'Content-Type': 'text/plain' } });Official source ↗
300 Multiple ChoicesSeveral representations are available.Return a list of available representations for client selection.return NextResponse.json({ data: 'example' }, { status: 300 });Official source ↗
301 Moved PermanentlyThe resource has a permanent new URI; clients may change POST to GET.For a permanent redirect where changing method is acceptable; prefer 308 to preserve it.return NextResponse.redirect(new URL('/api/v2/items', request.url), 301);Official source ↗
302 FoundThe resource temporarily resides elsewhere; clients may change POST to GET.For a temporary redirect; use 307 when the original method must be preserved.return NextResponse.redirect(new URL('/api/v2/items', request.url), 302);Official source ↗
303 See OtherRetrieve a different resource using GET or HEAD.After a POST, redirect to the resulting resource using GET.return NextResponse.redirect(new URL('/api/v2/items', request.url), 303);Official source ↗
304 Not ModifiedA conditional GET or HEAD can reuse its cached representation.After validating If-None-Match or If-Modified-Since; never include a body.return new NextResponse(null, { status: 304 }); // No JSON bodyOfficial source ↗
305 Use Proxy (deprecated)An obsolete proxy redirection mechanism.Do not emit in a modern application.// No NextResponse.json example: do not emit this code from a normal route handler.Official source ↗
306 UnusedThis previously assigned code is reserved and no longer used.Do not emit.// No NextResponse.json example: do not emit this code from a normal route handler.Official source ↗
307 Temporary RedirectTemporary new URI with method and body preserved.Temporarily move an endpoint while retaining POST semantics.return NextResponse.redirect(new URL('/api/v2/items', request.url), 307);Official source ↗
308 Permanent RedirectPermanent new URI with method and body preserved.Permanently move an endpoint while retaining its method.return NextResponse.redirect(new URL('/api/v2/items', request.url), 308);Official source ↗
400 Bad RequestThe request cannot be processed because of a perceived client error.Reject malformed JSON or invalid request syntax.return NextResponse.json({ error: 'Request failed' }, { status: 400 });Official source ↗
401 UnauthorizedThe request lacks valid authentication credentials.Missing or invalid authentication; include a WWW-Authenticate challenge.return NextResponse.json({ error: 'Request failed' }, { status: 401, headers: { 'WWW-Authenticate': 'Bearer' } });Official source ↗
402 Payment RequiredReserved for future use by HTTP.Any SaaS payment convention is application-specific; document it explicitly.return NextResponse.json({ error: 'Request failed' }, { status: 402 });Official source ↗
403 ForbiddenThe server understands the request but refuses it.A signed-in user lacks permission to access a workspace.return NextResponse.json({ error: 'Request failed' }, { status: 403 });Official source ↗
404 Not FoundNo current representation was found, or its existence is undisclosed.A missing resource, including intentional concealment of a forbidden resource.return NextResponse.json({ error: 'Request failed' }, { status: 404 });Official source ↗
405 Method Not AllowedThe method is known but unsupported for this resource.Reject an unsupported method; include Allow. Next.js can generate this automatically.return NextResponse.json({ error: 'Request failed' }, { status: 405, headers: { 'Allow': 'GET, POST' } });Official source ↗
406 Not AcceptableNo representation satisfies proactive content negotiation.The client requests a format your endpoint cannot provide.return NextResponse.json({ error: 'Request failed' }, { status: 406 });Official source ↗
407 Proxy Authentication RequiredAuthentication with an intermediary proxy is required.Only for an authenticating proxy; include Proxy-Authenticate.return NextResponse.json({ error: 'Request failed' }, { status: 407, headers: { 'Proxy-Authenticate': 'Basic realm="proxy"' } });Official source ↗
408 Request TimeoutThe full request did not arrive within the waiting period.Usually generated by the HTTP server; distinguish from an upstream 504.return NextResponse.json({ error: 'Request failed' }, { status: 408 });Official source ↗
409 ConflictThe request conflicts with the resource’s current state.A unique key conflict or an incompatible workflow transition.return NextResponse.json({ error: 'Request failed' }, { status: 409 });Official source ↗
410 GoneThe resource is no longer available and this is likely permanent.An intentionally retired API resource.return NextResponse.json({ error: 'Request failed' }, { status: 410 });Official source ↗
411 Length RequiredThe request needs a defined Content-Length.Only if your endpoint truly requires a length; usually server-managed.return NextResponse.json({ error: 'Request failed' }, { status: 411 });Official source ↗
412 Precondition FailedA request-header precondition evaluated false.If-Match does not match the current resource version.return NextResponse.json({ error: 'Request failed' }, { status: 412 });Official source ↗
413 Content Too LargeThe request content exceeds the size the server will accept.Reject an upload above your documented limit.return NextResponse.json({ error: 'Request failed' }, { status: 413 });Official source ↗
414 URI Too LongThe target URI is longer than the server accepts.An excessively long query string; usually generated before your handler.return NextResponse.json({ error: 'Request failed' }, { status: 414 });Official source ↗
415 Unsupported Media TypeThe request content format is unsupported.A JSON-only endpoint receives a different Content-Type.return NextResponse.json({ error: 'Request failed' }, { status: 415 });Official source ↗
416 Range Not SatisfiableThe requested ranges cannot be served.A bytes range is outside the resource; return Content-Range with its length.return NextResponse.json({ error: 'Request failed' }, { status: 416, headers: { 'Content-Range': 'bytes */10' } });Official source ↗
417 Expectation FailedA request expectation cannot be met.Cannot satisfy the Expect header; usually server-managed.return NextResponse.json({ error: 'Request failed' }, { status: 417 });Official source ↗
418 Unused (reserved)Reserved in RFC 9110 to prevent reassignment.Not a production API error convention; the teapot joke is not defined here.// No NextResponse.json example: do not emit this code from a normal route handler.Official source ↗
421 Misdirected RequestThe request arrived at a server unable to produce an authoritative response.Routing or connection reuse to the wrong origin; usually infrastructure-managed.return NextResponse.json({ error: 'Request failed' }, { status: 421 });Official source ↗
422 Unprocessable ContentThe content type and syntax are understood but instructions cannot be processed.A parsed JSON payload violates field or business validation.return NextResponse.json({ error: 'Request failed' }, { status: 422 });Official source ↗
426 Upgrade RequiredThe server requires a different protocol.Only for a real protocol upgrade; include Upgrade.return NextResponse.json({ error: 'Request failed' }, { status: 426, headers: { 'Upgrade': 'TLS/1.3' } });Official source ↗
428 Precondition RequiredThe request must be conditional.Require If-Match to avoid lost updates.return NextResponse.json({ error: 'Request failed' }, { status: 428 });Official source ↗
429 Too Many RequestsThe caller exceeded a rate limit.Return a rate-limit error with Retry-After when appropriate.return NextResponse.json({ error: 'Request failed' }, { status: 429, headers: { 'Retry-After': '60' } });Official source ↗
431 Request Header Fields Too LargeRequest headers are too large.Reject oversized headers; usually handled before the route.return NextResponse.json({ error: 'Request failed' }, { status: 431 });Official source ↗
500 Internal Server ErrorAn unexpected condition prevented completion.An unhandled server failure; do not expose secrets or stack traces.return NextResponse.json({ error: 'Request failed' }, { status: 500 });Official source ↗
501 Not ImplementedThe server lacks the functionality required for the request.An unsupported capability or unrecognized method, distinct from 405.return NextResponse.json({ error: 'Request failed' }, { status: 501 });Official source ↗
502 Bad GatewayA gateway received an invalid upstream response.Your proxy cannot parse or use an upstream provider response.return NextResponse.json({ error: 'Request failed' }, { status: 502 });Official source ↗
503 Service UnavailableThe service is temporarily unavailable.Maintenance or overload; Retry-After can suggest when to retry.return NextResponse.json({ error: 'Request failed' }, { status: 503, headers: { 'Retry-After': '60' } });Official source ↗
504 Gateway TimeoutA gateway did not receive a timely upstream response.Your route acts as a gateway and its upstream times out.return NextResponse.json({ error: 'Request failed' }, { status: 504 });Official source ↗
505 HTTP Version Not SupportedThe server does not support the major HTTP version.HTTP-server concern, not a version number for your business API.return NextResponse.json({ error: 'Request failed' }, { status: 505 });Official source ↗
511 Network Authentication RequiredNetwork access authentication is required.For intercepting network portals, not SaaS sign-in.// Network portal only; do not use for SaaS authentication.Official source ↗

How to use

  1. Search a code or a situation, such as validation, authentication or redirect.
  2. Read the meaning, API usage guidance and linked RFC section.
  3. Copy the route handler response; add your own request validation and headers.

Reference documentation

Frequently asked questions

Is this free, and do I need to sign up?

Free, no sign-up. Inputs and results stay in your browser. Analytics record only a tool identifier and action, never your input.

Which source defines these codes?

The reference includes all code entries in RFC 9110 section 15, including obsolete and reserved entries. 428, 429, 431 and 511 come from RFC 6585 and link to that separate source.

Can every status return NextResponse.json?

No. Informational responses, 204, 205 and 304 cannot carry JSON here. Redirects use NextResponse.redirect. Range responses require real range content and headers. The reference gives safe alternatives rather than invalid JSON snippets.

How do 401 and 403 differ?

401 means authentication is missing or invalid and needs a WWW-Authenticate challenge. 403 means the request is understood but refused, such as a signed-in user lacking workspace permissions.

Should validation return 400 or 422?

400 fits malformed requests. 422 fits understood, syntactically valid content whose instructions cannot be processed. Choose a consistent documented contract for your API.

Are these complete production route handlers?

No. Each snippet shows the response construction, assuming NextResponse is imported from next/server and request is available. Add authentication, validation, logging and your own data handling.

Related tools

All free tools

Read this page as Markdown