David Kimura PRO said over 4 years ago on API Structure and Error Handling :
I would try to keep it as simple as possible. In some cases where you are trying to validate a coupon code, you may want to raise a custom error for the coupon code if it is not valid. Add a catch for that error within the RescueHandler and respond back with the appropriate message. On some cases where you may have nested_attributes_for, you should have validations within the nested attributes and those should be taken into consideration when creating and updating records. For example, if I have a `book` which has many `authors` and the authors are created via `accepts_nested_attributes_for`, when I make a post to the books with the parameters `book[authors_attributes][0][full_name] = ""`, I would get the response `{"message":"Validation failed: Authors full name can't be blank"}`