Checks for valid api key before an action