API Settings for TWS or Gateway to run API clients

API clients like MTIBBridge or the Trade Copier IB can only work with TWS or Gateway,  when TWS  or Gatway are prepared.


Attention: Please set TWS language always to english. This is important because API messages are always evaluated in english.

The green framed settings are important to connect API clients.

  • Enable ActiveX…: This opens a socket base connection  between TWS / Gateway and API client
  • Socket port:  This is the communication channel number. If you run multiple TWS on one machine, each TWS must expose a different number because
    the operating system can open such channel only once.
    This means also, that this number decides to which TWS / Gateway an API client is connecting to: depending on which port number is
    used for API connection.
  • Allow connections…: If enabled, only API clients running on same machine as TWS are accepted.  If you like to connect API from other machines.
    If not enabled, only clients from machines listed in the field below can connect.  If no trusted IP listed there, no API client can
    can connect.
    To add a trusted IP, so an address of machine from which you like to connect with an API client to this TWS / Gateway, click on
    Create and add this IP.
  • Master API client ID:  API clients connecting with this ID, get control over all orders, from all other API clients.

Please also check the Precautions (On the picture in the tree left) which are intended to protect your account.  When precautions are enabled, they can raise
dialogs which require user interaction and which can break unattended trading.

API Settings