Broker API integration development is not simply calling an endpoint for balances and trades. A dependable implementation combines customer consent, secure credentials, account and instrument mapping, resumable historical imports, event processing and routine reconciliation against the broker’s own records. That is the difference between a trading journal, analytics product, execution workflow or client portal that is merely connected and one that can explain the data it shows.
Start by separating market-data connectivity from brokerage connectivity. A market-data API normally supplies prices, bars, quotes and reference data. A broker API exposes customer-specific records: accounts, cash, positions, orders, executions, fees, transfers and status changes. The latter introduces consent, sensitive credentials, account-level permissions, delayed settlement activity and operational exceptions. Treating both as the same integration leads to weak security assumptions and unreliable product behaviour.
Define the broker integration boundary before selecting an API
Write the scope as user outcomes rather than “connect to Broker X.” For example: a user authorizes a read-only connection, selects two brokerage accounts, imports up to 24 months of transactions, sees open positions refreshed on a schedule, and receives newly reported executions quickly. If the product will submit or cancel orders, make that a separate capability with its own permissions, confirmations and incident procedures.
- Trading journal or analytics: import accounts, positions, transactions, fills, fees and cash activity without trading authority.
- Execution workflow: submit, amend or cancel instructions and monitor broker-reported outcomes.
- Client portal: display several linked accounts while enforcing user, adviser and operations roles.
- Operations console: surface failed syncs, mapping issues, reauthorization requests and reconciliation breaks.
This definition prevents a common procurement mistake: choosing a provider because it has a price feed or a simple order endpoint, then discovering that it cannot provide the account history, permission model, event stream or geography required by the actual product. POLADO’s FinTech & Trading Systems service can turn this scope into an integration architecture, delivery plan and test strategy; the portal layer can be delivered alongside it through Web Platforms & Applications.
Authentication, consent and token refresh are product features
Broker platforms use different access patterns: server-side API keys, OAuth authorization through the customer’s broker session, institutional onboarding, signed requests or IP allowlists. Confirm which one applies to the intended account types and jurisdictions before estimating the build. A sandbox that accepts a developer key does not prove that a production customer can grant the same access.
Where OAuth is available, use an authorization-code flow handled primarily on the server. Send the customer to the broker’s authorization page, bind the callback to the initiating user session, exchange the short-lived code on the backend, and retain tokens only in protected server-side storage. Exact registered redirect URIs, a transaction-bound state value and PKCE are important controls. Access or refresh tokens must not appear in URLs, browser local storage, mobile logs, error trackers or support screenshots.
A practical token operating model
- Encrypt refresh tokens at rest and restrict decryption to the sync service that actually needs them.
- Associate every token with a connection, internal user, provider, granted scopes and known broker accounts.
- When refresh-token rotation occurs, replace the stored token atomically; concurrent workers must not continue using the old value.
- Classify invalid-grant, expired-consent and revoked-access responses as a connection state requiring reauthorization, not as an endlessly retryable outage.
- Provide a disconnect action that revokes or invalidates access where supported and prevents further scheduled pulls.
For trading execution API development, apply least privilege rigorously. Do not request order authority for a journal or reporting feature. If trading permission is necessary, make the scope visible to the user, require an explicit pre-submit confirmation in the product flow, and preserve an auditable record of the request and broker response.
Normalize accounts, instruments and timestamps without losing source evidence
A broker account number, a display label and an internal account ID are not interchangeable. One customer may have retirement, cash, margin, sub-accounts or accounts in multiple base currencies. Maintain a canonical connection and account model that preserves the provider’s immutable identifier, account type, currency, ownership context and visibility status. Never use a masked display account number as the only key.
Instrument mapping needs equal care. A ticker is helpful for the interface, but it may not uniquely identify an option contract, future, foreign listing, crypto pair or renamed security. Keep the broker instrument identifier and material attributes such as asset class, venue, quote currency, contract multiplier and expiry where available. Mapping rules should be versioned and reviewable rather than embedded as one-off code paths.
For every imported object, record both the broker-reported effective time and the time your system observed it. Store normalized timestamps in UTC and retain the raw source value. This makes late events, backdated corrections, time-zone boundaries and user support investigations tractable.
Historical imports, pagination and rate limits need a controlled pipeline
The first sync is usually the most expensive operation. An account with years of activity may require pagination by cursor, page token, transaction ID or date window; the provider may also cap history or return records asynchronously. Confirm these behaviours before committing to a “full history” feature.
Build a resumable import pipeline. Persist a checkpoint only after each page has been durably stored and normalized. Make ingestion idempotent, so a retry cannot create duplicate transactions or executions. Keep a raw payload reference or protected archive alongside the normalized record; it is essential when a provider changes a field, corrects history or a user disputes a calculation.
Rate limiting should be designed as capacity management, not as exception handling. Track provider headers where supplied, budget calls across the whole integration rather than per browser session, and prioritize time-sensitive work over old backfills. On HTTP 429, honour Retry-After or the documented reset time when available, then use bounded exponential backoff with jitter. Do not let every worker retry simultaneously, and do not place real-time event recovery behind a large historical import queue.
A safe initial-sync sequence
- Retrieve accessible accounts and let the user select the accounts to include.
- Capture a current snapshot of cash, open positions and open orders.
- Import historical activity in small windows or pages, recording a durable continuation checkpoint.
- Deduplicate and normalize each record while retaining its source identifier and raw evidence.
- Compare the resulting state with the latest broker snapshot and create an exception when they do not agree.
Webhook and order event processing: fast notification is not the whole record
Brokerage providers may deliver order, execution, cancellation, rejection, account or non-trading-activity updates through WebSocket, server-sent events or webhooks. These streams are valuable because polling alone creates latency and unnecessary API load. But an event stream should be treated as a fast notification path, not as the sole source of truth. Connections break, providers retry deliveries, events may arrive late or out of order, and an execution can be corrected after the first message.
For webhook and order event processing, validate signatures and timestamps before accepting a delivery. Write the validated payload to durable storage or a queue quickly, return the acknowledgement promptly, and perform enrichment, mapping and downstream notifications asynchronously. A WebSocket consumer should track subscription health, reconnect deliberately and run a bounded catch-up query or lookback sync after a reconnect.
- Use the provider event ID as a unique key where one exists. Otherwise, define a documented deduplication key from provider, connection, source object, event type and version or time.
- Do not update an order merely because a message arrived last. Apply permitted state transitions and source-precedence rules.
- Keep correlation IDs, payload hashes, processing attempts and outcomes for operational auditability.
- Separate ingestion from presentation: an event may be received successfully while its account mapping or downstream calculation still needs review.
Reconciliation closes the gap between “received” and “correct”
An HTTP success response does not prove that the product has complete brokerage data. Reconciliation compares your stored state with a broker snapshot, activity feed or statement on a defined schedule. Depending on the product, compare cash, quantities, open orders, fills, commissions, transfers and other activities that affect displayed totals.
Do not silently overwrite mismatches. Categorize them as expected settlement timing, delayed provider history, unmapped instrument, probable missed event, duplicate source record or manual review. Show users the last successful sync time and a clear connection-health status. If data is incomplete, say so instead of presenting a precise-looking figure without context.
Questions to ask a broker API provider and delivery partner
- Which account types, asset classes, countries and legal entities are supported in production?
- What authentication, consent, client approval and production onboarding requirements apply?
- How are pagination, historical retention, corrections and rate limits documented?
- Which events are available, how are deliveries authenticated, and how does the client recover missed events?
- Are source IDs stable across restatements, partial fills, cancellations and corporate actions?
- Which snapshot, activity or statement endpoints support independent reconciliation?
- What is the provider’s sandbox fidelity for permissions, event delivery and edge cases?
- How will disconnection, token deletion, retention and support escalation work operationally?
POLADO can assess these questions before implementation and build the secure connector, import pipeline, event processor, exception console and reconciliation workflow around the answers. See the FinTech and analytics context of ESFX, or engage Technical Support & Consulting for an integration audit and delivery roadmap.