Login

The login flow starts by navigating to the public ACEAPI login endpoint:

https://acetrade.smctradeonline.com/login?api_key=xxx

After successful login, user gets redirected to the URL specified under MyApps. With the URL we pass auth_token & feed_token as query parameters.

Steps to generate Access Token:

  1. After logging in, you'll be redirected to a URL with a request token parameter. Save the request token.

  2. Concatenate your API key and the request token and save the result.

  3. Create an HMAC-SHA256 signature using the concatenated string and your API secret.

  // Golang Sample code
 
  const appKey = "[your API KEY]"
  const secret = "[your API SECRET]"
  const reqToken = "[the request token you received in step 2]"
  key := appKey + reqToken
  token := hmac.New(sha256.New, []byte(key))
  token.Write([]byte(secret))
  signature := hex.EncodeToString(token.Sum(nil))
  1. Send a POST request to baseURL+/auth/token with your API key, signature, and request token in the request body
// Request body
 
{
  "api_key": "[your API key]",
  "signature": "[the HMAC signature you generated in step 4]",
  "req_token": "[the request token you received in step 2]"
}
  1. Receive the access token in the response and save it.

Login flow Diagram

Authetication with SMC Global(Login services):

You can authenticate to get ACE APIs trading access using SMC Global Account Id. In order to login, you need a client id,password & OTP.

MethodAPIsEndpointDescription
POSTLogin/auth/loginAutheticate with SMC Global login credential
POSTLogout/auth/logoutTo logout
GETProfile/auth/profileRetrieve the user profile

Login API

This API authenticates the client and creates a session for the client in the Host System. The session is identified by the request token in the response.

Sample Request(Body):

{
  "platform": "api",
  "data": {
    "client_id": "<your client_id>",
    "password": "<your password>"
  }
}

Sample Response:

{
  "message": "Please enter TOTP",
  "status": "success",
  "data": {
    "request_token": "4d86841c43a739e554e493d9...",
    "is_2fa_enabled": true
  }
}

Logout API

This API closes the current session in the HOST system.

Sample Request(Body):

{
  "platform": "api",
  "data": {
    "client_id": "<your client_id>"
  }
}

Sample Response:

{
  "message": "Logged out successfully",
  "status": "success"
}

Profile API

User can get their user profile data.

Sample Response:

{
  "status": "success",
  "data": {
    "client_id": "ODIN4TEST",
    "name": "xxxxxSING",
    "email_id": "xxxxxxxxx@smcindiaonline.com",
    "mobile_no": "xxxxxxxx44",
    "exchanges": [
      "NSE Cash",
      "NSE Derivatives",
      "BSE Cash",
      "MCX Futures",
      "NCDEX Futures",
      "NSECDS Futures",
      "NSECDS Spot",
      "BSECDS Futures",
      "BSECDS Spot",
      "NSE OFS"
    ],
    "products": ["CARRYFORWARD", "OFS", "DELIVERY", "MARGIN", "BRACKET ORDER"]
  }
}