Restart heroku dyno in nodejs

I want to restart a nodejs app to change its ip. How would I do this within the app itself? I have tried forcing a crash however if the app crashes twice within ten minutes, then heroku will restart the dyno ten minutes after the first crash.

If you have the Heroku CLI installed, you can run heroku restart in the folder of your application or run heroku restart --app application_name.

If you don't have it installed, you can find information about it here.

Take a look at this node wrapper for the v3 API and this api command.

You'll likely need to create some sort of condition that triggers this, if it really needs to be done from within the app itself.