How far do you have to progress through Pokémon Ultra Sun / Ultra Moon to access Mystery Gift?
I don’t know what the absolute earliest is, but I used the code after I went to the Pokémon Centre (having been given the Rotom Dex) and it worked at that point, around an hour in.