How to switch between dx10-11 and OpenGl 3-4?

How can I switch between APIs inside my graphic settings menu in C++?

Is there a console command for it?

Do I need to restart the game?

thank you all