Validate Trading Account Credentials

Check whether a trading account's login credentials are valid, for one account or all your live accounts at once.

POST https://apix.stocksdeveloper.in/account/validateCredentials
WriteReturns true on success4 languagesBroker independent
In short

These calls check whether a trading account's login credentials are valid. AutoTrader Web tries to log in to the broker's trading platform and reports back success or failure. Run them every morning before the market opens to find accounts with wrong or expired credentials. There are three functions: validate before adding an account, validate one existing account, or validate all your live accounts at once.

This call checks whether a trading account’s login credentials are valid. AutoTrader Web tries to log in to the broker’s trading platform and reports back success or failure. It is useful every morning before the market starts, so you can find accounts with incorrect or expired credentials early.

It is available over the HTTP REST API and is mainly for developers building custom apps on our broker independent trading APIs.

There are three functions:

FunctionWhen to use it
Validate CredentialsValidate credentials before adding an account in the system.
Validate AccountValidate credentials of a single trading account already in the system.
Validate All AccountsValidate credentials of all accounts under your user.

Validate All Accounts only checks LIVE accounts.

HTTP

Example

Validate credentials before adding an account:

curl https://apix.stocksdeveloper.in/account/validateCredentials \
   -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>"

Validate a single existing account (by trading account id):

curl https://apix.stocksdeveloper.in/account/validateAccount \
   -H "api-key: <your-api-key>" \
   -d "tradingAccId=<trading-account-id>"

Validate all your live accounts:

curl https://apix.stocksdeveloper.in/account/validateAllAccounts \
   -H "api-key: <your-api-key>"

Response

Validate Credentials and Validate Account return the same structure.

On success:

{
	"result": true,
	"message": null,
	"status": true,
	"commandId": "d26a6efb-0690-4fc2-bba1-04fda58db03e"
}

On failure:

{
	"result": false,
	"message": "Error from broker: [10002 - Incorrect Client ID or Password. Attempt 1 of 5]",
	"status": true,
	"commandId": "cc577516-0de1-4e1e-bc61-0b8007db1722"
}

Validate All Accounts returns a list, one entry per account:

{
	"result": [
		{
			"tradingAccId": 23409730,
			"pseudoAccId": 23409731,
			"valid": true,
			"result": "SUCCESS",
			"message": "SUCCESS",
			"tradingAccLoginId": "NM291"
		},
		{
			"tradingAccId": 23502007,
			"pseudoAccId": 23502008,
			"valid": false,
			"result": "FAILURE",
			"message": "Error from broker: [Access denied]",
			"tradingAccLoginId": "159401"
		}
	],
	"message": null,
	"status": true,
	"commandId": null
}

Parameters

Validate Credentials

The parameters are the same as the Create Trading Account parameters.

Validate Account

ParameterTypeDescription
tradingAccIdNumber (Long)Unique trading account id generated by AutoTrader Web. Get it from the Fetch All Trading Accounts API.

Validate All Accounts

No parameters.

The response fields for Validate Credentials and Validate Account are result (SUCCESS or FAILURE) and message (success or error message). For Validate All Accounts, each item in the result list carries result (SUCCESS or FAILURE), message (failure reason), valid (boolean), tradingAccLoginId, tradingAccId (internal id) and pseudoAccId (internal id).

Return value

DirectJava · C# · Python · HTTP

The call returns the order id given by your trading platform.

BridgeExcel · AmiBroker · MetaTrader

The call returns the library order id. The Desktop Client passes the request on to your broker.

Notes

These calls are not meant to be made repeatedly, so they have stricter limits than the other APIs. See API rate limits for the full list.

Python

Signature

def validate_credentials(self, account):
def validate_account(self, trading_account_id):
def validate_all_accounts(self):

Example

# Check every account before the market opens
response = autotrader.validate_all_accounts()

if response.success():
    for r in response.result:
        if not r.valid:
            print("{0} needs attention: {1}".format(
                r.tradingAccLoginId, r.message))
else:
    print("Message: {0}".format(response.message))

Java

Signature

/**
 * Checks whether a set of broker credentials is valid, without saving an account.
 */
IOperationResponse<Boolean> validateCredentials(Map<String, String> account);

/**
 * Checks whether a saved account can still log in to the broker.
 */
IOperationResponse<Boolean> validateAccount(Long tradingAccountId);

/**
 * Checks every trading account under your user, reporting each separately.
 */
IOperationResponse<List<AccountValidationPublic>> validateAllAccounts();

Example

IOperationResponse<List<AccountValidationPublic>> response =
	autotrader.validateAllAccounts();

for (AccountValidationPublic r : response.getResult()) {
	if (!r.isValid()) {
		System.out.println(r.getTradingAccLoginId()
			+ " needs attention: " + r.getMessage());
	}
}

C#

Signature

/// <summary>
/// Checks whether a set of broker credentials is valid, without saving an account.
/// </summary>
IOperationResponse<bool?> ValidateCredentials(IDictionary<string, string> account);

/// <summary>
/// Checks whether a saved account can still log in to the broker.
/// </summary>
IOperationResponse<bool?> ValidateAccount(long tradingAccountId);

/// <summary>
/// Checks every trading account under your user, reporting each separately.
/// </summary>
IOperationResponse<IList<AccountValidationPublic>> ValidateAllAccounts();

Example

IOperationResponse<IList<AccountValidationPublic>> response =
    autoTrader.ValidateAllAccounts();

foreach (AccountValidationPublic r in response.Result)
    if (!r.Valid)
        Console.WriteLine("{0} needs attention: {1}",
            r.TradingAccLoginId, r.Message);

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.
  • Validating logs in to the broker, so run it before the session starts rather than in a loop during market hours.
Was this page helpful?

Last updated 8 August 2026