snaptrade-typescript-sdk
v12.2.11
Published
Client for SnapTrade
Readme
SnapTrade
Connect brokerage accounts to your app for live positions and trading.
Rate limiting
Two limits apply to requests signed with your clientId. The stricter one
wins, and exceeding either returns 429 Too Many Requests.
- Customer-level — 250 requests/minute by default, scoped to your
clientIdand applied across all endpoints. Reported inX-RateLimit-Limit,X-RateLimit-RemainingandX-RateLimit-Reset. - Account-level — 10 requests/minute per account, scoped to
(
clientId,accountId). All covered operations for one account draw on the same bucket — reading balances and reading positions share it — and enforcement does not depend on the HTTP method, so updating an account consumes the same bucket as reading it. Only enforced for Personal users, and only for integrations it has been rolled out to — it is not yet in force for every Personal integration. It also does not apply on every operation that documents a 429 below. Where it applies it is reported inX-RateLimit-Account-Limit,X-RateLimit-Account-RemainingandX-RateLimit-Account-Reset. Do not read the absence of those headers as proof the limit is off — some configurations omit the rate limit headers while still enforcing the limit, so header absence tells you nothing about your allowance.
On a 429, X-RateLimit-Remaining: 0 means you hit the customer-level limit
and X-RateLimit-Account-Remaining: 0 means the account-level one. Wait for
the corresponding *-Reset value (seconds) before retrying, or fall back to
exponential backoff with jitter.
Not every 429 is explained by those headers. A separate
per-authenticated-user limit, reported in no X-RateLimit-* header, covers
OAuth-authenticated requests and signed requests in configurations where the
customer-level limit is not in effect — on the operations that use the
default throttles. A few operations override those and are governed by the
customer-level limit alone. The two do not stack: a signed request
governed by the customer-level limit above is not additionally subject to the
per-user one. If a 429 arrives with no header at zero — or with no
X-RateLimit-* headers at all — honour Retry-After and back off. Treat the
remaining counts as a hint, not a guarantee that the next request will
succeed.
Because the customer-level limit applies everywhere, any signed request can return 429.
OAuth-authenticated requests are an exception. They are not subject to
the customer-level limit and do not receive X-RateLimit-Limit,
X-RateLimit-Remaining or X-RateLimit-Reset — do not wait on those headers
or design around a customer-level allowance on this path. The account-level
limit still applies to them on the account-data endpoints above, reported in
the X-RateLimit-Account-* headers. On operations using the default
throttles the per-user limit above applies to them as well, so an OAuth
request can be rejected while the account headers still show capacity; on
the few operations that override those throttles, OAuth callers have no
per-user ceiling at all. Drive retries from Retry-After and exponential
backoff with jitter rather than from the headers.
See https://docs.snaptrade.com/docs/ratelimiting.
Table of Contents
- Installation
- Authentication
- Getting Started
- Reference
snaptrade.accountInformation.getAccountActivitiessnaptrade.accountInformation.getAccountBalanceHistorysnaptrade.accountInformation.getAllAccountPositionssnaptrade.accountInformation.getUserAccountBalancesnaptrade.accountInformation.getUserAccountDetailssnaptrade.accountInformation.getUserAccountOrderDetailsnaptrade.accountInformation.getUserAccountOrderssnaptrade.accountInformation.getUserAccountRecentOrderssnaptrade.accountInformation.getUserAccountReturnRatessnaptrade.accountInformation.getUserHoldingssnaptrade.accountInformation.listUserAccountssnaptrade.accountInformation.updateUserAccountsnaptrade.apiStatus.checksnaptrade.authentication.deleteSnapTradeUsersnaptrade.authentication.listSnapTradeUserssnaptrade.authentication.loginSnapTradeUsersnaptrade.authentication.registerSnapTradeUsersnaptrade.authentication.resetSnapTradeUserSecretsnaptrade.connections.deleteConnectionsnaptrade.connections.detailBrokerageAuthorizationsnaptrade.connections.disableBrokerageAuthorizationsnaptrade.connections.listBrokerageAuthorizationAccountssnaptrade.connections.listBrokerageAuthorizationssnaptrade.connections.listConnectionAccountssnaptrade.connections.refreshBrokerageAuthorizationsnaptrade.connections.returnRatessnaptrade.connections.syncBrokerageAuthorizationTransactionssnaptrade.experimentalEndpoints.addSubscriptionsnaptrade.experimentalEndpoints.cancelSubscriptionsnaptrade.experimentalEndpoints.getUserAccountOrderDetailV2snaptrade.experimentalEndpoints.getUserAccountOrdersV2snaptrade.experimentalEndpoints.getUserAccountRecentOrdersV2snaptrade.experimentalEndpoints.listSubscriptionssnaptrade.referenceData.getPartnerInfosnaptrade.referenceData.getStockExchangessnaptrade.referenceData.getSymbolssnaptrade.referenceData.getSymbolsByTickersnaptrade.referenceData.listAllBrokerageAuthorizationTypesnaptrade.referenceData.listAllBrokerageInstrumentssnaptrade.referenceData.listAllBrokeragessnaptrade.referenceData.symbolSearchUserAccountsnaptrade.trading.cancelOrdersnaptrade.trading.getCryptocurrencyPairQuotesnaptrade.trading.getOptionImpactsnaptrade.trading.getOrderImpactsnaptrade.trading.getUserAccountOptionQuotessnaptrade.trading.getUserAccountQuotessnaptrade.trading.placeComplexOrdersnaptrade.trading.placeCryptoOrdersnaptrade.trading.placeForceOrdersnaptrade.trading.placeMlegOrdersnaptrade.trading.placeOrdersnaptrade.trading.previewCryptoOrdersnaptrade.trading.replaceOrdersnaptrade.trading.searchCryptocurrencyPairInstruments
Installation
npm i snaptrade-typescript-sdkpnpm i snaptrade-typescript-sdkyarn add snaptrade-typescript-sdkAuthentication
Choose the authentication mode that matches your credentials, then use its client in the reference examples.
Commercial API Key Auth authentication
Use commercial authentication when acting on behalf of your application and passing end-user credentials with requests that require them.
import { Snaptrade, SnaptradeAuth } from "snaptrade-typescript-sdk";
const commercialApiKeyClient = new Snaptrade({
auth: SnaptradeAuth.commercialApiKey({
consumerKey: "CONSUMER_KEY",
clientId: "CLIENT_ID",
}),
});Personal API Key Auth authentication
Use personal authentication when the API key belongs to a single user and user credentials are not passed per request.
import { Snaptrade, SnaptradeAuth } from "snaptrade-typescript-sdk";
const personalApiKeyClient = new Snaptrade({
auth: SnaptradeAuth.personalApiKey({
consumerKey: "CONSUMER_KEY",
clientId: "CLIENT_ID",
}),
});Getting Started
// Commercial API key example: registers a SnapTrade user and uses userId/userSecret.
const { Snaptrade, SnaptradeAuth } = require("snaptrade-typescript-sdk");
const { randomUUID } = require("crypto");
const readline = require("readline");
async function main() {
// 1) Initialize a client with your clientID and consumerKey.
const snaptrade = new Snaptrade({
auth: SnaptradeAuth.commercialApiKey({
consumerKey: process.env.SNAPTRADE_CONSUMER_KEY,
clientId: process.env.SNAPTRADE_CLIENT_ID,
}),
});
// 2) Check that the client is able to make a request to the API server.
const status = await snaptrade.apiStatus.check();
console.log("status:", status.data);
// 3) Create a new user on SnapTrade
const userId = randomUUID();
const registerResponse = (
await snaptrade.authentication.registerSnapTradeUser({
userId,
})
).data;
console.log("registerResponse:", registerResponse);
// Note: A user secret is only generated once. It's required to access
// resources for certain endpoints.
const userSecret = registerResponse.userSecret;
// 4) Get a redirect URI. Users will need this to connect
// their brokerage to the SnapTrade server.
const redirectURI = (
await snaptrade.authentication.loginSnapTradeUser({ userId, userSecret })
).data;
console.log("redirectURI:", redirectURI);
await waitForEnter(
"Open the link in your browser. When done logging in, press Enter to continue..."
);
// 5) Get a list of connections
const connections = (
await snaptrade.connections.listBrokerageAuthorizations({
userId,
userSecret,
})
).data;
console.log("connections:", connections);
// 6) Get a list of accounts for the first connection, if available
if (!Array.isArray(connections) || connections.length === 0) {
console.log("No brokerage connections found for the user.");
} else {
const accounts = (
await snaptrade.connections.listBrokerageAuthorizationAccounts({
authorizationId: connections[0].id,
userId,
userSecret,
})
).data;
console.log("accounts:", accounts);
}
// 6) Deleting a user
const deleteResponse = (
await snaptrade.authentication.deleteSnapTradeUser({ userId })
).data;
console.log("deleteResponse:", deleteResponse);
}
function waitForEnter(prompt) {
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
return new Promise((resolve) => {
rl.question(prompt, () => {
rl.close();
resolve();
});
});
}
main();Reference
snaptrade.accountInformation.getAccountActivities
This endpoint is not deprecated and has no planned sunset. Responses to requests using the legacy /api/v1 path prefix include Deprecation: @1781222400 (June 12, 2026); that header applies only to the path prefix. Use the canonical root path /accounts/{accountId}/activities.
Returns all historical transactions for the specified account.
This endpoint is paginated with a default page size of 1000. The endpoint will return a maximum of 1000 transactions per request. See the query parameters for pagination options.
Transaction are returned in reverse chronological order, using the trade_date field.
This endpoint returns Daily data. Daily data is cached and refreshed once a day. Exact refresh timing may vary by brokerage.
If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see this guide on how to fix a disabled connection.
🛠️ Usage
Commercial API Key Auth
const getAccountActivitiesResponse =
await commercialApiKeyClient.accountInformation.getAccountActivities({
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
startDate: "2022-01-24T00:00:00.000Z",
endDate: "2022-01-24T00:00:00.000Z",
offset: 0,
limit: 1,
type: "BUY,SELL,DIVIDEND",
userId: "snaptrade-user-123",
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
});Required credentials for this mode:
userId(string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.userSecret(string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the rotate user secret endpoint.
Personal API Key Auth
const getAccountActivitiesResponse =
await personalApiKeyClient.accountInformation.getAccountActivities({
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
startDate: "2022-01-24T00:00:00.000Z",
endDate: "2022-01-24T00:00:00.000Z",
offset: 0,
limit: 1,
type: "BUY,SELL,DIVIDEND",
});The client identifies the user in this mode. Do not pass userId userSecret to this method.
⚙️ Parameters
accountId: string
startDate: string | Date
The start date (inclusive) of the transaction history to retrieve. If not provided, the default is the first transaction known to SnapTrade based on trade_date.
endDate: string | Date
The end date (inclusive) of the transaction history to retrieve. If not provided, the default is the last transaction known to SnapTrade based on trade_date.
offset: number
An integer that specifies the starting point of the paginated results. Default is 0.
limit: number
An integer that specifies the maximum number of transactions to return. Default of 1000.
type: string
Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - BUY - Asset bought. - SELL - Asset sold. - DIVIDEND - Dividend payout. - SUBSTITUTE_DIVIDEND - Payment in lieu of a dividend. - CONTRIBUTION - Cash contribution. - WITHDRAWAL - Cash withdrawal. - REI - Dividend reinvestment. - STOCK_DIVIDEND - A type of dividend where a company distributes shares instead of cash - INTEREST - Interest deposited into the account. - FEE - Fee withdrawn from the account. - TAX - A tax related fee. - OPTIONEXPIRATION - Option expiration event. - OPTIONASSIGNMENT - Option assignment event. - OPTIONEXERCISE - Option exercise event. - TRANSFER - Transfer of assets from one account to another. - SPLIT - A stock share split.
🔄 Return
🌐 Endpoint
/accounts/{accountId}/activities GET
snaptrade.accountInformation.getAccountBalanceHistory
An experimental endpoint that returns estimated historical total account value for the specified account. Total account value is the sum of the market value of all positions and cash in the account at a given time. This endpoint is experimental, disabled by default, and has a maximum lookback of 1 year. Because the data is dynamically generated, we recommend replacing your dataset with each request as opposed to combining data from multiple requests. Enable this feature for free in the Add-on section of the Customer Dashboard billing page
🛠️ Usage
Commercial API Key Auth
const getAccountBalanceHistoryResponse =
await commercialApiKeyClient.accountInformation.getAccountBalanceHistory({
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
userId: "snaptrade-user-123",
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
});Required credentials for this mode:
userId(string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.userSecret(string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the rotate user secret endpoint.
Personal API Key Auth
const getAccountBalanceHistoryResponse =
await personalApiKeyClient.accountInformation.getAccountBalanceHistory({
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
});The client identifies the user in this mode. Do not pass userId userSecret to this method.
⚙️ Parameters
accountId: string
🔄 Return
🌐 Endpoint
/accounts/{accountId}/balanceHistory GET
snaptrade.accountInformation.getAllAccountPositions
Returns a list of all positions in the specified account.
The results list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, bonds, crypto, futures, option positions, future option positions, CFD positions, and tokenized asset positions. Use the instrument.kind discriminator to determine the schema for each position's instrument.
Beta: future option positions (instrument.kind: future_option) are in beta. They are currently returned only for tastytrade and Interactive Brokers connections, and only for partners they have been enabled for — please contact the SnapTrade team to enable them. The FutureOptionInstrument schema may change.
Positions counted in account cash balance or buying power include cash_equivalent: true. stock, adr, etf, mutualfund, and crypto positions may include tax_lots when tax lot data is enabled for the account. To see which institutions support tax lot data, please see our supported institutions doc.
If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see this guide on how to fix a disabled connection.
🛠️ Usage
Commercial API Key Auth
const getAllAccountPositionsResponse =
await commercialApiKeyClient.accountInformation.getAllAccountPositions({
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
userId: "snaptrade-user-123",
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
});Required credentials for this mode:
userId(string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.userSecret(string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the rotate user secret endpoint.
Personal API Key Auth
const getAllAccountPositionsResponse =
await personalApiKeyClient.accountInformation.getAllAccountPositions({
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
});The client identifies the user in this mode. Do not pass userId userSecret to this method.
⚙️ Parameters
accountId: string
🔄 Return
🌐 Endpoint
/accounts/{accountId}/positions/all GET
snaptrade.accountInformation.getUserAccountBalance
Returns a list of balances for the account. Each element of the list has a distinct currency. Some brokerages like Questrade allows holding multiple currencies in the same account.
Check your API key on the Customer Dashboard billing page to see if you have real-time data access:
- If you do, this endpoint returns real-time data.
- If you don't, Daily data is cached and refreshed once a day. Exact refresh timing may vary by brokerage. If you need real-time, use the manual refresh endpoint.
If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see this guide on how to fix a disabled connection.
🛠️ Usage
Commercial API Key Auth
const getUserAccountBalanceResponse =
await commercialApiKeyClient.accountInformation.getUserAccountBalance({
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
userId: "snaptrade-user-123",
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
});Required credentials for this mode:
userId(string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.userSecret(string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the rotate user secret endpoint.
Personal API Key Auth
const getUserAccountBalanceResponse =
await personalApiKeyClient.accountInformation.getUserAccountBalance({
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
});The client identifies the user in this mode. Do not pass userId userSecret to this method.
⚙️ Parameters
accountId: string
🔄 Return
🌐 Endpoint
/accounts/{accountId}/balances GET
snaptrade.accountInformation.getUserAccountDetails
Returns account detail known to SnapTrade for the specified account.
Check your API key on the Customer Dashboard billing page to see if you have real-time data access:
- If you do, this endpoint returns real-time data.
- If you don't, Daily data is cached and refreshed once a day. Exact refresh timing may vary by brokerage. If you need real-time, use the manual refresh endpoint.
If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see this guide on how to fix a disabled connection.
🛠️ Usage
Commercial API Key Auth
const getUserAccountDetailsResponse =
await commercialApiKeyClient.accountInformation.getUserAccountDetails({
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
userId: "snaptrade-user-123",
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
});Required credentials for this mode:
userId(string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.userSecret(string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the rotate user secret endpoint.
Personal API Key Auth
const getUserAccountDetailsResponse =
await personalApiKeyClient.accountInformation.getUserAccountDetails({
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
});The client identifies the user in this mode. Do not pass userId userSecret to this method.
⚙️ Parameters
accountId: string
🔄 Return
🌐 Endpoint
/accounts/{accountId} GET
snaptrade.accountInformation.getUserAccountOrderDetail
Returns the detail of a single order using the external order ID provided in the request body.
This endpoint only works for single-leg orders at this time. Support for multi-leg orders will be added in the future.
This endpoint is always realtime and does not rely on cached data.
This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
🛠️ Usage
Commercial API Key Auth
const getUserAccountOrderDetailResponse =
await commercialApiKeyClient.accountInformation.getUserAccountOrderDetail({
brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
userId: "snaptrade-user-123",
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
});Required credentials for this mode:
userId(string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.userSecret(string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the rotate user secret endpoint.
Personal API Key Auth
const getUserAccountOrderDetailResponse =
await personalApiKeyClient.accountInformation.getUserAccountOrderDetail({
brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
});The client identifies the user in this mode. Do not pass userId userSecret to this method.
⚙️ Parameters
brokerage_order_id: string
Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
accountId: string
🔄 Return
🌐 Endpoint
/accounts/{accountId}/orders/details POST
snaptrade.accountInformation.getUserAccountOrders
Returns a list of recent orders in the specified account.
Check your API key on the Customer Dashboard billing page to see if you have real-time data access:
- If you do, this endpoint returns real-time data.
- If you don't, Daily data is cached and refreshed once a day. Exact refresh timing may vary by brokerage. If you need real-time, use the manual refresh endpoint.
If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see this guide on how to fix a disabled connection.
🛠️ Usage
Commercial API Key Auth
const getUserAccountOrdersResponse =
await commercialApiKeyClient.accountInformation.getUserAccountOrders({
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
state: "all",
days: 30,
userId: "snaptrade-user-123",
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
});Required credentials for this mode:
userId(string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.userSecret(string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the rotate user secret endpoint.
Personal API Key Auth
const getUserAccountOrdersResponse =
await personalApiKeyClient.accountInformation.getUserAccountOrders({
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
state: "all",
days: 30,
});The client identifies the user in this mode. Do not pass userId userSecret to this method.
⚙️ Parameters
accountId: string
state: 'all' | 'open' | 'executed'
defaults to "all"
days: number
Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. Values greater than 90 will be capped at 90.
🔄 Return
🌐 Endpoint
/accounts/{accountId}/orders GET
snaptrade.accountInformation.getUserAccountRecentOrders
A lightweight endpoint that returns the latest page of orders placed in the last 24 hours in the specified account. For most brokerages, the default page size is 100 meaning the endpoint will return a max of 100 orders. This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution, or check status of recently placed orders Differs from /orders in that it is always realtime, and only checks the last 24 hours By default only returns executed orders, but that can be changed by setting only_executed to false
🛠️ Usage
Commercial API Key Auth
const getUserAccountRecentOrdersResponse =
await commercialApiKeyClient.accountInformation.getUserAccountRecentOrders({
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
onlyExecuted: true,
userId: "snaptrade-user-123",
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
});Required credentials for this mode:
userId(string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.userSecret(string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the rotate user secret endpoint.
Personal API Key Auth
const getUserAccountRecentOrdersResponse =
await personalApiKeyClient.accountInformation.getUserAccountRecentOrders({
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
onlyExecuted: true,
});The client identifies the user in this mode. Do not pass userId userSecret to this method.
⚙️ Parameters
accountId: string
onlyExecuted: boolean
Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well
🔄 Return
🌐 Endpoint
/accounts/{accountId}/recentOrders GET
snaptrade.accountInformation.getUserAccountReturnRates
Returns a list of rate of return percents for a given account.
🛠️ Usage
Commercial API Key Auth
const getUserAccountReturnRatesResponse =
await commercialApiKeyClient.accountInformation.getUserAccountReturnRates({
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
timeframes: "ALL,1Y",
userId: "snaptrade-user-123",
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
});Required credentials for this mode:
userId(string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.userSecret(string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the rotate user secret endpoint.
Personal API Key Auth
const getUserAccountReturnRatesResponse =
await personalApiKeyClient.accountInformation.getUserAccountReturnRates({
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
timeframes: "ALL,1Y",
});The client identifies the user in this mode. Do not pass userId userSecret to this method.
⚙️ Parameters
accountId: string
timeframes: string
Optional comma separated list of rate-of-return timeframes to return. Supported values are ALL, 1Y, YTD, 1M, 1W, and 1D. If omitted, SnapTrade returns all six supported timeframes.
🔄 Return
🌐 Endpoint
/accounts/{accountId}/returnRates GET
snaptrade.accountInformation.getUserHoldings
Deprecated. Use the finer-grained account data endpoints instead: balances, positions, and orders.
This endpoint will return HTTP 410 Gone for all customers that sign up after May 11, 2026.
Returns a list of balances, positions, and recent orders for the specified account.
Check your API key on the Customer Dashboard billing page to see if you have real-time data access:
- If you do, this endpoint returns real-time data.
- If you don't, Daily data is cached and refreshed once a day. Exact refresh timing may vary by brokerage. If you need real-time, use the manual refresh endpoint.
If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see this guide on how to fix a disabled connection.
🛠️ Usage
Commercial API Key Auth
const getUserHoldingsResponse =
await commercialApiKeyClient.accountInformation.getUserHoldings({
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
userId: "snaptrade-user-123",
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
});Required credentials for this mode:
userId(string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.userSecret(string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the rotate user secret endpoint.
Personal API Key Auth
const getUserHoldingsResponse =
await personalApiKeyClient.accountInformation.getUserHoldings({
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
});The client identifies the user in this mode. Do not pass userId userSecret to this method.
⚙️ Parameters
accountId: string
🔄 Return
🌐 Endpoint
/accounts/{accountId}/holdings GET
snaptrade.accountInformation.listUserAccounts
Returns all brokerage accounts across all connections known to SnapTrade for the authenticated user.
This endpoint returns Daily data regardless of the customer's plan. Daily data is cached and refreshed once a day, which makes this endpoint fast and well-suited to listing accounts across all of a user's connections in a single call. Exact refresh timing may vary by brokerage. To get real-time data on Pay as you Go / Real-time, use the list accounts for a connection endpoint. Customers on Pay as you Go / Daily can force a refresh with the manual refresh endpoint.
🛠️ Usage
Commercial API Key Auth
const listUserAccountsResponse =
await commercialApiKeyClient.accountInformation.listUserAccounts({
userId: "snaptrade-user-123",
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
});Required credentials for this mode:
userId(string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.userSecret(string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the rotate user secret endpoint.
Personal API Key Auth
const listUserAccountsResponse =
await personalApiKeyClient.accountInformation.listUserAccounts();The client identifies the user in this mode. Do not pass userId userSecret to this method.
🔄 Return
🌐 Endpoint
/accounts GET
snaptrade.accountInformation.updateUserAccount
Updates various properties of a specified account.
🛠️ Usage
Commercial API Key Auth
const updateUserAccountResponse =
await commercialApiKeyClient.accountInformation.updateUserAccount({
accountId: "accountId_example",
userId: "snaptrade-user-123",
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
});Required credentials for this mode:
userId(string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.userSecret(string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the rotate user secret endpoint.
Personal API Key Auth
const updateUserAccountResponse =
await personalApiKeyClient.accountInformation.updateUserAccount({
accountId: "accountId_example",
});The client identifies the user in this mode. Do not pass userId userSecret to this method.
⚙️ Parameters
accountId: string
The ID of the account to update.
🔄 Return
🌐 Endpoint
/accounts/{accountId} PUT
snaptrade.apiStatus.check
Check whether the API is operational and verify timestamps.
🛠️ Usage
const checkResponse = await snaptrade.apiStatus.check();🔄 Return
🌐 Endpoint
/ GET
snaptrade.authentication.deleteSnapTradeUser
Deletes a registered user and all associated data. This action is irreversible. This API is asynchronous and will return a 200 status code if the request is accepted. The user and all associated data will be queued for deletion. Once deleted, a USER_DELETED webhook will be sent.
🛠️ Usage
Commercial API Key Auth
This endpoint supports Commercial API Key Auth authentication only.
const deleteSnapTradeUserResponse =
await commercialApiKeyClient.authentication.deleteSnapTradeUser({
userId: "snaptrade-user-123",
});Required credentials for this mode:
userId(string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
🔄 Return
🌐 Endpoint
/snapTrade/deleteUser DELETE
snaptrade.authentication.listSnapTradeUsers
Returns a list of all registered user IDs. Please note that the response is not currently paginated.
🛠️ Usage
Commercial API Key Auth
This endpoint supports Commercial API Key Auth authentication only.
const listSnapTradeUsersResponse =
await commercialApiKeyClient.authentication.listSnapTradeUsers();🌐 Endpoint
/snapTrade/listUsers GET
snaptrade.authentication.loginSnapTradeUser
Authenticates a SnapTrade user and returns the Connection Portal URL used for connecting brokerage accounts. Please check this guide for how to integrate the Connection Portal into your app.
Please note that the returned URL expires in 5 minutes.
🛠️ Usage
Commercial API Key Auth
const loginSnapTradeUserResponse =
await commercialApiKeyClient.authentication.loginSnapTradeUser({
broker: "ALPACA",
immediateRedirect: true,
customRedirect: "https://snaptrade.com",
reconnect: "8b5f262d-4bb9-365d-888a-202bd3b15fa1",
connectionType: "read",
showCloseButton: true,
darkMode: true,
locale: "pt-BR",
connectionPortalVersion: "v4",
userId: "snaptrade-user-123",
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
});Required credentials for this mode:
userId(string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.userSecret(string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the rotate user secret endpoint.
Personal API Key Auth
const loginSnapTradeUserResponse =
await personalApiKeyClient.authentication.loginSnapTradeUser({
broker: "ALPACA",
immediateRedirect: true,
customRedirect: "https://snaptrade.com",
reconnect: "8b5f262d-4bb9-365d-888a-202bd3b15fa1",
connectionType: "read",
showCloseButton: true,
darkMode: true,
locale: "pt-BR",
connectionPortalVersion: "v4",
});The client identifies the user in this mode. Do not pass userId userSecret to this method.
⚙️ Parameters
broker: string
Slug of the brokerage to connect the user to. See the integrations page for a list of supported brokerages and their slugs.
immediateRedirect: boolean
When set to true, user will be redirected back to the partner\'s site instead of the connection portal. This parameter is ignored if the connection portal is loaded inside an iframe. See the guide on ways to integrate the connection portal for more information.
customRedirect: string
URL to redirect the user to after the user connects their brokerage account. This parameter is ignored if the connection portal is loaded inside an iframe. See the guide on ways to integrate the connection portal for more information.
reconnect: string
The UUID of the brokerage connection to be reconnected. This parameter should be left empty unless you are reconnecting a disabled connection. See the guide on fixing broken connections for more information.
connectionType: string
Determines connection permissions (default: read) - read: Data access only. - trade: Data and trading access. - trade-if-available: Attempts to establish a trading connection if the brokerage supports it, otherwise falls back to read-only access automatically.
showCloseButton: boolean
Controls whether the close (X) button is displayed in the connection portal. When false, you control closing behavior from your app. Defaults to true.
darkMode: boolean
Enable dark mode for the connection portal. Defaults to false.
locale: string
Language the connection portal renders in. en and pt-BR are the languages we ship; any other language is rejected with a 400. Matching is case- and separator-insensitive, so pt-br, pt-BR and pt_BR are equivalent, and a regional tag resolves to the language when we ship it, so en-US renders en. Deliberately not an enum: those equivalent spellings are all accepted by the API, and an enum would have generated SDKs reject them before the request is sent. Screens without translated copy fall back to English individually. Defaults to en.
connectionPortalVersion: string
Sets the connection portal version to render. Currently only v4 is supported and is the default. All other versions are deprecated and will automatically be set to v4.
🔄 Return
AuthenticationLoginSnapTradeUser200Response
🌐 Endpoint
/snapTrade/login POST
snaptrade.authentication.registerSnapTradeUser
Registers a new SnapTrade user under your Client ID. A user secret will be automatically generated for you and must be properly stored in your system. Most SnapTrade operations require a user ID and user secret to be passed in as parameters.
🛠️ Usage
Commercial API Key Auth
This endpoint supports Commercial API Key Auth authentication only.
const registerSnapTradeUserResponse =
await commercialApiKeyClient.authentication.registerSnapTradeUser({
userId: "snaptrade-user-123",
});⚙️ Parameters
userId: string
SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
🔄 Return
🌐 Endpoint
/snapTrade/registerUser POST
snaptrade.authentication.resetSnapTradeUserSecret
Rotates the secret for a SnapTrade user. You might use this if userSecret is compromised. Please note that if you call this endpoint and fail to save the new secret, you'll no longer be able to access any data for this user, and your only option will be to delete and recreate the user, then ask them to reconnect.
🛠️ Usage
Commercial API Key Auth
This endpoint supports Commercial API Key Auth authentication only.
const resetSnapTradeUserSecretResponse =
await commercialApiKeyClient.authentication.resetSnapTradeUserSecret({
userId: "snaptrade-user-123",
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
});⚙️ Parameters
userId: string
SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
userSecret: string
SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the rotate user secret endpoint.
🔄 Return
🌐 Endpoint
/snapTrade/resetUserSecret POST
snaptrade.connections.deleteConnection
Deletes the SnapTrade connection specified by the ID. This will also remove the accounts and holdings data associated with the connection from SnapTrade. This action is irreversible. This endpoint is asynchronous, a 200 response indicates that a task has been queued to delete the connection. Listen for the CONNECTION_DELETED webhook webhook to know when the deletion has been completed and the data has been removed.
🛠️ Usage
Commercial API Key Auth
const deleteConnectionResponse =
await commercialApiKeyClient.connections.deleteConnection({
connectionId: "87b24961-b51e-4db8-9226-f198f6518a89",
userId: "snaptrade-user-123",
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
});Required credentials for this mode:
userId(string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.userSecret(string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the rotate user secret endpoint.
Personal API Key Auth
const deleteConnectionResponse =
await personalApiKeyClient.connections.deleteConnection({
connectionId: "87b24961-b51e-4db8-9226-f198f6518a89",
});The client identifies the user in this mode. Do not pass userId userSecret to this method.
⚙️ Parameters
connectionId: string
🔄 Return
🌐 Endpoint
/connection/{connectionId} DELETE
snaptrade.connections.detailBrokerageAuthorization
Returns a single connection for the specified ID.
🛠️ Usage
Commercial API Key Auth
const detailBrokerageAuthorizationResponse =
await commercialApiKeyClient.connections.detailBrokerageAuthorization({
authorizationId: "87b24961-b51e-4db8-9226-f198f6518a89",
userId: "snaptrade-user-123",
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
});Required credentials for this mode:
userId(string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.userSecret(string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the rotate user secret endpoint.
Personal API Key Auth
const detailBrokerageAuthorizationResponse =
await personalApiKeyClient.connections.detailBrokerageAuthorization({
authorizationId: "87b24961-b51e-4db8-9226-f198f6518a89",
});The client identifies the user in this mode. Do not pass userId userSecret to this method.
⚙️ Parameters
authorizationId: string
🔄 Return
🌐 Endpoint
/authorizations/{authorizationId} GET
snaptrade.connections.disableBrokerageAuthorization
Manually force the specified connection to become disabled. This should only be used for testing a reconnect flow, and never used on production connections.
Will trigger a disconnect as if it happened naturally, and send a CONNECTION_BROKEN webhook for the connection.
This endpoint is available on test keys. If you would like it enabled on production keys as well, please contact support as it is disabled by default.
🛠️ Usage
Commercial API Key Auth
const disableBrokerageAuthorizationResponse =
await commercialApiKeyClient.connections.disableBrokerageAuthorization({
authorizationId: "87b24961-b51e-4db8-9226-f198f6518a89",
userId: "snaptrade-user-123",
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
});Required credentials for this mode:
userId(string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.userSecret(string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the rotate user secret endpoint.
Personal API Key Auth
const disableBrokerageAuthorizationResponse =
await personalApiKeyClient.connections.disableBrokerageAuthorization({
authorizationId: "87b24961-b51e-4db8-9226-f198f6518a89",
});The client identifies the user in this mode. Do not pass userId userSecret to this method.
⚙️ Parameters
authorizationId: string
🔄 Return
BrokerageAuthorizationDisabledConfirmation
🌐 Endpoint
/authorizations/{authorizationId}/disable POST
snaptrade.connections.listBrokerageAuthorizationAccounts
Returns all brokerage accounts that belong to the specified connection for the authenticated user.
On Pay as you Go / Real-time, this endpoint refreshes each account's opening date, funding date, and total value live from the brokerage on each call.
On Pay as you Go / Daily, this endpoint returns Daily data. Daily data is cached and refreshed once a day. Exact refresh timing may vary by brokerage. To force a refresh, use the manual refresh endpoint.
Check your API key on the Customer Dashboard billing page to see whether your plan includes real-time data.
🛠️ Usage
Commercial API Key Auth
const listBrokerageAuthorizationAccountsResponse =
await commercialApiKeyClient.connections.listBrokerageAuthorizationAccounts({
authorizationId: "87b24961-b51e-4db8-9226-f198f6518a89",
userId: "snaptrade-user-123",
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
});Required credentials for this mode:
userId(string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.userSecret(string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the rotate user secret endpoint.
Personal API Key Auth
const listBrokerageAuthorizationAccountsResponse =
await personalApiKeyClient.connections.listBrokerageAuthorizationAccounts({
authorizationId: "87b24961-b51e-4db8-9226-f198f6518a89",
});The client identifies the user in this mode. Do not pass userId userSecret to this method.
⚙️ Parameters
authorizationId: string
🔄 Return
[Account](./models/

