Updated method to get the API key