Added type checking for api inputs