I have an endpoint on my web application that takes data from a client and once enough data is collected, an operation is performed. If the result of this operation is invalid, I need to inform the client that this operation must be redone.
I could send a response with some sort of flag in it, but if a status code exists for this purpose already, I'd rather utilize it.
Looking at the definitions of the status codes here, it seems that there is not one that is appropriate, however, if I just take the names into account and not the descriptions, the status code 406 Not Acceptable sounds the most appropriate.
406 Not Acceptable is not appropriate because the status code is for content negotiation:
202 Accepted seems to be better:
... But I am not sure that the status code's purpose matches yours:
Usually http responses does not explicitly request user agent to send additional information. The only status code to do that I know is 401 Unauthorized which requests Authorization header. You may need to design your own status code for your purpose. Please consult with people at HTTP Working Group mailing list.