I am building an application with a REST-based API and have come to the point where I am specifying status codes for each requests.
What status code should i send for
A duplicate in the database should be a 409 CONFLICT.
409 CONFLICT
I recommend using 422 UNPROCESSABLE ENTITY for validation errors.
422 UNPROCESSABLE ENTITY
I give a longer explanation of 4xx codes here.