Create or Update Trading Account
Add a broker trading account to AutoTrader Web, or update an account that already exists.
https://apix.stocksdeveloper.in/account/createTradingAccount Use these calls to add a broker trading account to AutoTrader Web, or to update one that already exists. There are two endpoints, `createTradingAccount` and `updateTradingAccount`. The login parameters change from broker to broker, so this page explains the common fields and the broker specific fields each account needs. On success the call returns a trading account id.
This call adds a new broker trading account, or updates an existing one. It is available over the HTTP REST API and is mainly for developers building their own apps on top of our broker independent trading APIs.
There are two separate endpoints:
| Endpoint | Use it to |
|---|---|
createTradingAccount | Add a new trading account |
updateTradingAccount | Modify an existing trading account |
HTTP
Example
Create a new account:
curl https://apix.stocksdeveloper.in/account/createTradingAccount \
-H "api-key: <your-api-key>" \
-d "broker=YOUR_BROKER" \
-d "platform=PLATFORM" \
-d "loginId=<your-login-id>" \
-d "password=<your-password>" \
-d "totpKey=<your-totp-key>" \
-d "pseudoAccName=<pseudo-or-nickname>"
Update an existing account (pass the trading account id):
curl https://apix.stocksdeveloper.in/account/updateTradingAccount \
-H "api-key: <your-api-key>" \
-d "id=<trading-account-id>" \
-d "broker=YOUR_BROKER" \
-d "platform=PLATFORM" \
-d "loginId=<your-login-id>" \
-d "password=<your-password>" \
-d "totpKey=<your-totp-key>"
Response
On success:
{
"result": 15937688,
"message": "Account saved successfully.",
"status": true,
"commandId": null
}
On failure:
{
"result": null,
"message": "Account already exists! Either you or some other user has already added this account in our system. Please contact support.",
"status": false,
"commandId": null
}
The response fields work as follows:
| Field | Meaning |
|---|---|
result | Unique trading account id generated by AutoTrader Web (Number, Long). On failure this is null. |
message | Success or error message. |
status | true on success, false on failure. |
Parameters
Common parameters
A few parameters are the same across all brokers.
| Parameter | Description |
|---|---|
id | Unique trading account id generated by AutoTrader Web (Number, Long). Get it from the Fetch All Trading Accounts API (the systemId field). Mandatory for Update, not needed for Create. |
pseudoAccName | Pseudo or nickname for the account. Used only for Create, and it is optional. If you do not pass it, the login id of the trading account is used as the nickname. Not needed for Update. |
Broker specific parameters
All other parameters are broker specific, because every broker has a different login mechanism. Each account needs:
broker— the broker name, as listed on the supported brokers page.platform— the broker platform code that goes with that broker.- A set of credential fields that depend on the broker. Depending on the broker these may include
loginId,password,mpin,totpKey,dob,phone,token, and various API key, secret and id fields issued by the broker.
For the exact broker value, platform code and the full credential field list for your broker, see your broker’s setup guide under client setup or contact support.
Return value
The call returns the order id given by your trading platform.
The call returns the library order id. The Desktop Client passes the request on to your broker.
Notes
This call is not meant to be made repeatedly, so it has stricter limits than the other APIs. See API rate limits for the full list.
After adding an account, you can confirm it with Fetch All Trading Accounts and check the credentials with Validate Trading Account Credentials.
Python
Signature
def create_trading_account(self, account):
def update_trading_account(self, account):
Example
Pass the fields as a dictionary. Which keys you need depends on your broker and platform — see the account fields listed above.
account = {
'stockBroker': 'ZERODHA',
'platform': 'ZERODHA_API_IPV6',
'loginId': 'AB1234',
'pseudoAccount': 'ACC_NICK_NAME'
}
response = autotrader.create_trading_account(account)
if response.success():
print("Trading account id: {0}".format(response.result))
else:
print("Message: {0}".format(response.message))
Java
Signature
/**
* Adds a new broker trading account.
*
* @param account the account fields, as documented for your broker
* @return the id of the trading account that was created
*/
IOperationResponse<Long> createTradingAccount(Map<String, String> account);
/**
* Updates an existing broker trading account.
*
* @param account the account fields, as documented for your broker
* @return the id of the trading account that was updated
*/
IOperationResponse<Long> updateTradingAccount(Map<String, String> account);
Example
Map<String, String> account = new HashMap<>();
account.put("stockBroker", "ZERODHA");
account.put("platform", "ZERODHA_API_IPV6");
account.put("loginId", "AB1234");
account.put("pseudoAccount", "ACC_NICK_NAME");
IOperationResponse<Long> response = autotrader.createTradingAccount(account);
System.out.println("Trading account id: " + response.getResult());
C#
Signature
/// <summary>
/// Adds a new broker trading account.
/// </summary>
/// <param name="account"> the account fields, as documented for your broker </param>
/// <returns> the id of the trading account that was created </returns>
IOperationResponse<long?> CreateTradingAccount(IDictionary<string, string> account);
/// <summary>
/// Updates an existing broker trading account.
/// </summary>
/// <param name="account"> the account fields, as documented for your broker </param>
/// <returns> the id of the trading account that was updated </returns>
IOperationResponse<long?> UpdateTradingAccount(IDictionary<string, string> account);
Example
IDictionary<string, string> account = new Dictionary<string, string>
{
["stockBroker"] = "ZERODHA",
["platform"] = "ZERODHA_API_IPV6",
["loginId"] = "AB1234",
["pseudoAccount"] = "ACC_NICK_NAME"
};
IOperationResponse<long?> response = autoTrader.CreateTradingAccount(account);
Console.WriteLine("Trading account id: {0}", response.Result);
Notes
- Needs a recent library version. These calls are available in Python 1.5.0, Java 3.3.0 and C# 1.5.0 or newer. If your editor does not offer the function, upgrade the library — see client setup. The HTTP REST calls need nothing installed.
- Not available in Excel, AmiBroker or MetaTrader. Use the HTTP REST calls there.
- The fields are passed as a map or dictionary rather than fixed arguments, because they differ per broker and platform. A fixed signature would have to change every time a broker is added.
Thanks for the feedback. Still stuck? Contact support.
Last updated 8 August 2026