Root password for api script


I have an script that call an api function on startup However if a user changes the password the api will not be able to get a token.

Is there a way to have the api running on another user ?

Sorry I am not quite sure about your questions. Can you give more details?