Immigration Act 2009, ss 43(1), 71(1), 79(1)
If you are not a New Zealand citizen, then being in New Zealand legally usually depends on having current permission from Immigration New Zealand in the form of a “visa”.
You can apply for a New Zealand visa from overseas and, once you get to New Zealand, you can apply for entry permission. All non-citizens of New Zealand need “entry permission”, as well as a visa, to be able to get into New Zealand in the first place (unless you are a citizen of a “visa waiver” country; see note below).
Once you’re in New Zealand on a current visa, the visa gives you the legal right to stay here for the time stated in the visa. If you then leave New Zealand, the visa also lets you return here and apply for entry permission again, so long as your visa hasn’t expired. If you’re in New Zealand on a current visa, you also have the legal right to apply to Immigration NZ for a further visa to cover you when your current one expires (see below, “No right to apply for a new visa if you’re here unlawfully”).
Note: For some countries (“visa waiver” countries), you don’t need a visa to travel to New Zealand and ask for entry permission. Instead, when you arrive you can apply for your visa and entry permission at the same time. For all other countries, you apply for a New Zealand visa in your home country and then travel here and apply for entry permission when you arrive. For more details, see “Travelling to and entering New Zealand”.