Skip to content

Connect a Brokerage

This is how users connect their existing brokerage accounts so they can place trades on your platform.

How It Works

  1. Your server uses the user's Trade It token to request a connect session URL.
  2. Your client-side app passes that URL into the React SDK.
  3. The user selects a brokerage, authorizes it, and returns to your platform flow.

Server-side: Request a Connect Session URL

Call Trade It's API server-side to get a url to the connection portal. The URL is pre-authenticated so the user does not need to log in.

Request

http
POST <api endpoint>/api/session/url
Content-Type: application/json
Authorization: Bearer <user's trade it access token>

{
  "target": "connect",
  // "brokerageId": 1 (Optional)
}

Response

json
{
  "url": "https://tradeit.app/connect?token=ti:...&embedded=1",
  "expiresAt": "2026-02-27T19:35:12.000Z",
  "feature": "connect"
}

Client-side: Open the Connection Modal

tsx
import { TradeItModal, useTradeIt } from '@trade-it/react';

function ConnectBrokerageButton() {
  const tradeIt = useTradeIt();

  async function openConnect() {
    const res = await fetch('/your-server/tradeit/connect');
    const data = await res.json();

    tradeIt.openConnect({
      launch: {
        mode: 'connect',
        url: data.url,
      },
    });
  }

  return (
    <>
      <button onClick={openConnect}>Connect a Brokerage</button>
      {tradeIt.modalProps && <TradeItModal {...tradeIt.modalProps} />}
    </>
  );
}

Connection Flow

This is the experience your users see inside your platform when they connect a brokerage.

Step 1: Select a Brokerage

Trade It opens a brokerage picker inside your site. Users choose from supported brokerages, and existing/expired connections are labeled clearly.

Brokerage selection screen inside the Trade It connect modal
Step 1: Select a brokerage. Existing and expired connections are marked for clarity.

Step 2: Complete Brokerage Authentication

After selection, Trade It starts that brokerage's auth flow. Depending on brokerage behavior, users may be redirected to an auth tab/window while the modal tracks progress.

Start connection step in the Trade It connect modal
Step 2A: Trade It confirms the brokerage and starts authentication.
Connection in progress state in the Trade It connect modalBrokerage authentication screen example during connection
Step 2B: Trade It tracks progress and resumes automatically after brokerage auth completes.

Step 3: Return to Your Platform

After success, Trade It confirms completion and hands control back to your client-side flow so users can move directly into trading.

Successful brokerage connection confirmation screen
Step 3: Connection is complete and the user is ready to trade.