Cannot connect to API

I want to use a script from a host to rebuild the host on the next reboot.
My first guess was to use the API from the host and rebuild the config.
But actually I’m not sure about this, are there best practices or other stuff I could look into?

Also I always get the error message from my script, that its unable to authenticate the user, so… Just to be sure, where do I find the keys?

Foreman and Proxy versions:
Foreman: 1.18.2 on Ubuntu xenial
Proxy: 1.18.2

Foreman and Proxy plugin versions:
SALT: 10.1.0

Thank you very much.

What do you want to do again? I am not following.

If you really want to just flag a host to be reprovisioned, what you want to set is “build” flag. You can do this via UI/API/CLI and you don’t need to do this from the host itself.

I solved it by myself this morning but than you.

Yes, I could do it via the gui and its way easier but I use foreman to deploy computer instead of servers and it would be nice to let the users reset their computer if they’re done with testing.

Do you know if and how I can mark this question as solved?