Interactive Brokers Session Management

Interactive Brokers sessions have timeouts and require active maintenance. These endpoints initialize, validate, refresh, and manage session state so your integration stays connected.

Authentication

All requests require the Interactive Brokers bearer token, obtained from the Bearer Token API:

Authorization: Bearer <BEARER_TOKEN>

1. Initialize Session

POST https://api.ibkr.com/v1/api/iserver/auth/ssodh/init

Start a new session to establish connection and receive session tokens.

IBKR Documentation

2. Validate Session

GET https://api.ibkr.com/v1/api/sso/validate

Confirm session validity before executing trades.

IBKR Documentation

Status Codes: 200 session is valid, 401 session expired or invalid.

3. Authentication Status

GET https://api.ibkr.com/v1/api/iserver/auth/status

Check if you're authenticated, connected, and competitive (no other sessions).

IBKR Documentation

Response Fields:

FieldMeaning
`authenticated`User is authenticated
`connected`API connection established
`competing`Another session exists (conflicts)

4. Tickle (Keep-Alive)

GET https://api.ibkr.com/v1/api/tickle

Send a keep-alive signal to maintain the session.

IBKR Documentation

Keep-Alive Interval: Call every 60 seconds to maintain an active session. If no tickle is received for an extended period, the session times out.

5. Suppress Messages

POST https://api.ibkr.com/v1/api/iserver/questions/suppress

Suppress IBKR confirmation dialogs for specific order types, to avoid confirmation prompts during programmatic trading.

IBKR Documentation

Common Message IDs:

IDDescription
`o163`Order confirmation dialogs
`o354`Risk management warnings
`o382`Commission warnings
`p6`General confirmations

Session Maintenance Flow

1. Get Bearer Token
   └─> /user/bearer-token

2. Initialize Session
   └─> POST /v1/api/iserver/auth/ssodh/init

3. Verify Connected
   └─> GET /v1/api/iserver/auth/status

4. Suppress Messages
   └─> POST /v1/api/iserver/questions/suppress

5. Keep Alive (every 60 seconds)
   └─> GET /v1/api/tickle

6. Before Trading
   └─> GET /v1/api/sso/validate
   └─> GET /v1/api/iserver/auth/status

7. Place Orders / Check Status
   └─> POST /v1/api/iserver/account/{acctId}/orders/whatif
   └─> POST /v1/api/iserver/account/{acctId}/orders
   └─> GET /v1/api/iserver/account/order/status/{orderId}
Example

Usage Example

A SessionManager that initializes the session, keeps it alive on an interval, and exposes validation helpers:

javascript
const IBKR_BASE_PATH = "https://api.ibkr.com";

class SessionManager {
  constructor(bearerToken) {
    this.bearerToken = bearerToken;
    this.sessionId = null;
    this.keepAliveInterval = null;
  }

  async initializeSession() {
    const response = await fetch(
      `${IBKR_BASE_PATH}/v1/api/iserver/auth/ssodh/init`,
      {
        method: "POST",
        headers: {
          Authorization: `Bearer ${this.bearerToken}`,
          "Content-Type": "application/json",
          "User-Agent": "Your Application/1.0",
        },
        body: JSON.stringify({
          publish: true,
          compete: true,
        }),
      },
    );

    const data = await response.json();
    this.sessionId = data.sessionId;
    return data;
  }

  async validateSession() {
    const response = await fetch(`${IBKR_BASE_PATH}/v1/api/sso/validate`, {
      headers: {
        Authorization: `Bearer ${this.bearerToken}`,
        "User-Agent": "Your Application/1.0",
      },
    });

    return response.status === 200;
  }

  async tickleSession() {
    await fetch(`${IBKR_BASE_PATH}/v1/api/tickle`, {
      headers: {
        Authorization: `Bearer ${this.bearerToken}`,
        "User-Agent": "Your Application/1.0",
      },
    });
  }

  startKeepAlive() {
    this.keepAliveInterval = setInterval(
      () => this.tickleSession(),
      60 * 1000, // Every 60 seconds
    );
  }

  stopKeepAlive() {
    if (this.keepAliveInterval) {
      clearInterval(this.keepAliveInterval);
    }
  }
}

For a full working script that also handles authentication and trading, see the Complete Flow Example.

Best Practices

1. Validate Before Trading - Always check validateSession() before placing orders 2. Keep Alive - Call tickle every 60 seconds to prevent session timeout 3. Monitor Status - Regularly check auth status for competing sessions 4. Suppress Early - Suppress messages during session initialization 5. Handle Errors - Implement retry logic for failed session calls 6. Session Cleanup - Stop the keep-alive timer when done

Troubleshooting

IssueSolution
Session expiredRequest a new bearer token and reinitialize
Competing sessionAnother login exists; stop the other session
Validation failsTickle the session and retry
Messages not suppressedEnsure message IDs are correct

Request

Response

Was this page helpful?

PiTrade

PiTrade gives investors in over 190 countries access to the U.S. stock market through real, transparent portfolios you can build yourself or invest in Strategizer Portfolios. As an SEC-registered investment adviser, powered by Interactive Brokers, PiTrade makes investing more transparent and accessible.

This content is provided for informational purposes only and is not intended as and may not be relied on in any manner as investment advice, a recommendation of any interest in any security offered herein. All investments involve risk, including the possible loss of principal. Past performance does not guarantee future results, and investors should consider their own investment goals, risk tolerance, and financial situation before investing. The information contained herein is subject to change.

The platform "PiTrade" is operated by Pioneer Advisory LLC, a subsidiary of Pioneer Investing Inc. which holds ownership rights related hereto.

Advisory services are provided by Pioneer Advisory LLC, an SEC-registered investment adviser.

Brokerage and clearing services are provided by Interactive Brokers LLC, a SEC-registered broker-dealer, member FINRA/SIPC, to retail customers for US-listed, registered securities and ETFs on a self-directed basis.

The registrations and memberships above in no way imply that the SEC, FINRA, or SIPC has endorsed the entities, products or services discussed herein.

Interactive Brokers LLC is a registered Broker-Dealer, Futures Commission Merchant and Forex Dealer Member, regulated by the U.S. Securities and Exchange Commission (SEC), the Commodity Futures Trading Commission (CFTC) and the National Futures Association (NFA), and is a member of the Financial Industry Regulatory Authority (FINRA) and several other self-regulatory organizations. Interactive Brokers does not endorse or recommend any introducing brokers, third-party financial advisors or hedge funds, including Pioneer Advisory LLC. Interactive Brokers provides execution and clearing services to customers. None of the information contained herein constitutes a recommendation, offer, or solicitation of an offer by Interactive Brokers to buy, sell or hold any security, financial product or instrument or to engage in any specific investment strategy. Interactive Brokers makes no representation, and assumes no liability to the accuracy or completeness of the information provided on this website.

For more information regarding Interactive Brokers, please visit www.interactivebrokers.com

© 2026 Pioneer Investing Inc. All Rights Reserved.