In https://www.interactivebrokers.com/en/index.php?f=5041&ns=T it is written that in order to use the IB api you have to connect to it through the TWS or IB Gateway.
This is a reply from IB tech support:
From the API point of view both platforms are identical. The only difference between them is that the TWS has a much richer interface through which you can place orders, view charts, etc. The IB Gateway is just a proxy with a simple interface aimed at providing the most basic features in order to connect via the API.
More important though, the TWS requires to be restarted at least every 24 hours whereas the IB Gateway can run indefinitely.