Answers

IB Gateway Daily Restart and the Sunday Login

With Auto restart set, IB Gateway and TWS restart daily without a login, Monday to Saturday. On Sunday, after the weekly reset, you log in again, per IBKR's API FAQ.

Checked Not affiliated with Interactive Brokers.

Set Auto Restart TimeWhereGlobal Configuration > Lock and ExitDoesRestarts, no login
Set Auto Log Off TimeWhereThe same pageDoesLogs off; you log in again
Never lock Trader WorkstationWhereThe same page, in TWSDoesNo lock that drops the API
Socket PortWhereGlobal Configuration > API > SettingsDoes4001 for Gateway, 4002 for paper

Restart outside IBKR's daily reset, 00:15 to 01:45 ET in North America. Logins can fail during it.

What still needs you

  • Sunday: IBKR invalidates tokens at 1:00 am ET; the next start asks for a login.
  • Another login with the same username, on Client Portal, TWS or IBKR Mobile.
  • The machine asleep, off or updating at restart time.
  • A failed update. IBKR says the offline versions restart best.
Running it unattended4 rows
Log in by hand on SundayState on 5 November 2026Supported by IBKRWhat to knowApprove it with IB Key on IBKR Mobile
A second username for the botState on 5 November 2026Free, in Account ManagementWhat to knowMarket data is billed per username
IBCState on 5 November 2026Archived on GitHub; last release 3.24.2, 21 August 2026What to knowTypes the login into Gateway or TWS; third party
ib-gateway-dockerState on 5 November 2026Maintained; IB Gateway 10.51.1e image, 27 October 2026What to knowGateway with IBC in Docker; third party

IBKR does not support headless operation and does not recommend third-party tools. Read the code of anything that types your password.

What your code sees5 rows
1100TWS messageConnectivity between IB and the TWS has been lost.DoWait; the daily reset or a competing session can cause it
1101TWS messageConnectivity between IB and TWS has been restored- data lost.DoSend your market data requests again
1102TWS messageConnectivity between IB and TWS has been restored- data maintained.DoNothing
502TWS messageCouldn't connect to TWS.DoGateway is not up yet, or the port is wrong
326TWS messageUnable to connect as the client id is already in use.DoUse another client ID

When the program itself restarts, connectionClosed fires. Reconnect on a timer until it is back.

Other things that end a run4 items
  • Saturday's reset, 00:00 to 02:00 ET.
  • A token IBKR revokes for security, rarely; the restart then asks for a login.
  • This message, which means the weekly login is due: Login failed = Soft token=0 received instead of expected permanent for zdc1.ibllc.com:4001 (SSL).
  • In TWS for IBHK accounts, no Never lock Trader Workstation or Auto restart. IBKR suggests IB Gateway, which does not lock and has Auto restart.
Second factors the API accepts2 items
  • IB Key, Handy Key, SMS and Digital Security Card+.
  • Not the Security Code Card, Temporary Security Code Card or Online Code Card.

Where Gloom fits

Gloom's IBKR Gateway plugin connects to the Gateway you keep running: Gateway / TWS in Brokers (BR).

Gloom's Brokers pane connecting Interactive Brokers in Gateway / TWS mode, with Connection Setup on Manual, Gateway Host 127.0.0.1 and a Gateway Port field for 4001, 4002, 7496 or 7497.
Captured in the Gloom terminal app, version 0.20.1.

Gloom covers

  • Finding it on 4001, 4002, 7496 or 7497.
  • Retrying every 2 seconds through a restart.
  • The IBKR Console (IBKR) and a Trade tab.

Gloom does not cover

  • Logging in to Gateway, Sunday included.
  • The browser version, which cannot reach a local Gateway.
  • Sources5 sources
  • Not verified3 claims
    • Which day the weekly login bites. IBKR's guide says Sunday 1:00 am ET; its API docs say the cycle starts Monday. Neither was tested here.
    • The menu path in IB Gateway. IBKR names Global Configuration > Lock and Exit for both programs; Gateway was not opened here.
    • A second daily drop at another fixed time, after the reset, reported in September 2026 (r/interactivebrokers). No cause was given.