this is API shall return json instead even for error.
Error message shall be put in a single place. Probably you need to create a module which define common logic error code. The server is perfectly find and http shall return 200, coz nothing is wrong with our server. It shall not return 500.