add api key verification and priority checking