72 hours but that can change. Just do it safely before your outbound.
Don't sweat - you likely can do it at arrival.
But some airlines/airports will request at check in - I can't rtemember any airport requesting in the last few years. BUT as in the thread above PI seems to have embedded the online confirmation in to their immigration process,
Others above record issues if you haven't complied. I have had no issues but my partner has been required to file again for departure. But not me with a UK passport. She has UK residency!
Some things relating tp PI
bureaucracy you just couldn't make up....
Enjoy.