Getting Started
1) Initialize a client with your clientId and consumerKey
You can get your clientId
and consumerKey
by contacting api@snaptrade.com
2) Check that the client is able to make a request to the API server
Call the API Status endpoint to make sure the API is live and that you can make the most basic request. You should receive a response indicating the API status, current server timestamp, and internal API minor version number.
3) Create a new user on SnapTrade
To create a secure brokerage authorization, we first need to register a test user. Call the Register user endpoint with a userId which can be any string as long as it's unique to a user. Upon receiving a 200 response, the user is registered successfully and you should receive a response with a user id and a randomly generated user secret. You can think of the user secret like a per-user API key that provides an additional layer of security for protecting user data. The user id and user secret need to be passed along to all SnapTrade API endpoints that involve access to user data.
4) Get a redirect URI
SnapTrade partners need to generate a redirect URI for a user so they can securely log in to the SnapTrade Connection portal and connect their accounts. The redirect URI can be generated by sending a POST request to the Login endpoint. userId and userSecret (previously generated through calling the registerUser endpoint) have to be in the query parameters of the POST request. The response includes a redirectURI to be used to login a user to the connection portal.
5) List accounts
After connecting an account to snaptrade, you can see the account IDs by calling list_user_accounts
.
6) Get account holdings data for a user
In order to retrieve user holdings for a specific account, you can call the Holdings endpoint by passing the clientId, timestamp, userId and list of account numbers (accounts) to filter the holdings. In the response, you should get an array of objects containing each account holdings data.
7) Deleting a user
Disabling all brokerage authorizations and permanently deleting all data associated with the user
Registering Users
1) Initialize a client with your clientId and consumerKey
You can get your clientId
and consumerKey
by contacting api@snaptrade.com
2) Check that the client is able to make a request to the API server
Call the API Status endpoint to make sure the API is live and that you can make the most basic request. You should receive a response indicating the API status, current server timestamp, and internal API minor version number.
3) Register User
To create a secure brokerage authorization, we first need to register a test user. Call the Register user endpoint with a userId which can be any string as long as it's unique to a user. Upon receiving a 200 response, the user is registered successfully and you should receive a response with a user id and a randomly generated user secret. You can think of the user secret like a per-user API key that provides an additional layer of security for protecting user data. The user id and user secret need to be passed along to all SnapTrade API endpoints that involve access to user data.
4) Login User
SnapTrade partners need to generate a redirect URI for a user so they can securely log in to the SnapTrade Connection portal and connect their accounts. The redirect URI can be generated by sending a POST request to the Login endpoint. userId and userSecret (previously generated through calling the registerUser endpoint) have to be in the query parameters of the POST request. The response includes a redirectURI to be used to login a user to the connection portal.
5) List Users
6) Deleting a user
Disabling all brokerage authorizations and permanently deleting all data associated with the user
Get Account Holdings for a User
1) Initialize a client with your clientId and consumerKey
You can get your clientId
and consumerKey
by contacting api@snaptrade.com
2) List accounts
You can see the account IDs by calling list_user_accounts
.
3) Get account holdings data for a user
In order to retrieve user holdings for a specific account, you can call the Holdings endpoint by passing the clientId, timestamp, userId and list of account numbers (accounts) to filter the holdings. In the response, you should get an array of objects containing each account holdings data.
Handling Users
1) Initialize SnapTrade client, user_id
, and user_secret
2) List accounts
You can see the account IDs by calling list_user_accounts
.
3) Get account holdings data for a user
In order to retrieve user holdings for a specific account, you can call the Holdings endpoint by passing the clientId, timestamp, userId and list of account numbers (accounts) to filter the holdings. In the response, you should get an array of objects containing each account holdings data.
4) Get Transactions / Historical Activities
Returns activities (transactions) for a user. Specifying start and end date is highly recommended for automatic calls for better performance. This uses the TransactionsAndReporting API.
5) Get Quotes
Get symbol quotes for a user, these are account and thus brokerage specific. That means if you have a US only account, you cannot get quotes for international exchanges. This uses the Trading API.
Placing Trades
1) Create user and Get redirect URL for a trading connection
You can get your clientId
and consumerKey
by contacting api@snaptrade.com
2) List accounts
After connecting an account you can see the account IDs by calling list_user_accounts
.
3) Get Order Impact
Check the account has enough cash to place trades.
4) Place the order
Place the order
Alternative - Place Order without checking impact
If you don't need to check the impact of an order before placing it use place_force_order