add checks for key and api_key