API errors

Validation failed

422 · validation_failed

Why you got this

The request parsed, but a value in it was rejected. The errors array carries one entry per rejected field, each with the field that failed and a stable code such as blank, too_long or invalid.

What to do

Branch on errors[].code, not on message, which can be reworded. field names the input to mark for the user, and a field of base means the record as a whole was refused, so read detail for that case. An email address another contact already holds reports contact_exists, which only PATCH can produce: POST /contacts updates a known address instead.

How it arrives

Every failure on the API is an RFC 7807 problem document, sent asapplication/problem+json. Branch on type — or on its last segment, which is the code above — rather than ontitle or detail, which are prose and may be reworded.

{
  "type": "https://emailfig.com/docs/errors/validation_failed",
  "title": "Validation failed",
  "status": 422
}

Every code

Back to the API reference