Added api error handeling and updated docs