Errors as application/problem+json
Every API invents its own error shape, and every client writes a parser for each one. RFC 9457 already defined a shape.
{
"type": "https://example.com/errors/insufficient-funds",
"title": "Insufficient funds",
"status": 402,
"detail": "Balance is 12.50, the charge was 30.00.",
"instance": "/orders/8f2a"
}type is a stable identifier a client can switch on, and detail is for a human. You're allowed to add extra fields.
httpapi-design