Is is possible to buy or to sell cryptos with USD using the API?

My question is if I can buy, for example, BTC with my credit card using the API? and, if I can do the inverse operation, I mean, sell BTC into cash or dollars using the Binance API?

I know that I can exchange cryptocurrencies between them, but I want to know if is possible with cash or USD.

Unfortunately, purchase by credit card is not supported via API.