better validation for the api