moved get api key types to outside of click event