Skip to content

Schwab API

Schwab API is an OAuth 2.0 custodian integration that provides direct access to Charles Schwab advisor accounts. This integration syncs investment accounts, positions, balances, and cost basis data from Schwab’s official Financial Advisor API.

AttributeValue
Integration TypeCustodian (API-based)
AuthenticationOAuth 2.0 with OpenID Connect
Data FlowSchwab → RightCapital (inbound only)
Scopereadonly
OwnerYan Hu
EntityDescription
Master AccountsFinancial Advisor master accounts
AccountsIndividual investment accounts under master accounts
PositionsCurrent holdings with symbol, quantity, price, market value
BalancesTotal account balance including cash
Cost BasisUnrealized gain/loss position data

The integration uses OAuth 2.0 Authorization Code flow with PKCE and HTTP Basic Auth for token exchange.

The integration uses ThreadSafeOAuthTokenManager for handling token refresh race conditions:

  • Token Refresh Before Expiry: Tokens are refreshed 10 seconds before expiration
  • Redis Locking: Prevents multiple concurrent jobs from refreshing simultaneously
  • 5-Minute Cache: Refreshed tokens cached in Redis for reuse
  • Transaction Safety: Stashes credentials for recovery if database transaction rolls back
EndpointRate Limit
Accounts120 req/min
Positions120 req/min
Balances120 req/min
Cost Basis120 req/min
Transactions60 req/min
Schwab TypeRightCapital Subtype
HSA Custodial, HSA Master, HSBAHSA
403(b)7, I401(k), Rtmt Plan Srvc401k
Contrib, Rollover, Custodial Ira, Inh IRATraditional IRA
Roth Contrib, Roth ConversionRoth IRA
Simple Ira, Simple Ira PlanSIMPLE IRA
Sep, SarsepSEP IRA
Educ Savings529
Liv Trust, Fid Trust, Test TrustTrust
Schwab ChartbleDonor
Pen Trust, PEN ADMPension (Taxable)
(Most others)Taxable

The full mapping includes 70+ account types.

EndpointPurpose
master-accountsList FA master accounts
accountsList accounts under a master account
account-owners/listGet account details for specific references
positions/detailGet position data for an account
balances/detailGet balance for an account
cost-basis/ugl-positionsGet unrealized gain/loss (cost basis)
ComponentPath
Connectorretail-api/app/Integrations/SchwabApi/Connector.php
Integratorretail-api/app/Integrations/SchwabApi/Integrator.php
Controllerretail-api/app/Integrations/SchwabApi/Controller.php
Configretail-api/app/Integrations/SchwabApi/Config.php
Syncretail-api/app/Integrations/SchwabApi/Sync.php
Modelsretail-api/app/Integrations/SchwabApi/Models/
Token Managerretail-api/app/Integrations/Support/LegacyApiBased/Connectors/ThreadSafeOAuthTokenManager.php

Symptom: Multiple concurrent sync jobs fail with authentication errors.

Solution: The integration uses ThreadSafeOAuthTokenManager with Redis locking.

Symptom: Error about not accepting Schwab Cost Basis Terms & Conditions.

Solution: Advisor must log into Schwab Advisor Center and accept the Cost Basis Terms & Conditions.

Symptom: Some accounts fail to sync with 401 errors.

Solution: Account was closed, transferred, or authorization was revoked. The advisor may need to reconnect.

  • Orion - Similar investment account integration