Understanding Brokerage Sessions
All resources behind /iserver are accessible only with an active “brokerage” session. Some additional info:
- TWS being a trading platform requires that a username has trading permissions in order for it to be used to access TWS – there is no purely “read-only” TWS access
- The Client Portal website, on the other hand, contains all of the reporting and account management functionality, and consequently it is possible to log in to Client Portal with a read-only/no-trading-permissions username and access reports, portfolio info, etc.
- Iserver is effectively TWS running on IB infrastructure, and it serves all of the trading-permissions-required resources, hence the need for a brokerage session to access those endpoints
- As a result of #2 and #3, the CP Web API also has this two-tiered session arrangement: The first tier is the read-only Portal session, and the second tier is the brokerage session through which you can talk to /iserver and actually trade the account(s), etc.
- After logging in with OAuth without competing sessions, you will have a Portal session and can visit non-iserver resources. The additional /iserver/auth/ssodh/init endpoint is used to subsequently reopen a brokerage session with our backend, through which you can access the protected /iserver endpoints.
- The Client Portal Gateway will automatically initialize the brokerage session.
- The brokerage session is associated with the credentials in use – your username – so you don’t need to select an account here. Rather, once you have access to a brokerage session, you can manipulate all accounts visible/accessible to the username in use.
- Non-iserver endpoints like /portfolio are served by different backend processes that do not require trading permissions and are accessible without a brokerage session

