Build With a Commercial API Key
Your backend creates a SnapTrade user for each end user and sends them through the Connection Portal. You own onboarding, user mapping, connection support, and credential storage. For apps using users’ existing SnapTrade Personal connections, consider OAuth.
Get Your Credentials
- Create a Commercial account in the SnapTrade Dashboard.
- Verify your email.
- Enable two-factor authentication.
- Create a test API key from the API Key page.
- Store the
clientIdandconsumerKeyon a secure backend.
Connect and Read Account Data
Open the portal URL in a browser, complete the connection, then resume the account-data calls. Keep API credentials on your backend. Use a stable, immutable user ID from your app; avoid email addresses.
Use Commercial API Key authentication when your backend manages brokerage connections for your own end users.
The Commercial workflow is:
- Initialize the SDK with Commercial
clientIdandconsumerKey. - Register one SnapTrade user per end user with .
- Store the returned
userIdanduserSecretfor that SnapTrade user. - Generate a Connection Portal URL with and have the user connect a brokerage account.
- After the account is connected, fetch that user's account data by passing
userIdanduserSecretto user-scoped operations.
TypeScript
After the user completes the Connection Portal, run the following code. Reuse your initialized SDK client and the user's stored credentials.
Python
After the user completes the Connection Portal, run the following code. Reuse your initialized SDK client and the user's stored credentials.
Credential Rules
- Use
SnaptradeAuth.commercialApiKeyin TypeScript orSnapTradeAuth.commercial_api_keyin Python. - Register or otherwise obtain a SnapTrade user's
userIdanduserSecretbefore fetching that user's account data. - Pass
userIdanduserSecreton user-scoped operations such as listing accounts, balances, positions, orders, holdings, activities, and connections. - Keep the
consumerKeyand each user'suserSecreton a secure backend. Do not expose them in browser or mobile clients.
Accounts and Trading
After connection, list accounts with . Its results list can contain multiple account kinds; choose an investment account before retrieving positions with . Balances and orders are available through and .
For trading, create the connection with connectionType / connection_type set to trade-if-available. The default read connection type only supports data access. Trading also depends on the key, brokerage, connection, and account capabilities. Build the order with the account ID and brokerage ticker, show the user its details and impact, obtain confirmation, then use . See Trading with SnapTrade for order types and supported assets.
Go to Production
When you are ready for production, complete the Production Access Application and required billing setup, then create a production key.
For plan limits and production requirements, see Billing.
Requests and Next Steps
The SDK signs API-key requests for you. For direct HTTP, follow Request Signatures. See General Errors for authentication and other request failures.
- Configure the Connection Portal.
- Read Account Data and manage Connections.
- Configure Webhooks.
- Prepare for production with Launching Your Application and the Broker Access Guide.