Bearer Token API

This endpoint exchanges your PiTrade JWT token for an Interactive Brokers bearer token, which is required for all Interactive Brokers API requests.

Endpoint

POST https://api.pitrade.com/partner/brokerage-bearer-token

Authentication

Requires Bearer token authentication with your PiTrade JWT token:

Authorization: Bearer <PITRADE_JWT_TOKEN>

Request

Headers

Content-Type: application/json
Authorization: Bearer <PITRADE_JWT_TOKEN>
User-Agent: Your Application/1.0

Body

ParameterTypeRequiredDescription
ipstringYesClient IP address (IPv4) for the brokerage session

Example

curl -X POST https://api.pitrade.com/partner/brokerage-bearer-token \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "User-Agent: Your Application/1.0" \
  -d '{
    "ip": "<USE_IP>"
  }'

Response

Success (200 OK)

{
  "bearerToken": "U4472-1c88d8c0-9912-4355-9ab5-d2c62ebb3e7e"
}

Error Responses

400 Bad Request

{
  "message": "Missing required field: ip"
}

401 Unauthorized

{
  "message": "Invalid or expired JWT token"
}

500 Internal Server Error

{
  "message": "Failed to generate bearer token"
}

Usage

Step 1: Generate PiTrade JWT

const jwt = require("jsonwebtoken");

const token = jwt.sign(
  {
    clientId: "<YOUR_CLIENT_ID>",
    iat: Math.floor(Date.now() / 1000),
    exp: Math.floor(Date.now() / 1000) + 900, // 15 minutes
  },
  "<YOUR_API_KEY>",
);

Step 2: Request Bearer Token

const response = await fetch(
  "https://api.pitrade.com/partner/brokerage-bearer-token",
  {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      Authorization: `Bearer ${token}`,
      "User-Agent": "Your Application/1.0",
    },
    body: JSON.stringify({
      ip: "YOUR_CLIENT_IP",
    }),
  },
);

const { bearerToken } = await response.json();

Step 3: Use Bearer Token for Interactive Brokers APIs

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

// Now use bearerToken for Interactive Brokers API calls
const ibkrResponse = await fetch(
  `${IBKR_BASE_PATH}/v1/api/iserver/auth/status`,
  {
    headers: {
      Authorization: `Bearer ${bearerToken}`,
      "User-Agent": "Your Application/1.0",
    },
  },
);

Important Notes

  • Bearer tokens are scoped to the IP address provided in the request
  • Requests from different IP addresses require new bearer tokens
  • JWT tokens expire in 15 minutes; request a new bearer token when needed
  • Store bearer tokens securely; do not expose them in client-side code
  • One bearer token per session; creating a new token invalidates previous tokens

Next Steps

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.