Add support for API key, handle 401 Unauthorized responses