Mark Henderson, 41, from the US, had swallowed more than 1kg of the drug, which was packed into condoms.
It is understood that during his flight from Peru to New Zealand, Henderson excreted 25 of the packages. Instead of flushing them, he covered them with coffee grounds.
Once at Auckland Airport, customs officers found the excreted packages and held Henderson until he passed the remaining cocaine-filled condoms.
Henderson, who lives in Panama, told customs officials that he only agreed to the drug run because he believed his wife and children – who were back in the Central American country – were in danger.
Henderson was sentenced to seven-and-a-half years in jail on smuggling charges at Auckland District Court.