Added method to assign api_key