Update: GitHub now added new APIs to enable the code scanning default setup at organization level and for single repositories. But keep in mind that the default setup does not work for all programming languages supported by CodeQL at the moment.
The API only seems to provide endpoints for getting code scanning results at the moment. Also, until recently you always had to include configuration files in your repository to set up CodeQL code scanning. And depending on what languages you want to scan you might still need configuration files, see the documentation.
However, if you have already set up CodeQL code scanning manually you could maybe use the REST API endpoints for disabling and enabling the already existing code scanning workflow.
Disabling CodeQL code scanning (through the REST API) seems like a rather uncommon use case. Could you explain your use case a bit more in detail? Maybe there are better ways to solve this, for example you can customize which severities cause a pull request check failure.