What should an API return?

The API should always return sensible HTTP status codes. API errors typically break down into 2 types: 400 series status codes for client issues & 500 series status codes for server issues. At a minimum, the API should standardize that all 400 series errors come with consumable JSON error representation.

For More Information Please Refer: https://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api