Apple pie that has sugar - like this one - can be kept (covered) in room temperature for up to 48 hours. If you're keeping it for longer than that you should store it in the fridge from the start. Just make sure to let it cool down first.