Use a Personal API Key
Use this guide for scripts and tools that access your own brokerage accounts. A Personal API key represents your SnapTrade account directly. If you are building for other users, start with Choose Your Integration.
Get Your Credentials
- Create a Personal account in the SnapTrade Dashboard and verify your email.
- Enable two-factor authentication.
- Create a Personal API key on the API Key page.
- Store your
clientIdandconsumerKeysecurely. They grant access to your own account; do not distribute them to other apps.
If your brokerage is already connected in the Dashboard, skip generating a portal URL and go directly to listing accounts. Otherwise open the returned Connection Portal URL and complete the brokerage connection before continuing.
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 a trusted backend or, for your own Personal tools, in secure local storage.
Your Personal clientId and consumerKey identify your SnapTrade account. There is no separate SnapTrade end-user record to register or pass on account-data calls. Generate a Connection Portal URL, connect your brokerage account, then fetch account data directly.
TypeScript
If your brokerage is already connected in the Dashboard, skip this block. Otherwise, generate a portal URL and complete the connection in your browser.
Once your brokerage is connected through the Dashboard or Connection Portal, run the following code. Reuse your initialized SDK client.
Python
If your brokerage is already connected in the Dashboard, skip this block. Otherwise, generate a portal URL and complete the connection in your browser.
Once your brokerage is connected through the Dashboard or Connection Portal, run the following code. Reuse your initialized SDK client.
Credential Rules
- Use
SnaptradeAuth.personalApiKeyin TypeScript orSnapTradeAuth.personal_api_keyin Python. - Generate a Connection Portal URL and connect your brokerage account before fetching account data.
- Fetch account data directly after connection. Your Personal API Key identifies your SnapTrade account.
- Omit
userIdanduserSecreton account-data operations. - Do not call . User registration is for Commercial API-key integrations managing SnapTrade users for their own end users.
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.
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.
- To share your data with an AI assistant, see the SnapTrade MCP Server.