extract api_key to environment