add error code for API