Back to all status codes
422

Unprocessable Content

The server understands the content type but was unable to process the contained instructions.

Common Causes

  • Validation error
  • Semantic error in request
  • Business logic violation

Fix Solutions

Fix validation errors

Review and correct the request data according to API requirements.

Code Examples

// Express.js - Validation error
app.post('/api/users', (req, res) => {
    const errors = validateUser(req.body);
    if (errors.length > 0) {
        return res.status(422).json({ 
            error: 'Validation failed',
            details: errors
        });
    }
    // Create user...
});

Related Tools