422 Unprocessable Content
The request was well-formed and understood, but the values inside it failed validation. The syntax was fine and the semantics were not.
At a glance
- Status code
- 422 Unprocessable Content
- Class
- 4xx, client error, the request itself is the problem
- Defined in
- RFC 9110
- Cacheable by default
- by explicit headers only
- Response body
- Should carry per-field validation errors.
In detail
422 draws the line between cannot parse this (400) and parsed it fine, and it is wrong (422). An end date before a start date is the canonical example.
Return the failing fields, not a single sentence. A client that has to display errors next to form inputs needs the field names.
Distinguish 422 from 409. 422 is about the values in this request. 409 is about the request clashing with state that already exists.
Examples
HTTP/1.1 422 Unprocessable Content
Content-Type: application/problem+json
{"errors":[{"field":"end_date","detail":"must be after start_date"}]}Things that catch people out
- 422 came from WebDAV and some older clients and proxies do not recognise it. If you must support them, 400 with a detailed body is the safer choice.
- Using 422 for authorisation problems muddies logs. Failing a permission check is 403.
Try it: HTTP Request Builder
Build a request with any method, headers and body, send it, and read the status line the server returns.
HTTP Request Builder
LOCAL · Browser-OnlyBuild and test HTTP requests with custom headers and body
Authentication
Headers
Generate Code
curl -X GET 'https://api.example.com/endpoint' \
-H 'Content-Type: application/json'Showing a sample URL. Enter your endpoint above to update the snippet.
Related HTTP status codes
All http status codes →400 Bad Request
The server refused the request because it was malformed. The client must change something before retrying, because repeating the same bytes will fail.
409 Conflict
The request clashes with the current state of the resource, for example an edit based on a version that has since changed.
412 Precondition Failed
A conditional header on the request, such as If-Match or If-Unmodified-Since, evaluated to false, so the server did not perform the action.
423 Locked
The resource is locked by WebDAV and cannot be modified until the lock is released or a valid lock token is supplied.
424 Failed Dependency
The request failed because an earlier request it depended on failed, so this one was never attempted.
425 Too Early
The server refuses to process a request sent in TLS 1.3 early data, because early data can be replayed by an attacker.
Tools for this
- HTTP Request Builder Free online HTTP request builder - build and test HTTP requests with custom headers and body
- HTTP Headers Checker Free online HTTP headers checker - view HTTP response headers for any URL